1 #include "StBemcData.h"
2 #include "StEmcUtil/database/StEmcDecoder.h"
3 #include "StEmcUtil/geometry/StEmcGeom.h"
4 #include "StEventTypes.h"
6 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
7 #include "StMuDSTMaker/COMMON/StMuDst.h"
17 Int_t calib[] = {1, 1, 1, 1, 0, 0, 0, 0};
18 Int_t pedSub[] = {1, 1, 1, 1, 0, 0, 0, 0};
19 Float_t cut[] = {-1, 1.5, 1.5, 1.5, -1, -1, -1, -1};
20 Int_t cutType[] = {0, 1, 1, 1, 0, 0, 0, 0};
21 Int_t onlyCal[] = {0, 0, 0, 0, 0, 0, 0, 0};
22 Int_t status[] = {1, 1, 1, 1, 0, 0, 0, 0};
23 Int_t crate[] = {1, 1, 1, 1, 0, 0, 0, 0};
25 for(Int_t i=0; i<MAXDETBARREL; i++)
27 mControlADCtoE->Calibration[i]=calib[i];
28 mControlADCtoE->DeductPedestal[i]=pedSub[i];
29 mControlADCtoE->CutOff[i]=cut[i];
30 mControlADCtoE->CutOffType[i]=cutType[i];
31 mControlADCtoE->OnlyCalibrated[i]=onlyCal[i];
32 mControlADCtoE->CheckStatus[i]=status[i];
33 mControlADCtoE->CheckCrate[i]=crate[i];
53 return StBemcRaw::make(emcraw,event);
57 return StBemcRaw::make(DS,event);
69 event->setEmcCollection(emcN);
72 Int_t ADC[MAXDETBARREL][BSMDCH];
73 Int_t CRATE[MAXDETBARREL][BSMDCH];
74 Int_t CAP[MAXDETBARREL][BSMDCH];
75 Int_t
ID[MAXDETBARREL][BSMDCH];
76 Int_t NH[MAXDETBARREL];
77 Int_t
Crate,RDO,Index,Daq;
80 for(Int_t det=1;det<=MAXDETBARREL;det++)
82 StDetectorId
id =
static_cast<StDetectorId
>(det+kBarrelEmcTowerId-1);
88 mIsCorrupted[det-1]=kFALSE;
89 for(Int_t crate=1;crate<=MAXCRATES;crate++)
91 mCrateStatus[det-1][crate-1] = (Int_t)detector->crateStatus(crate);
92 if(mCrateStatus[det-1][crate-1]==crateOK)
94 if(mCrateStatus[det-1][crate-1]==crateHeaderCorrupt)
95 mIsCorrupted[det-1] = kTRUE;
98 StEmcGeom* geo = StEmcGeom::instance(det);
99 for(UInt_t j=1;j<=BEMCMODULES;j++)
104 StSPtrVecEmcRawHit& rawHit=module->hits();
105 for(UInt_t k=0;k<rawHit.size();k++)
107 Int_t m=rawHit[k]->module();
108 Int_t e=rawHit[k]->eta();
109 Int_t s=abs(rawHit[k]->sub());
110 Int_t adc=rawHit[k]->adc();
111 Int_t cap=rawHit[k]->calibrationType();
115 geo->getId(m,e,s,
id);
116 ID[det-1][NH[det-1]] = id;
117 ADC[det-1][NH[det-1]] = adc;
118 CAP[det-1][NH[det-1]] = cap;
129 else if(det==BSMDE || det == BSMDP)
131 mDecoder->
GetSmdRDO(det,m,e,s,RDO,Index);
134 CRATE[det-1][NH[det-1]] = Crate;
142 for(Int_t det=1;det<=MAXDETBARREL;det++)
145 for(Int_t i = 0;i<NH[det-1];i++)
147 S =
makeHit(emcN,det,ID[det-1][i],ADC[det-1][i],CRATE[det-1][i],CAP[det-1][i],E);
165 for(Int_t det=1;det<=MAXDETBARREL;det++)
169 StDetectorId did =
static_cast<StDetectorId
>(det+kBarrelEmcTowerId-1);
171 mIsCorrupted[det-1]=kFALSE;
172 for(Int_t crate = 1;crate<=MAXCRATES;crate++)
174 mCrateStatus[det-1][crate-1] = (Int_t)muEmc->getCrateStatus(crate,det);
175 if(mCrateStatus[det-1][crate-1]==crateOK)
177 if(mCrateStatus[det-1][crate-1]==crateHeaderCorrupt)
178 mIsCorrupted[det-1] = kTRUE;
180 detector->setCrateStatus(crate,(StEmcCrateStatus)mCrateStatus[det-1][crate-1]);
182 StEmcGeom* geo = StEmcGeom::instance(det);
184 Int_t ADC=0,
ID=0,CRATE=0,RDO=0,INDEX=0,CAP=0,DAQ=0;
191 nh=muEmc->getNPrsHits(det);
192 if (det==BSMDE || det==BSMDP)
193 nh=muEmc->getNSmdHits(det);
194 for(Int_t j=0;j<nh;j++)
200 ADC = muEmc->getTowerADC(
ID,det);
210 CAP = hit->getCalType();
214 if(det==BSMDE || det==BSMDP)
219 CAP = hit->getCalType();
221 mDecoder->
GetSmdRDO(det,m,e,s,RDO,INDEX);
int getId() const
Return Module number.
Bool_t make(TDataSet *, StEvent *)
Make the BEMC detector from DAQ.
void emptyEmcCollection(StEmcCollection *)
empty current emcCollection
void printStats(Int_t)
Print statistics for detector 'det'.
Int_t makeHit(StEmcCollection *, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t &)
make StEmcRawHit
void clearStats(Int_t)
Clear statistics for detector 'det'.
void updateStats(Int_t, Int_t, Int_t, Float_t)
Update statistics for detector 'det'.
int GetTowerCrateFromDaqId(int RDO, int &crate, int &sequence) const
Get crate number from Daq Id for towers.
int getAdc() const
Return ADC value.
int GetPsdRDO(int softId, int &RDO, int &posInFiber) const
Get PSD fiber and position from id.
virtual ~StBemcData()
StBemcData destructor.
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const
int GetSmdRDO(int detector, int m, int e, int s, int &RDO, int &posInFiber) const
Get SMD fiber and position from detector number (3==SMDE, 4==SMDP), m, e, s.
int GetDaqIdFromTowerId(int softId, int &RDO) const
Get Daq Id from Software Id for towers.