1 #include "StEEmcA2EMaker.h"
3 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
4 #include "StMuDSTMaker/COMMON/StMuEmcCollection.h"
5 #include "StMuDSTMaker/COMMON/StMuDst.h"
7 #include "StEventMaker/StEventMaker.h"
9 #include "StEEmcUtil/database/StEEmcDb.h"
10 #include "StEEmcUtil/database/EEmcDbItem.h"
14 #include "StEvent/StEvent.h"
15 #include "StEvent/StEmcDetector.h"
16 #include "StEvent/StEmcModule.h"
17 #include "StEvent/StEmcRawHit.h"
18 #include "StEvent/StEmcCollection.h"
35 for ( Int_t layer=0; layer < 4; layer++ ) {
44 for ( Int_t i=0;i<12;i++ )
45 for ( Int_t j=0;j<6;j++ )
56 for ( Int_t layer=0; layer < 4; layer++ )
64 for ( Int_t phi=phibin-1;phi<=phibin+1;phi++ )
65 for ( Int_t eta=etabin-1;eta<=etabin+1;eta++ )
69 if ( phi==phibin && eta==etabin )
continue;
72 if ( eta<0 || eta>11)
continue;
76 if ( kphi<0 ) kphi+=60;
77 if ( kphi>59 ) kphi-=60;
79 Int_t neighbor=12*kphi+eta;
81 assert(neighbor>=0 && neighbor<720 );
101 for ( Int_t sec=0; sec<12; sec++ ) {
102 for ( Int_t plane=0; plane<2; plane++ ) {
134 for ( Int_t i = 0; i < 4; i++ )
mHitTowers.push_back(t);
138 std::vector< StEEmcStripVec_t > plane;
141 for ( Int_t i=0; i < 12; i++ )
mHitStrips.push_back(plane);
154 if ( mInputType == 1 ) {
157 if ( mInputType == 2 ) {
160 if ( mInputType == 3 ) {
164 return StMaker::Init();
182 if ( mInputType == 1 ) {
185 if ( mInputType == 2 ) {
187 return readStEvent();
189 if ( mInputType == 3 ) {
190 if ( mMuDstMaker )
return readEzt();
203 if ( !emc )
return false;
217 for ( Int_t ihit = 0; ihit < emc -> getNEndcapTowerADC(); ihit++ ) {
219 Int_t adc, sec, sub, eta;
220 emc -> getEndcapTowerADC ( ihit, adc, sec, sub, eta );
226 assert( sec >= 0 && sec < 12 );
227 assert( sub >= 0 && sub < 5 );
228 assert( eta >= 0 && eta < 12 );
235 for ( Int_t ihit = 0; ihit < emc -> getNEndcapPrsHits(); ihit++ ) {
237 Int_t adc, sec, sub, eta, det;
238 StMuEmcHit *
hit = emc -> getEndcapPrsHit(ihit, sec, sub, eta, det);
239 adc = hit -> getAdc();
245 assert( sec >= 0 && sec < 12 );
246 assert( sub >= 0 && sub < 5 );
247 assert( eta >= 0 && eta < 12 );
248 assert( det >= 1 && det < 4 );
255 Char_t cpl[] = {
'U',
'V' };
256 for ( Int_t plane = 0; plane < 2; plane++ )
257 for ( Int_t ihit = 0; ihit < emc -> getNEndcapSmdHits(cpl[plane]); ihit++ ) {
259 Int_t sec,
strip, adc;
260 StMuEmcHit *
hit = emc -> getEndcapSmdHit( cpl[plane], ihit, sec, strip );
261 adc = hit -> getAdc();
266 assert( sec >= 0 && sec < 12 );
267 assert( strip >= 0 && strip < 288 );
277 Bool_t StEEmcA2EMaker::readEzt()
286 assert(sec>=0 && sec<12);
287 assert(sub>=0 && sub<5);
288 assert(eta>=0 && eta<12);
289 assert(layer>=0 && layer < 4);
291 Int_t
index=60*sec+12*sub+eta;
292 assert(0<=index && index<720);
294 static Char_t subsectors[] = {
'A',
'B',
'C',
'D',
'E' };
295 static Char_t detectors[] = {
'T',
'P',
'Q',
'R' };
301 const EEmcDbItem *dbitem =
mDbMaker -> getTile( sec+1,subsectors[sub],eta+1, detectors[layer] );
312 if ( dbitem -> fail )
return;
316 Float_t ped = dbitem -> ped;
317 Float_t gain = dbitem -> gain;
321 if ( adc < threshold )
return;
329 if ( gain <= 0. )
return;
331 Float_t
energy = ( adc - ped + 0.5 ) / gain;
337 UInt_t s=(UInt_t)
mTowers[index][layer].sector();
338 UInt_t ss=(UInt_t)
mTowers[index][layer].subsector();
339 UInt_t eb=(UInt_t)
mTowers[index][layer].etabin();
340 TVector3 momentum=
mEEgeom -> getTowerCenter( s,ss,eb );
341 momentum=momentum.Unit();
345 if ( !
mTowers[index][layer].fail() )
363 assert(0<=sec && sec<12);
364 assert(0<=plane && plane<2);
365 assert(0<=strip && strip<288);
368 static Char_t planes[] = {
'U',
'V' };
372 if ( dbitem == 0 )
return;
379 if ( dbitem -> fail )
return;
382 Float_t ped = dbitem -> ped;
383 Float_t gain = dbitem -> gain;
384 Float_t threshold = ped + dbitem -> sigPed * mSigmaPed[4+plane];
387 if ( adc < threshold )
return;
388 mHits[sec][plane+4]++;
395 if ( gain <= 0. )
return;
398 Float_t energy = ( adc - ped + 0.5 ) / gain;
415 for ( Int_t layer = 0; layer < 4; layer++ )
418 for ( Int_t sector=0; sector<12; sector++ )
419 for ( Int_t plane = 0; plane < 2; plane++ )
427 for ( Int_t i = 0; i < 720; i++ )
428 for ( Int_t j = 0; j < 4; j++ )
431 for ( Int_t i = 0; i < 12; i++ )
432 for ( Int_t j = 0; j < 2; j++ )
433 for ( Int_t k = 0; k < 288; k++ ){
438 for ( Int_t i = 0; i < 12; i++ )
439 for ( Int_t j = 0; j < 6; j++ ) {
450 Bool_t StEEmcA2EMaker::readStEvent()
473 Warning(
"fillFromSt",
"\n**********\nemc->detector() NULL for eemc towers. MAJOR PROBLEM, trying to procede.\n**********\n\n");
477 for ( UInt_t sec = 0; sec < detector -> numberOfModules(); sec++ )
484 StSPtrVecEmcRawHit &hits = sector->hits();
487 for ( UInt_t ihit=0; ihit<hits.size(); ihit++ )
494 Int_t isector = hits[ihit]->module() - 1;
495 Int_t isubsector = hits[ihit]->sub() - 1;
496 Int_t ietabin = hits[ihit]->eta() - 1;
497 Int_t adc = hits[ihit]->adc();
498 assert(isector>=0 && isector<12);
499 assert(isubsector>=0 && isubsector<5);
500 assert(ietabin>=0 && ietabin<12);
502 Int_t iphibin = 5 * isector + isubsector;
503 assert(iphibin>=0 && iphibin<60);
504 Int_t index = 12 * iphibin + ietabin;
505 assert(index>=0 && index<720);
508 std::cout <<
"isector=" << isector
509 <<
" isubsector=" << isubsector
510 <<
" ietabin=" << ietabin
511 <<
" " << hits[ihit]->module()
512 <<
" " << hits[ihit]->sub()
513 <<
" " << hits[ihit]->eta()
514 <<
" " << hits[ihit]->adc()
527 addTowerHit(isector,isubsector,ietabin,(Float_t)adc,0);
535 for ( UInt_t ii=0; ii <
mHitTowers.size(); ii++ )
538 std::cout <<
"mHitTowers[0][" << ii <<
"] "
543 <<std::endl <<
" ====> "
556 detector=emc->detector(kEndcapEmcPreShowerId);
560 Warning(
"fillFromSt",
"\n**********\nemc->detector() NULL for eemc pre/post. MAJOR PROBLEM, trying to procede.\n**********\n\n");
563 for ( UInt_t sec = 0; sec < detector -> numberOfModules(); sec++ )
569 StSPtrVecEmcRawHit &hits = sector->hits();
572 for ( UInt_t ihit=0; ihit<hits.size(); ihit++ )
579 Int_t isector = hits[ihit]->module() - 1;
580 Int_t isubsector = (hits[ihit]->sub() - 1) % 5;
581 Int_t ietabin = hits[ihit]->eta() - 1;
582 Int_t adc = hits[ihit]->adc();
584 Int_t ilayer = (hits[ihit]->sub() - 1) / 5 + 1;
585 assert(ilayer >= 1 && ilayer < 4 );
587 Int_t iphibin = 5*isector+isubsector;
588 Int_t index = 12*iphibin + ietabin;
595 addTowerHit( isector, isubsector, ietabin, (Float_t)adc, ilayer );
605 StDetectorId ids[] = { kEndcapSmdUStripId, kEndcapSmdVStripId };
607 for ( Int_t iplane=0; iplane<2; iplane++ )
611 detector=emc->detector( ids[iplane] );
614 Warning(
"fillFromSt",
"\n**********\nemc->detector() NULL for esmd plane. MAJOR PROBLEM, trying to procede.\n**********\n\n");
617 for ( UInt_t sec = 0; sec < detector -> numberOfModules(); sec++ )
623 StSPtrVecEmcRawHit &hits = sector->hits();
626 for ( UInt_t ihit=0; ihit<hits.size(); ihit++ )
628 Int_t isector=hits[ihit]->module()-1;
629 Int_t istrip=hits[ihit]->eta()-1;
630 Int_t adc =hits[ihit]->adc();
631 assert(isector>=0 && isector<12);
632 assert(istrip>=0 && istrip < 288);
637 addSmdHit( isector, iplane, istrip, (Float_t)adc);
655 for ( Int_t sector=0;sector<12;sector++ ) sum+=
energy(sector,layer);
663 Int_t sec=-1,sub=-1,eta=-1;
StEEmcA2EMaker(const Char_t *name="mEEanalysis")
Float_t mEnergy[kEEmcNumSectors][6]
EEmc ADC –> energy maker.
void stat(unsigned s)
Set a status bit for this element.
Bool_t fillFromMuDst(const StMuEmcCollection *emc)
virtual void Clear(Option_t *opts="")
Clears the element.
Float_t addTowerHit(Int_t sec, Int_t sub, Int_t eta, Float_t adc, Int_t layer)
void layer(Int_t l)
Sets the layer, [0-4]=[TPQR].
StEEmcTower * mHighTower[4]
std::vector< StEEmcTowerVec_t > mHitTowers
Float_t addSmdHit(Int_t sec, Int_t plane, Int_t str, Float_t adc)
Int_t mHits[kEEmcNumSectors][6]
Number of hits in layer.
StEEmcStrip mStrips[kEEmcNumSectors][kEEmcNumSmdUVs][kEEmcNumStrips]
Array of 12x2x288 smd strip objects.
void neighbor(StEEmcTower *n)
add a tower to list of neighbors
StEEmcStrip & strip(Int_t sector, Int_t plane, Int_t strip)
virtual void Clear(Option_t *opts="")
Clears the tower.
const EEmcGeomSimple * mEEgeom
Int_t index(Int_t sector, Int_t subsector, Int_t etabin) const
Given tower sector, subsector, etabin, translate into index.
void raw(Float_t r)
Set the raw ADC for this element.
Bool_t fillFromSt(const StEmcCollection *emc)
If StEvent is used, we will fill additional parts of StEEmcElement.
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
void fail(unsigned f)
Set a fail bit for this element.
Int_t phibin(Int_t sector, Int_t subsector) const
Given tower sector, subsector, translate to phibin.
void threshold(Float_t cut, Int_t layer)
const StEEmcDb * mDbMaker
std::vector< std::vector< StEEmcStripVec_t > > mHitStrips
Float_t energy(Int_t sector, Int_t layer) const
void print() const
Print a summary of this tower.
void index(Int_t i)
Sets the index for this SMD strip, 0..287.
Base class for representing tower, preshower and postshower elements.
virtual Int_t Init()
Initialize.
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
Int_t phibin() const
Returns the phibin of this tower.
void adc(Float_t a)
Set the pedestal-subtracted ADC for this element.
virtual void Clear(Option_t *opts="")
Clear the maker for next event.
StEEmcTower & tower(Int_t index, Int_t layer=0)
void stemc(StEmcRawHit *h)
Sets pointer to the StEmcRawHit when processing an StEvent file.
StEEmcTower mTowers[kEEmcNumSectors *kEEmcNumSubSectors *kEEmcNumEtas][4]
Array of 720 x 4 tower objects.
void plane(Int_t p)
Sets the plane for this SMD strip, 0=U, 1=V.
bool getTower(const TVector3 &r, int &sec, int &sub, int &etabin, Float_t &dphi, Float_t &deta) const
void sector(Int_t s)
Sets the sector for this SMD strip.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
virtual Int_t Make()
Read and process one event.