29 #include "StEEmcFgtLHTrackQa.h"
30 #include "StRoot/StFgtPool/StFgtTracking/StFgtLHTracking.h"
31 #include "StRoot/StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
32 #include "StRoot/StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
33 #include "StEEmcRawMapMaker.h"
37 StEEmcFgtLHTrackQa::StEEmcFgtLHTrackQa(
const Char_t* name,
const Char_t* rawMapMkrName,
const Char_t* fgtLHTkrName ) :
38 StMaker( name ), mEEmcRawMapMkr(0), mFgtLHTkr(0), mThres(3) {
41 mFgtLHTkr =
static_cast< StFgtLHTracking*
>( GetMaker( fgtLHTkrName ) );
43 for( Int_t i=0; i<4; ++i )
44 mSig[i] = mSigPer[i] = 0;
48 StEEmcFgtLHTrackQa::~StEEmcFgtLHTrackQa(){ };
50 Int_t StEEmcFgtLHTrackQa::Init(){
55 for( Int_t i=0; i<4; ++i ){
59 mSig[i] =
new TH1F( ss.str().data(),
";; Counts", 2, -0.5, 1.5 );
63 ss <<
"hSigPer_" << i;
64 mSigPer[i] =
new TH1F( ss.str().data(),
";; Counts", 2, -0.5, 1.5 );
66 mSig[i]->GetXaxis()->SetBinLabel( 1,
"Noise" );
67 mSig[i]->GetXaxis()->SetBinLabel( 2,
"Signal" );
68 mSigPer[i]->GetXaxis()->SetBinLabel( 1,
"Noise" );
69 mSigPer[i]->GetXaxis()->SetBinLabel( 2,
"Signal" );
72 assert( mEEmcRawMapMkr );
79 assert( mEEmcRawMapMkr );
82 const StFgtLHTrackVec& trackVec = mFgtLHTkr->getTrackVec();
83 const StEEmcRawMap* eemcMap[4];
85 for( Int_t i=0; i<4; ++i ){
86 eemcMap[i] = &mEEmcRawMapMkr->getMap( i );
87 eemcEmpty &= eemcMap[i]->empty();
91 if( !eemcMap[0]->empty() ){
92 LOG_INFO <<
"\t-> Towers has size " << eemcMap[0]->size() << endm;
96 if( !trackVec.empty() && !eemcEmpty ){
97 StFgtLHTrackVec::const_iterator trackVecIter;
100 LOG_INFO <<
"Event " << GetEventNumber() <<
" # tracks " << trackVec.size() << endm;
104 std::map< Int_t, Int_t > towMap;
105 std::map< Int_t, Int_t >::iterator towMapIter;
108 Int_t sec, sub, etabin;
110 for( trackVecIter = trackVec.begin(); trackVecIter != trackVec.end(); ++trackVecIter ){
113 Double_t x = trackVecIter->line.bx + trackVecIter->line.mx*kEEmcZSMD;
114 Double_t y = trackVecIter->line.by + trackVecIter->line.my*kEEmcZSMD;
115 TVector3 pos( x, y, kEEmcZSMD );
117 Bool_t found = eemcGeom.
getTower( pos, sec, sub, etabin );
120 LOG_INFO <<
"\tTrack points to (x, y) = ( " << x <<
", " << y <<
"), (eta,phi) = ( " << pos.Eta() <<
", " << pos.Phi() <<
") at SMDZ = tower at " << sec <<
' ' << sub <<
' ' << etabin << endm;
124 Int_t index = etabin + kEEmcNumEtas*( sub + kEEmcNumSubSectors*sec );
126 towMapIter = towMap.find( index );
127 if( towMapIter == towMap.end() )
130 ++(towMapIter->second);
134 StEEmcRawMap::const_iterator rawMapIter;
136 for( towMapIter = towMap.begin(); towMapIter != towMap.end(); ++towMapIter ){
137 Int_t index = towMapIter->first;
138 Int_t num = towMapIter->second;
141 LOG_INFO <<
"\t---> Accessing tower index " << index << endm;
144 for( Int_t i=0; i<4; ++i ){
145 rawMapIter = eemcMap[i]->find( index );
147 if( rawMapIter != eemcMap[i]->end() ){
150 Double_t val = (data.rawAdc - data.ped) / data.pedSigma;
152 mSig[i]->Fill( (Int_t)(val > mThres) );
153 mSigPer[i]->Fill( (Int_t)(val/num > mThres) );
155 cout <<
"EEMC tower: " << i <<
' ' << index <<
' ' << data.rawAdc <<
' ' << data.ped <<
' ' << data.pedSigma <<
' ' << val <<
' ' << num
156 << (val > mThres ?
" SIGNAL" :
" ") << endl;
168 if( !mFileOutName.empty() ){
169 TFile *f =
new TFile( mFileOutName.data(),
"RECREATE" );
172 LOG_ERROR <<
"Error opening file '" << mFileOutName <<
"'" << endl;
177 for(Int_t i=0; i<4; ++i ){
static EEmcGeomSimple & Instance()
returns a reference to a static instance of EEmcGeomSimple
bool getTower(const TVector3 &r, int &sec, int &sub, int &etabin, Float_t &dphi, Float_t &deta) const