25 #include "StFgtQaHighStrips.h"
30 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
32 #include "StRoot/StEvent/StEvent.h"
33 #include "StRoot/StEvent/StFgtCollection.h"
34 #include "StRoot/StEvent/StFgtStripCollection.h"
35 #include "StRoot/StEvent/StFgtStrip.h"
36 #include "StRoot/StFgtUtil/StFgtConsts.h"
37 #include "StRoot/StFgtDbMaker/StFgtDbMaker.h"
40 StFgtQaHighStrips::StFgtQaHighStrips(
const Char_t* name ) :
41 StMaker( name ), mHist2D( 0 ), mHistVec( kFgtNumOctants, (TH1F*)0 ), mMaxNum( 10 ) {
46 StFgtQaHighStrips::~StFgtQaHighStrips(){
50 HistVec_t::iterator iter;
51 for( iter = mHistVec.begin(); iter != mHistVec.end(); ++iter )
56 Int_t StFgtQaHighStrips::Init(){
60 ss <<
"h" <<
GetName() <<
"_2D";
61 std::string name = ss.str();
63 mHist2D =
new TH2F( ss.str().data(),
"Number of High Strips per Event per Octant; Octant; Number of Strips",
64 kFgtNumOctants, 0, kFgtNumOctants, mMaxNum, 0, mMaxNum );
66 Char_t octName[2] = {
'L',
'S' };
68 for( Int_t disc = 0; disc < kFgtNumDiscs; ++disc ){
69 for( Int_t quad = 0; quad < kFgtNumDiscs; ++quad ){
70 for( Int_t oct = 0; oct < 2; ++oct, ++histIdx ){
73 ss << disc+1 << (Char_t)(quad+
'A') << octName[oct];
75 std::string label = ss.str();
76 mHist2D->GetXaxis()->SetBinLabel( histIdx, label.data() );
80 ss <<
"h" <<
GetName() <<
"_" << histIdx;
82 mHistVec[ histIdx ] =
new TH1F( ss.str().data(),
83 ( std::string(
"Number of High Strips per Event for Octant" ) + label +
84 "; Number of Strips; Number of Events").
data(),
85 mMaxNum, 0, mMaxNum );
98 LOG_FATAL <<
"Error finding StFgtDbMaker" << endm;
103 StFgtDb *fgtTables = fgtDbMkr->getDbTables();
106 LOG_FATAL <<
"Error finding StFgtDb" << endm;
114 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
116 LOG_ERROR <<
"Error getting pointer to StEvent in '" << ClassName() <<
"'" << endm;
119 fgtCollectionPtr=eventPtr->fgtCollection();
121 if( !fgtCollectionPtr) {
122 LOG_ERROR <<
"Error getting pointer to StFgtCollection in '" << ClassName() <<
"'" << endm;
127 vector< Int_t > numPerOct( kFgtNumOctants, 0 );
129 for( Int_t disc = 0; disc < kFgtNumDiscs && !ierr; ++disc ){
132 stripCollectionPtr = fgtCollectionPtr->getStripCollection( disc );
135 if( stripCollectionPtr ){
136 const StSPtrVecFgtStrip &stripVec = stripCollectionPtr->getStripVec();
137 StSPtrVecFgtStripConstIterator stripIter;
139 for( stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
140 Int_t rdo, arm, apv, channel;
141 (*stripIter)->getElecCoords( rdo, arm, apv, channel );
143 Char_t layer, oct = StFgtGeom::getOctant( apv );
144 Short_t disc2, quad, strip;
145 StFgtGeom::decodeGeoId( (*stripIter)->getGeoId(), disc2, quad, layer, strip );
147 int histIdx = disc2*kFgtNumQuads*2 + quad*2 + (oct==
'S');
148 ++numPerOct[ histIdx ];
153 vector< Int_t >::iterator iter;
156 for( iter = numPerOct.begin(); iter != numPerOct.end(); ++iter, ++histIdx ){
158 mHist2D->Fill( histIdx+1, *iter );
159 mHistVec[ histIdx ]->Fill( *iter );
virtual const char * GetName() const
special overload