12 #include "StFgtJanGainMaker.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 StFgtJanGainMaker::StFgtJanGainMaker(
const Char_t* dbMkrName ,
const Char_t* name ) :
StMaker( name ), mDbMkrName( dbMkrName ), mFgtDbMkr(0) {
31 Int_t StFgtJanGainMaker::Init(){
34 GetEvtHddr()->SetEventNumber(1);
37 eventPtr= (
StEvent*)GetInputDS(
"StEvent");
40 mFgtCollectionPtr=eventPtr->fgtCollection();
41 assert(mFgtCollectionPtr);
42 mFgtDbMkr =
static_cast< StFgtDbMaker*
>( GetMaker( mDbMkrName.data() ));
45 LOG_INFO <<
"Using date and time " << mFgtDbMkr->GetDateTime().GetDate() <<
", "
46 << mFgtDbMkr->GetDateTime().GetTime() << endm;
57 StFgtJanGainMaker::initHistos(){
61 memset(hA,0,
sizeof(hA));
62 hA[5]=
new TH1F(
"fgt1",
"Seen APVs per event; # APVs/event",150,-0.5,149.5);
66 for(
int i=0;i<mxHA;i++) {
67 if( hA[i]==0)
continue;
85 StFgtDb *fgtTables = mFgtDbMkr->getDbTables();
91 mFgtCollectionPtr = mFgtCollectionPtr=eventPtr->fgtCollection();
92 assert( mFgtCollectionPtr);
95 for( UInt_t discIdx=0; discIdx<mFgtCollectionPtr->getNumDiscs(); ++discIdx ){
97 if( stripCollectionPtr ){
98 StSPtrVecFgtStrip& stripVec = stripCollectionPtr->getStripVec();
99 StSPtrVecFgtStripIterator stripIter;
101 for( stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
102 int rdo=0, arm=-1, apv=-1, chn=-1;
103 Short_t disk=-1, quad=-1, strip=-1;
char layer=
'x';
104 double ordinate=-1,lowerSpan=-1,upperSpan=-1.;
105 (*stripIter)->getElecCoords( rdo, arm, apv, chn );
106 int stat=fgtTables->getStatusFromElecCoord(rdo,arm,apv,chn);
108 int geoId=fgtTables->getGeoIdFromElecCoord(rdo, arm, apv, chn);
111 StFgtGeom::decodeGeoId(geoId,disk,quad,layer,strip);
112 StFgtGeom::getPhysicalCoordinate(geoId,disk,quad,layer,ordinate,lowerSpan,upperSpan);
115 if(rdo==2 && arm==1 && apv==5)
continue;
116 if(rdo==2 && arm==1 )
continue;
117 if(rdo==2 && arm==2 && apv==18)
continue;
118 if(rdo==1 && arm==3 && apv==9)
continue;
119 if(rdo==2 && arm==3 )
continue;
120 if(rdo==1 && arm==4 && apv==19)
continue;
121 if(rdo==1 && arm==4 && apv==21)
continue;
122 if(rdo==2 && arm==4 )
continue;
124 double ped=fgtTables->getPedestalFromElecCoord(rdo,arm,apv,chn);
125 double pedSig=fgtTables->getPedestalSigmaFromElecCoord(rdo,arm,apv,chn);
127 memset(adcA,0,
sizeof(adcA));
128 float minAdc=9999, maxAdc=-9999, sum=0;
130 for(Int_t is=0;is<Ntimebin;is++){
131 adcA[is]=(*stripIter)->getAdc(is)-ped;
132 if(adcA[is]<minAdc) { minAdc=adcA[is]; iMin=is;}
133 if(adcA[is]>maxAdc) maxAdc=adcA[is];
138 if(maxAdc<600)
continue;
139 if(maxAdc>3000)
continue;
144 TH1F * hsp=
new TH1F(Form(
"ps%d_%d",iEvt,nPulse), Form(
"ieve=%d rdo=%d arm=%d apv=%d ch=%d geoId=%d strip=%d%c%c%03d; time bin",iEvt,rdo,arm,apv,chn,geoId,disk+1,quad+
'A',layer,strip),Ntimebin+2,0,Ntimebin+2);
145 for(Int_t is=0;is<Ntimebin;is++){
146 hsp->SetBinContent(is+1,adcA[is]-ped);
147 hsp->SetBinError(is+1,pedSig);
153 if(abs(lastGeo-geoId)==1) star=
'*';
155 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);
156 for(Int_t is=0;is<Ntimebin;is++) printf(
" %.0f ",adcA[is]-minAdc);
157 printf(
"\n dbPd=%.1f minAdc=%.1f del=%.1f\n",ped,minAdc,ped-minAdc);
169 cout <<
"StFgtJanGainMaker::Finish()" << endl;