22//
33// $Id: StEEmcSlowMaker.cxx,v 2.11 2010/09/07 22:24:52 stevens4 Exp $
44
5+ #include " StEEmcSlowMaker.h"
6+ #include " StEEmcFastMaker.h"
7+
58#include < TFile.h>
69#include < TH2.h>
710#include < TRandom.h>
1316#include " StEEmcUtil/database/EEmcDbItem.h"
1417#include " StEEmcUtil/database/StEEmcDb.h"
1518
16- # include " StEEmcFastMaker.h "
17- # include " StEEmcSlowMaker.h "
19+
20+
1821
1922// ________________________________________________
2023StEEmcSlowMaker::StEEmcSlowMaker (const Char_t *name, const Char_t*)
2124: StMaker(name) {
22- mMip2ene = getMipdEdx ()*0.7 ; // This is the SMD thickness of 7 mm
25+ mMip2ene = mipdEdx ()*0.7 ; // This is the SMD thickness of 7 mm
2326 // times the minimum ionizing energy loss of
2427 // 1.998 MeV/cm from the PDG book
2528 mSig1pe = 0.85 ; // from info from S. Vigdor on MAPMT test results
2629 // set different thicknesses for pre and post layers (found in geometry debug by Jason et. al.)
27- mPmip2ene [0 ] = getMipdEdx ()*0.475 ; // The pre-shower tiles are only 4.75 mm thick.
28- mPmip2ene [1 ] = getMipdEdx ()*0.475 ; // The pre-shower tiles are only 4.75 mm thick.
29- mPmip2ene [2 ] = getMipdEdx ()*0.5 ; // The post-shower tiles are only 5 mm thick.
30+ mPmip2ene [0 ] = mipdEdx ()*0.475 ; // The pre-shower tiles are only 4.75 mm thick.
31+ mPmip2ene [1 ] = mipdEdx ()*0.475 ; // The pre-shower tiles are only 4.75 mm thick.
32+ mPmip2ene [2 ] = mipdEdx ()*0.5 ; // The post-shower tiles are only 5 mm thick.
3033 mPmip2pe = 2.6 *1.5 ; // 2.6 mip/tower scint * 1.5 light yield
3134 // in pre- and post-shower elements
3235 // loop to init mMip2pe[] - this will eventually need to be
@@ -37,7 +40,7 @@ StEEmcSlowMaker::StEEmcSlowMaker(const Char_t *name, const Char_t*)
3740 mMip2pe [i] = avgNumPePerMip (i);
3841 }
3942
40- mEeDb =0 ;
43+ mEeDb =nullptr ;
4144 mNInpEve =0 ;
4245 memset (mHist ,0 ,sizeof (mHist ));
4346
@@ -57,7 +60,7 @@ StEEmcSlowMaker::StEEmcSlowMaker(const Char_t *name, const Char_t*)
5760
5861 mIsEmbeddingMode = false ;
5962 // / By default, source is MuDst
60- mSource = kMuDst ;
63+ mSource = StSource:: kMuDst ;
6164
6265 // / By default, truncate ped smearing at 3 sigma
6366 mTruncatePedSmear = 3 ;
@@ -168,7 +171,9 @@ Int_t StEEmcSlowMaker::Init() {
168171 setOverwrite (1 ); // overwrite ADC values
169172 setSource (" StEvent" );
170173 } else { // set defaults for running in analysis chain
171- if (mSource == kMuDst ) disableTower (); // don't change tower in analysis chain since only ADC is stored in MuDst
174+ if (mSource == StSource::kMuDst ) {
175+ disableTower (); // don't change tower in analysis chain since only ADC is stored in MuDst
176+ }
172177 }
173178
174179 // print out full configuration in log file
@@ -227,7 +232,7 @@ void StEEmcSlowMaker::InitHisto() {
227232 mHist [19 ]=new TH2F (tt1,tt2,60 ,0 ,300 ,100 ,0 ,200 .);
228233
229234 // add histos to the list (if provided)
230- for (Int_t i = 0 ; i < maxHist ; ++i) {
235+ for (Int_t i = 0 ; i < MAX_HIST ; ++i) {
231236 if (mHist [i]) this ->AddHist (mHist [i]);
232237 }
233238}
@@ -239,7 +244,7 @@ Int_t StEEmcSlowMaker::Make() {
239244 LOG_DEBUG << " iEve " << mNInpEve << " , mSource = " << mSource << endm;
240245
241246 switch (mSource ) {
242- case kMuDst :
247+ case StSource:: kMuDst :
243248 // / Access to muDst .......................
244249 {
245250 if (!GetInputDS (" MuDst" )) {
@@ -264,14 +269,14 @@ Int_t StEEmcSlowMaker::Make() {
264269 }
265270 break ;
266271
267- case kStEvent :
272+ case StSource:: kStEvent :
268273 // / Acces to StEvent, automatic detection if in Embedding or BFC mode .....................
269274 {
270275
271- StEmcCollection *emc =0 ;
276+ StEmcCollection *emc = nullptr ;
272277 if (mIsEmbeddingMode ) {
273278 StEEmcFastMaker *fast = (StEEmcFastMaker*)GetMakerInheritsFrom (" StEEmcFastMaker" );
274- if (fast==0 ) {
279+ if (fast==nullptr ) {
275280 LOG_WARN << GetName () << " ::Make() no EEmcFastSim in the chain, ignore Endcap" << endm;
276281 return kStWarn ;
277282 }
@@ -348,7 +353,7 @@ Int_t StEEmcSlowMaker::MakeTower(StMuEmcCollection *emc) {
348353 Int_t sec,sub,eta,pre ;
349354 StMuEmcHit *hit=emc->getEndcapPrsHit (i,sec,sub,eta,pre );
350355 // range check on returned values
351- if (!( sec >= 1 && sec <= 12 ) || !(sub >= 1 && sub <= 5 ) || !(eta >= 1 && eta <= 12 ) || !(pre >= 1 && pre <= 3 )) {
356+ if (!( sec >= 1 && sec <= 12 ) || !(sub >= 1 && sub <= 5 ) || !(eta >= 1 && eta <= 12 ) || !(pre >= 1 && pre <= kNumberOfPrepostLayers )) {
352357 LOG_ERROR << " Indexing errors detected: EPRS hit " << i << " , sec = " << sec << " , sub = " << sub << " , eta = " << eta << " , pre = " << pre << endm;
353358 setZeroAdc (emc);
354359 return kStErr ;
@@ -363,7 +368,7 @@ Int_t StEEmcSlowMaker::MakeTower(StMuEmcCollection *emc) {
363368 // difference in thickness between pre/post and normal
364369 // layers, the factor of 0.8 is introduced to prevent us
365370 // from double correcting.
366- const EEmcDbItem *tower = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, ' T' ) : 0 ;
371+ const EEmcDbItem *tower = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, ' T' ) : nullptr ;
367372 if (!tower) {
368373 LOG_ERROR << " Cannot find DB entry for ETOW: sec = " << sec << " , sub = " << sub << " , eta = " << eta << endm;
369374 continue ;
@@ -449,20 +454,24 @@ Int_t StEEmcSlowMaker::MakePrePost(StMuEmcCollection *emc) {
449454 Int_t pre ,sec,eta,sub;
450455 // / muDst ranges: sec:1-12, sub:1-5, eta:1-12 ,pre:1-3==>pre1/pre2/post
451456 StMuEmcHit *hit = emc->getEndcapPrsHit (i,sec,sub,eta,pre );
452- if (!hit) continue ;
457+ if (!hit) {
458+ continue ;
459+ }
453460
454461 // range check on returned values
455- if (!( sec >= 1 && sec <= 12 ) || !(sub >= 1 && sub <= 5 ) || !(eta >= 1 && eta <= 12 ) || !(pre >= 1 && pre <= 3 )) {
462+ if (!( sec >= 1 && sec <= 12 ) || !(sub >= 1 && sub <= 5 ) || !(eta >= 1 && eta <= 12 ) || !(pre >= 1 && pre <= kNumberOfPrepostLayers )) {
456463 LOG_ERROR << " Indexing errors detected: EPRS hit " << i << " , sec = " << sec << " , sub = " << sub << " , eta = " << eta << " , pre = " << pre << endm;
457464 setZeroAdc (emc);
458465 return kStErr ;
459466 }
460467
461468 // / tmp, for fasted analysis use only hits from sectors init in DB
462- if (mEeDb && (sec < mEeDb ->getFirstSector () || sec > mEeDb ->getLastSector ())) continue ;
469+ if (mEeDb && (sec < mEeDb ->getFirstSector () || sec > mEeDb ->getLastSector ())) {
470+ continue ;
471+ }
463472
464473 // / Db ranges: sec=1-12,sub=A-E,eta=1-12,type=T,P-R ; slow method
465- const EEmcDbItem *x = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, pre -1 +' P' ) : 0 ;
474+ const EEmcDbItem *x = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, pre -1 +' P' ) : nullptr ;
466475 if (!x) {
467476 LOG_ERROR << " Cannot find DB entry for EPRS: sec = " << sec << " , sub = " << sub << " , eta = " << eta << " , pre = " << pre << endm;
468477 continue ;
@@ -513,7 +522,9 @@ Int_t StEEmcSlowMaker::MakePrePost(StMuEmcCollection *emc) {
513522 // /
514523 // / If we've made it here, overwrite the muDst
515524 // /
516- if (mOverwrite ) hit->setAdc (NUadc);
525+ if (mOverwrite ) {
526+ hit->setAdc (NUadc);
527+ }
517528 }
518529 return kStOk ;
519530}
@@ -534,8 +545,10 @@ Int_t StEEmcSlowMaker::MakeSMD(StMuEmcCollection *emc) {
534545 }
535546
536547 // tmp, for fasted analysis use only hits from sectors init in DB
537- if (mEeDb && (sec < mEeDb ->getFirstSector () || sec > mEeDb ->getLastSector ())) continue ;
538- const EEmcDbItem *x = mEeDb ? mEeDb ->getByStrip (sec,uv,strip) : 0 ;
548+ if (mEeDb && (sec < mEeDb ->getFirstSector () || sec > mEeDb ->getLastSector ())) {
549+ continue ;
550+ }
551+ const EEmcDbItem *x = mEeDb ? mEeDb ->getByStrip (sec,uv,strip) : nullptr ;
539552 if (!x) {
540553 LOG_ERROR << " Cannot find DB entry for ESMD: sec = " << sec << " , uv = " << uv << " , strip = " << strip << endm;
541554 continue ;
@@ -591,7 +604,9 @@ Int_t StEEmcSlowMaker::MakeSMD(StMuEmcCollection *emc) {
591604 // /
592605 // / If we've made it here, overwrite the muDst
593606 // /
594- if (mOverwrite ) hit->setAdc (NUadc);
607+ if (mOverwrite ) {
608+ hit->setAdc (NUadc);
609+ }
595610 }// loop over 1 plane
596611 } // loop over U,V
597612 return kStOk ;
@@ -600,9 +615,9 @@ Int_t StEEmcSlowMaker::MakeSMD(StMuEmcCollection *emc) {
600615// ________________________________________________
601616void StEEmcSlowMaker::setSource (const Char_t* name) {
602617 if (strcmp (name, " MuDst" ) == 0 ) {
603- mSource = kMuDst ;
618+ mSource = StSource:: kMuDst ;
604619 } else if (strcmp (name, " StEvent" ) == 0 ) {
605- mSource = kStEvent ;
620+ mSource = StSource:: kStEvent ;
606621 } else {
607622 LOG_WARN<<" ::setSource()" <<" Source must be \" MuDst\" or \" StEvent\" " <<endm;
608623 }
@@ -633,7 +648,7 @@ Int_t StEEmcSlowMaker::MakeTower(StEmcCollection* emc) {
633648 const UInt_t eta = hit->eta ();
634649 const UInt_t pre = (hit->sub ()-1 )/5 +1 ;
635650 // range check on returned values
636- if (!(sec >= 1 && sec <= 12 ) || !(sub >= 1 && sub <= 5 ) || !(eta >= 1 && eta <= 12 ) || !(pre >= 1 && pre <= 3 )) {
651+ if (!(sec >= 1 && sec <= 12 ) || !(sub >= 1 && sub <= 5 ) || !(eta >= 1 && eta <= 12 ) || !(pre >= 1 && pre <= kNumberOfPrepostLayers )) {
637652 LOG_ERROR << " Indexing errors detected for EPRS: sec = " << sec << " , sub = " << sub << " , eta = " << eta << " , pre = " << pre << endm;
638653 setZeroAdc (emc);
639654 return kStErr ;
@@ -647,7 +662,7 @@ Int_t StEEmcSlowMaker::MakeTower(StEmcCollection* emc) {
647662 // difference in thickness between pre/post and normal
648663 // layers, the factor of 0.8 is introduced to prevent us
649664 // from double correcting.
650- const EEmcDbItem *tower = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, ' T' ) : 0 ;
665+ const EEmcDbItem *tower = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, ' T' ) : nullptr ;
651666 if (!tower) {
652667 LOG_ERROR << " Cannot find DB entry for ETOW: sec = " << sec << " , sub = " << sub << " , eta = " << eta << endm;
653668 continue ;
@@ -670,7 +685,7 @@ Int_t StEEmcSlowMaker::MakeTower(StEmcCollection* emc) {
670685 }
671686
672687 // get DB entry for this tower
673- const EEmcDbItem *tower = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, ' T' ) : 0 ;
688+ const EEmcDbItem *tower = mEeDb ? mEeDb ->getTile (sec,sub-1 +' A' , eta, ' T' ) : nullptr ;
674689 if (!tower) {
675690 LOG_ERROR << " Cannot find DB entry for ETOW: sec = " << sec << " , sub = " << sub << " , eta = " << eta << endm;
676691 continue ;
@@ -739,14 +754,14 @@ Int_t StEEmcSlowMaker::MakePrePost(StEmcCollection* emc) {
739754 const UInt_t ieta = hit->eta ();
740755 const UInt_t ipre = (hit->sub ()-1 )/5 +1 ;
741756 // range check on returned values
742- if (!(sector >= 1 && sector <= 12 ) || !(isub >= 1 && isub <= 5 ) || !(ieta >= 1 && ieta <= 12 ) || !(ipre >= 1 && ipre <= 3 )) {
757+ if (!(sector >= 1 && sector <= 12 ) || !(isub >= 1 && isub <= 5 ) || !(ieta >= 1 && ieta <= 12 ) || !(ipre >= 1 && ipre <= kNumberOfPrepostLayers )) {
743758 LOG_ERROR << " Indexing errors detected for EPRS: sec = " << sector << " , sub = " << isub << " , eta = " << ieta << " , pre = " << ipre << endm;
744759 setZeroAdc (emc);
745760 return kStErr ;
746761 }
747762
748763 // Database ranges: sector=1-12, sub=A-E, eta=1-12, type=T,P-R; Slow method
749- const EEmcDbItem* x = mEeDb ? mEeDb ->getTile (sector, sub, hit->eta (), layer) : 0 ;
764+ const EEmcDbItem* x = mEeDb ? mEeDb ->getTile (sector, sub, hit->eta (), layer) : nullptr ;
750765 if (!x) {
751766 LOG_ERROR << " Cannot find DB entry for EPRS: sec = " << sector << " , sub = " << sub << " , eta = " << hit->eta () << " , pre = " << layer << endm;
752767 continue ;
@@ -797,7 +812,9 @@ Int_t StEEmcSlowMaker::MakePrePost(StEmcCollection* emc) {
797812 // /
798813 // / If we've made it here, overwrite the muDst
799814 // /
800- if (mOverwrite ) hit->setAdc (NUadc);
815+ if (mOverwrite ) {
816+ hit->setAdc (NUadc);
817+ }
801818 }
802819 }
803820 return kStOk ;
@@ -808,7 +825,7 @@ Int_t StEEmcSlowMaker::MakeSMD(StEmcCollection* emc) {
808825 Int_t iuv = 0 ;
809826 for (Char_t plane = ' U' ; plane <= ' V' ; ++plane) {
810827 iuv++;
811- StEmcDetector* det = 0 ;
828+ StEmcDetector* det = nullptr ;
812829 switch (plane) {
813830 case ' U' :
814831 det = emc->detector (kEndcapSmdUStripId );
@@ -826,7 +843,9 @@ Int_t StEEmcSlowMaker::MakeSMD(StEmcCollection* emc) {
826843 break ;
827844 }
828845
829- if (!det) continue ;
846+ if (!det) {
847+ continue ;
848+ }
830849
831850 for (UInt_t sector = 1 ; sector <= det->numberOfModules ();++sector) {
832851 StSPtrVecEmcRawHit& hits = det->module (sector)->hits ();
@@ -842,7 +861,7 @@ Int_t StEEmcSlowMaker::MakeSMD(StEmcCollection* emc) {
842861 }
843862
844863 // Database ranges: sector=1-12, plane=U-V, strip=1-288
845- const EEmcDbItem* x = mEeDb ? mEeDb ->getByStrip (sector, plane, strip) : 0 ;
864+ const EEmcDbItem* x = mEeDb ? mEeDb ->getByStrip (sector, plane, strip) : nullptr ;
846865 if (!x) {
847866 LOG_ERROR << " Cannot find DB entry for ESMD: sec = " << sector << " , uv = " << iuv-1 +' U' << " , strip = " << strip << endm;
848867 continue ;
@@ -892,7 +911,9 @@ Int_t StEEmcSlowMaker::MakeSMD(StEmcCollection* emc) {
892911 // /
893912 // / If we've made it here, overwrite the muDst
894913 // /
895- if (mOverwrite ) hit->setAdc (NUadc);
914+ if (mOverwrite ) {
915+ hit->setAdc (NUadc);
916+ }
896917 } // Loop over 1 plane
897918 }
898919 }
@@ -959,11 +980,13 @@ Float_t StEEmcSlowMaker::getPedSmear(Float_t sigPed) {
959980// ________________________________________________
960981void StEEmcSlowMaker::setZeroAdc (StEmcCollection* emc) {
961982 StDetectorId detId[4 ]={kEndcapEmcTowerId ,kEndcapEmcPreShowerId ,kEndcapSmdUStripId ,kEndcapSmdVStripId };
962- StEmcDetector *det=0 ;
983+ StEmcDetector *det=nullptr ;
963984
964985 for (int i=0 ; i<4 ; i++) {
965986 det = emc->detector (detId[i]);
966- if (!det) continue ;
987+ if (!det) {
988+ continue ;
989+ }
967990 for (UInt_t sec = 1 ;sec <= det->numberOfModules ();sec++) {
968991 StSPtrVecEmcRawHit &det_hits = det->module (sec)->hits ();
969992 for (UInt_t ihit = 0 ;ihit < det_hits.size ();ihit++) {
@@ -996,7 +1019,7 @@ void StEEmcSlowMaker::setZeroAdc(StMuEmcCollection *emc) {
9961019}
9971020
9981021// ________________________________________________
999- Float_t StEEmcSlowMaker::getMipdEdx () {
1022+ Float_t StEEmcSlowMaker::mipdEdx () {
10001023 // Return MIP dE/dx = 1.998 MeV/cm from the PDG book
10011024 // used to simulate SMD, Pre, Post ADC response
10021025 return 0.001998 ;
0 commit comments