12 #include "StFgtSanityMaker.h"
13 #include "StRoot/StEvent/StFgtCollection.h"
14 #include "StRoot/StEvent/StFgtStrip.h"
15 #include "StRoot/StEvent/StEvent.h"
16 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
17 #include "StRoot/StFgtDbMaker/StFgtDbMaker.h"
23 StFgtSanityMaker::StFgtSanityMaker(
const Char_t* name ,
const Char_t* dbMkrName ) :
StMaker( name ), mDbMkrName( dbMkrName ), mFgtDbMkr(0) {
30 Int_t StFgtSanityMaker::Init(){
33 GetEvtHddr()->SetEventNumber(1);
36 eventPtr= (
StEvent*)GetInputDS(
"StEvent");
39 mFgtCollectionPtr=NULL;
41 mFgtCollectionPtr=eventPtr->fgtCollection();
45 mFgtCollectionPtr=eventPtr->fgtCollection();
47 if(!mFgtCollectionPtr) {
49 eventPtr->setFgtCollection(mFgtCollectionPtr);
50 LOG_DEBUG <<
"::prepareEnvironment() has added a non existing StFgtCollection()"<<endm;
53 mFgtCollectionPtr->Clear();
56 mFgtDbMkr =
static_cast< StFgtDbMaker*
>( GetMaker( mDbMkrName.data() ) );
59 LOG_FATAL <<
"Error finding mFgtDbMkr named '" << mDbMkrName <<
"'" << endm;
64 LOG_INFO <<
"Using date and time " << mFgtDbMkr->GetDateTime().GetDate() <<
", "
65 << mFgtDbMkr->GetDateTime().GetTime() << endm;
68 hh=
new TH1F(
"fgt1",
"Seen APVs per event; # APVs/event",150,-0.5,149.5);
82 int chCntDet[kFgtNumDiscs][kFgtNumQuads][kFgtApvsPerAssembly*2];
83 int chCntDaq[ kFgtNumRdos ][kFgtNumArms ][kFgtApvsPerAssembly*2];
84 memset(chCntDet,0,
sizeof(chCntDet));
85 memset(chCntDaq,0,
sizeof(chCntDaq));
90 StFgtDb *fgtTables = mFgtDbMkr->getDbTables();
96 mFgtCollectionPtr = mFgtCollectionPtr=eventPtr->fgtCollection();
97 assert( mFgtCollectionPtr);
100 for( UInt_t discIdx=0; discIdx<mFgtCollectionPtr->getNumDiscs(); ++discIdx ){
102 if( stripCollectionPtr ){
103 StSPtrVecFgtStrip& stripVec = stripCollectionPtr->getStripVec();
104 StSPtrVecFgtStripIterator stripIter;
106 for( stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
107 int rdo=0, arm=-1, apv=-1, chn=-1;
108 Short_t disk=-1, quad=-1, strip=-1;
char layer=
'x';
109 double ordinate=-1,lowerSpan=-1,upperSpan=-1.;
110 (*stripIter)->getElecCoords( rdo, arm, apv, chn );
111 int stat=fgtTables->getStatusFromElecCoord(rdo,arm,apv,chn);
113 int geoId=fgtTables->getGeoIdFromElecCoord(rdo, arm, apv, chn);
116 StFgtGeom::decodeGeoId(geoId,disk,quad,layer,strip);
117 StFgtGeom::getPhysicalCoordinate(geoId,disk,quad,layer,ordinate,lowerSpan,upperSpan);
119 chCntDet[disk][quad][apv]++;
120 chCntDaq[rdo-1][arm][apv]++;
123 if(rdo==2 && arm==1 && apv==5)
continue;
124 if(rdo==2 && arm==1 )
continue;
125 if(rdo==2 && arm==2 && apv==18)
continue;
126 if(rdo==1 && arm==3 && apv==9)
continue;
127 if(rdo==2 && arm==3 )
continue;
128 if(rdo==1 && arm==4 && apv==19)
continue;
129 if(rdo==1 && arm==4 && apv==21)
continue;
130 if(rdo==2 && arm==4 )
continue;
132 double ped=fgtTables->getPedestalFromElecCoord(rdo,arm,apv,chn);
133 double pedSig=fgtTables->getPedestalSigmaFromElecCoord(rdo,arm,apv,chn);
135 memset(adcA,0,
sizeof(adcA));
136 float minAdc=9999, maxAdc=-9999, sum=0;
138 for(Int_t is=0;is<Ntimebin;is++){
139 adcA[is]=(*stripIter)->getAdc(is);
140 if(adcA[is]<minAdc) { minAdc=adcA[is]; iMin=is;}
141 if(adcA[is]>maxAdc) maxAdc=adcA[is];
147 sum-=minAdc*Ntimebin;
148 if(maxAdc<600)
continue;
149 if(maxAdc>3000)
continue;
152 if(abs(lastGeo-geoId)==1) star=
'*';
154 printf(
"\nieve=%d rdo=%d arm=%d apv=%d ch=%d geoId=%d strip=%d%c%c%03d %csumADC-ped=%.1f\n adc-ped[0...6]=",iEvt,rdo,arm,apv,chn,geoId,disk+1,quad+
'A',layer,strip,star,sum);
155 for(Int_t is=0;is<Ntimebin;is++) printf(
" %.0f ",adcA[is]-minAdc);
156 printf(
"\n dbPd=%.1f minAdc=%.1f del=%.1f\n",ped,minAdc,ped-minAdc);
162 printf(
"JJ eventID=%d FGT sanity (detector view)\n",eventPtr->id());
163 for(
int idisc=0;idisc<kFgtNumDiscs;idisc++)
164 for(
int iquad=0;iquad<kFgtNumQuads;iquad++){
165 printf(
"disc=%d quad=%c ",idisc+1,iquad+
'A');
166 for(
int iapv=0;iapv<kFgtApvsPerAssembly*2;iapv++){
167 if(chCntDet[idisc][iquad][iapv]<=0)
continue;
168 printf(
" apv%02d:%3d, ",iapv,chCntDet[idisc][iquad][iapv]);
173 printf(
"\nJJ eventID=%d FGT sanity (Daq view)\n",eventPtr->id());
174 for(
int irdo=0;irdo<kFgtNumRdos; irdo++)
175 for(
int iarm=0;iarm<kFgtNumArms;iarm++) {
176 printf(
"RDO=%d arm=%d apv:nCh ",irdo+1,iarm);
177 for(
int iapv=0;iapv<kFgtApvsPerAssembly*2;iapv++){
178 if(chCntDaq[irdo][iarm][iapv]<=0)
continue;
179 printf(
" %2d:%3d, ",iapv,chCntDaq[irdo][iarm][iapv]);
186 for(
int irdo=0;irdo<kFgtNumRdos; irdo++)
187 for(
int iarm=0;iarm<kFgtNumArms;iarm++)
188 for(
int iapv=0;iapv<kFgtApvsPerAssembly*2;iapv++)
189 if(chCntDaq[irdo][iarm][iapv]>64) nSeenApv++;
198 cout <<
"StFgtSanityMaker::Finish()" << endl;
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.