10 #include "StEventTypes.h"
11 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
13 #include "StEEmcUtil/database/EEmcDbItem.h"
14 #include "StEEmcUtil/database/StEEmcDb.h"
16 #include "StEEmcFastMaker.h"
17 #include "StEEmcSlowMaker.h"
24 mMip2ene = getMipdEdx()*0.7;
29 mPmip2ene[0] = getMipdEdx()*0.475;
30 mPmip2ene[1] = getMipdEdx()*0.475;
31 mPmip2ene[2] = getMipdEdx()*0.5;
36 for (Int_t i = 0;i < MaxSmdStrips;i++) {
39 mMip2pe[i] = avgNumPePerMip(i);
44 memset(mHist,0,
sizeof(mHist));
60 mIsEmbeddingMode =
false;
65 mTruncatePedSmear = 3;
69 setDoLightYield(
true);
77 setRelativeLightYield( (4.0/4.75) * 1.68, (4.0/4.75) * 1.68, (4.0/5.0)* 0.94);
80 mSamplingFraction = StEEmcFastMaker::getSamplingFraction();
81 mSamplingFractionUser = mSamplingFraction;
84 for (Int_t i = 0;i < kEEmcNumEtas;i++) {
85 mTowerGains[i] = StEEmcFastMaker::getTowerGains()[i] * mSamplingFraction;
89 mMaxAdc = StEEmcFastMaker::getMaxAdc();
91 if ( (mPrepostGains-23000.0)>1. ||
92 (mSmdGains-23000.0)>1. ||
93 (mTowerGains[0]-18.9654)>0.01 )
95 LOG_WARN <<
"--------------------------------------------" << endm;
96 LOG_WARN <<
"You changed the gains in the fast simulator." << endm;
97 LOG_WARN <<
"You are on your own." << endm;
98 LOG_WARN <<
" -- the eemc software team" << endm;
100 LOG_WARN <<
"mSmdGains=" << mSmdGains << endm;
101 LOG_WARN <<
"mPrepostGains="<<mPrepostGains<<endm;
102 for ( Int_t ii=0;ii<12;ii++ )
103 LOG_WARN <<
"mTowerGains[etabin="<<ii<<
"]="<<mTowerGains[ii]<<endm;
108 for (Int_t sec = 0;sec < kEEmcNumSectors;sec++) {
109 for (Int_t sub = 0;sub < kEEmcNumSubSectors;sub++) {
110 for (Int_t eta = 0;eta < kEEmcNumEtas;eta++) {
111 mTowerGainFact[sec][sub][eta] = 1.0;
117 for (Int_t sec = 0;sec < kEEmcNumSectors;sec++) {
118 for (Int_t uv = 0;uv < kEEmcNumSmdUVs;uv++) {
119 for (Int_t strip = 0;strip < kEEmcNumStrips;strip++) {
120 mSmdGainFact[sec][uv][strip] = 1.0;
126 mIsBFC = GetParentChain()->InheritsFrom(
"StBFChain");
134 Float_t StEEmcSlowMaker::avgNumPePerMip(Int_t stripID) {
139 Float_t ya=0,yb=0,xa=1,xb=2;
142 }
else if (stripID<20) {
145 }
else if (stripID<250) {
152 const Float_t y = ya + (yb - ya) / (xb - xa) * (stripID - xa);
158 LOG_INFO <<
"mIsEmbeddingMode=" << mIsEmbeddingMode <<
", mIsBFC=" << mIsBFC << endm;
160 if (mIsEmbeddingMode) {
177 LOG_INFO <<
"mAddPed=" << mAddPed <<
", mSmearPed=" << mSmearPed <<
", mDropBad=" << mDropBad <<
", mOverwrite=" << mOverwrite
178 <<
", mEnableTower=" << mEnableTower <<
", mEnableSMD=" << mEnableSMD <<
", mEnablePrePost=" << mEnablePrePost << endm;
180 mEeDb = (
StEEmcDb*)GetDataSet(
"StEEmcDb");
182 LOG_ERROR <<
"Cannot find EEMC database StEEmcDb" << endm;
185 if ( mSmearPed && !mAddPed) {
186 LOG_WARN <<
"detected mSmearPed=true && mAddPed=false\nwill not work due to ETOW hits storage container in muDst not accepting negative ADC values." << endm;
190 LOG_INFO <<
"detected mSmearPed, (be sure peds>N*sig are loaded in DB!), muDst can't store negative ADC for towers, the NUadc will be forced to be non-negative" << endm;
192 return StMaker::Init();
196 void StEEmcSlowMaker::InitHisto() {
197 Char_t tt1[100], tt2[500];
200 sprintf(tt2,
"freq vs. sector ID; sector ID");
201 mHist[12]=
new TH1F(tt1,tt2,20,-0.5,19.5);
203 sprintf(tt1,
"PreADC");
204 sprintf(tt2,
"Revised ADC for Pre/Post Scint.");
205 mHist[0]=
new TH1F(tt1,tt2,100,0,200.);
207 sprintf(tt1,
"Pre2ADC");
208 sprintf(tt2,
"Initial ADC for Pre/Post Scint.");
209 mHist[1]=
new TH1F(tt1,tt2,100,0,200.);
211 sprintf(tt1,
"SMDADC");
212 sprintf(tt2,
"Revised ADC for SMD Strips");
213 mHist[2]=
new TH1F(tt1,tt2,100,0,200.);
215 sprintf(tt1,
"SMD2ADC");
216 sprintf(tt2,
"Initial ADC for SMD Strips");
217 mHist[3]=
new TH1F(tt1,tt2,100,0,200.);
219 mHist[4]=
new TH1F(
"hADCtow",
"Initial ADC for towers",512+32,-32.,512.);
220 mHist[5]=
new TH1F(
"hADCtow2",
"Finial ADC fot towers",512+32,-32.,512.);
224 sprintf(tt2,
" Adc vs strip ID; strip ID; ADC ");
225 mHist[20]=
new TH2F(tt1,tt2,30,0,300,100,0,200.);
227 sprintf(tt1,
"ADCvsstr");
228 sprintf(tt2,
" Adc vs, strip ID; strip ID; ADC ");
229 mHist[19]=
new TH2F(tt1,tt2,60,0,300,100,0,200.);
232 for (Int_t i = 0; i < maxHist; ++i) {
233 if (mHist[i]) this->AddHist(mHist[i]);
241 LOG_DEBUG <<
"iEve " << mNInpEve <<
", mSource = " << mSource << endm;
247 if (!GetInputDS(
"MuDst")) {
248 LOG_DEBUG<<
"::Make() MuDst missing"<<endm;
254 LOG_DEBUG<<
"::Make() StMuEmcCollection missing"<<endm;
259 if (mEnableTower && (result ==
kStOk)) result = MakeTower(emc);
262 if (mEnablePrePost && (result ==
kStOk)) result = MakePrePost(emc);
265 if (mEnableSMD && (result ==
kStOk)) result = MakeSMD(emc);
274 if(mIsEmbeddingMode) {
277 LOG_WARN <<
GetName() <<
"::Make() no EEmcFastSim in the chain, ignore Endcap"<< endm;
280 emc = fast->GetLocalEmcCollection();
285 LOG_WARN <<
GetName() <<
"::Make() no StEvent"<< endm;
288 emc =
event->emcCollection();
293 LOG_WARN <<
GetName() <<
"::Make() no emcCollection()" << endm;
298 if (mEnableTower && (result ==
kStOk)) result = MakeTower(emc);
301 if (mEnablePrePost && (result ==
kStOk)) result = MakePrePost(emc);
304 if (mEnableSMD && (result ==
kStOk)) result = MakeSMD(emc);
309 LOG_ERROR<<
"Unknown source type " << mSource <<
" for this event" << endm;
342 Float_t prepost_adc[kEEmcNumSectors][kEEmcNumSubSectors][kEEmcNumEtas];
343 memset( prepost_adc, 0,
sizeof(prepost_adc) );
348 if (mDoLightYield)
for (Int_t i = 0;i < emc->getNEndcapPrsHits();i++) {
350 Int_t sec,sub,eta,pre;
353 if (!( sec >= 1 && sec <= 12) || !(sub >= 1 && sub <= 5) || !(eta >= 1 && eta <= 12) || !(pre >= 1 && pre <= 3)) {
354 LOG_ERROR <<
"Indexing errors detected: EPRS hit " << i <<
", sec = " << sec <<
", sub = " << sub <<
", eta = " << eta <<
", pre = " << pre << endm;
360 const Float_t edeposit = hit ? hit->
getEnergy() : 0;
368 const EEmcDbItem *tower = mEeDb ? mEeDb->getTile(sec,sub-1+
'A', eta,
'T') : 0;
370 LOG_ERROR <<
"Cannot find DB entry for ETOW: sec = " << sec <<
", sub = " << sub <<
", eta = " << eta << endm;
373 Float_t myadc = edeposit / mSamplingFractionUser * tower->gain;
374 myadc *= ( mRelativeLightYield[pre-1] - 1.0 );
376 prepost_adc[sec-1][sub-1][eta-1] += myadc;
382 for (Int_t i = 0;i < emc->getNEndcapTowerADC();i++) {
383 Int_t sec,sub,eta,adc;
385 emc->getEndcapTowerADC(i,adc,sec,sub,eta);
387 if (!(sec >= 1 && sec <= 12) || !(sub >= 1 && sub <= 5) || !(eta >= 1 && eta <= 12)) {
388 LOG_ERROR <<
"Indexing errors detected: ETOW hit " << i <<
", sec = " << sec <<
", sub = " << sub <<
", eta = " << eta << endm;
393 const Int_t old = adc;
394 if (mHist[4]) mHist[4]->Fill( old );
397 const EEmcDbItem *tower = mEeDb ? mEeDb->getTile(sec,sub-1+
'A', eta,
'T') : 0;
399 LOG_ERROR <<
"Cannot find DB entry for ETOW: sec = " << sec <<
", sub = " << sub <<
", eta = " << eta << endm;
403 if (mDropBad && (tower->fail || !checkDBped(tower))) {
408 Float_t myadc=(Float_t)adc + 0.5;
411 myadc *= tower->gain / mTowerGains[eta-1] * mSamplingFraction / mSamplingFractionUser;
413 myadc += prepost_adc[sec-1][sub-1][eta-1];
415 myadc *= ( mTowerGainFact[sec-1][sub-1][eta-1] );
416 Float_t ped = tower->ped;
419 if ( mSmearPed ) ped += getPedSmear( tower->sigPed );
424 if (mHist[5]) mHist[5]->Fill(adc);
425 if (mDropBad && (tower->gain <= 0) && mAddPed) {
430 if (adc < 0) adc = 0;
431 if (adc > mMaxAdc) adc = mMaxAdc;
435 LOG_DEBUG <<
"overwriting tower=" << tower->
name <<
" old adc=" << old <<
" new adc=" << adc << endm;
442 emc->setTowerADC( i+1, adc, eemc );
450 for (Int_t i = 0;i < emc->getNEndcapPrsHits();i++) {
451 Int_t pre,sec,eta,sub;
453 StMuEmcHit *hit = emc->getEndcapPrsHit(i,sec,sub,eta,pre);
457 if (!( sec >= 1 && sec <= 12) || !(sub >= 1 && sub <= 5) || !(eta >= 1 && eta <= 12) || !(pre >= 1 && pre <= 3)) {
458 LOG_ERROR <<
"Indexing errors detected: EPRS hit " << i <<
", sec = " << sec <<
", sub = " << sub <<
", eta = " << eta <<
", pre = " << pre << endm;
464 if (mEeDb && (sec < mEeDb->getFirstSector() || sec > mEeDb->getLastSector()))
continue;
467 const EEmcDbItem *x = mEeDb ? mEeDb->getTile(sec,sub-1+
'A', eta, pre-1+
'P') : 0;
469 LOG_ERROR <<
"Cannot find DB entry for EPRS: sec = " << sec <<
", sub = " << sub <<
", eta = " << eta <<
", pre = " << pre << endm;
475 if (mDropBad && (x->fail || !checkDBped(x) || (x->gain <= 0))) {
478 const Float_t adc = hit->
getAdc();
481 Float_t newadc = energy * x->gain;
483 if (mHist[1]) mHist[1]->Fill(adc);
487 const Float_t mipval = energy / mPmip2ene[pre-1];
488 const Float_t avgpe = mipval * mPmip2pe;
489 const Float_t Npe = gRandom->Poisson(avgpe);
493 const Float_t sigmape = sqrt(Npe) * mSig1pe;
494 Float_t smearedpe = gRandom->Gaus(Npe,sigmape);
495 if (smearedpe < 0) smearedpe = 0;
497 newadc = smearedpe * mMip2ene*(x->gain) / mPmip2pe;
502 Float_t ped = (mAddPed) ? x->ped : 0;
504 if ( mSmearPed ) ped += getPedSmear( x->sigPed );
507 NUadc = (Int_t)(newadc + 0.5 + ped );
510 if (NUadc < 0) NUadc = 0;
511 if (NUadc > mMaxAdc) NUadc = mMaxAdc;
512 if (adc > 0 && mHist[0]) mHist[0]->Fill(NUadc);
518 if (mOverwrite) hit->setAdc(NUadc);
526 for (Char_t uv =
'U';uv <=
'V';uv++) {
529 for (Int_t i = 0;i < emc->getNEndcapSmdHits(uv);i++) {
530 StMuEmcHit *hit=emc->getEndcapSmdHit(uv,i,sec,strip);
532 if (!(strip-1 >= 0) || !(strip <= 288) || !(iuv-1 >= 0 && iuv-1 < 2) || !(sec > 0 && sec <= MaxSectors)) {
533 LOG_ERROR <<
"Bad index for ESMD: sec = " << sec <<
", iuv = " << iuv <<
", strip = " << strip << endm;
539 if (mEeDb && (sec < mEeDb->getFirstSector() || sec > mEeDb->getLastSector()))
continue;
540 const EEmcDbItem *x = mEeDb ? mEeDb->getByStrip(sec,uv,strip) : 0;
542 LOG_ERROR <<
"Cannot find DB entry for ESMD: sec = " << sec <<
", uv = " << uv <<
", strip = " << strip << endm;
548 if (mDropBad && (x->fail || !checkDBped(x) || (x->gain <= 0))) {
551 const Float_t adc = hit->
getAdc();
553 Float_t newadc = energy * x->gain;
556 if (mHist[12]) mHist[12]->Fill(x->sec);
557 if (mHist[20]) mHist[20]->Fill(x->strip,adc);
558 if (mHist[3]) mHist[3]->Fill(adc);
562 const Float_t mipval = energy / mMip2ene;
563 const Float_t avgpe = mipval * mMip2pe[strip];
564 const Float_t Npe = gRandom->Poisson(avgpe);
567 const Float_t sigmape = sqrt(Npe) * mSig1pe;
568 Float_t smearedpe = gRandom->Gaus(Npe, sigmape);
569 if (smearedpe < 0) smearedpe = 0;
571 newadc = smearedpe * mMip2ene * (x->gain) / mMip2pe[strip];
576 newadc *= mSmdGainFact[sec-1][iuv-1][strip-1];
579 Float_t ped = (mAddPed) ? x->ped : 0;
581 if ( mSmearPed ) ped += getPedSmear( x->sigPed );
584 NUadc = (Int_t)(newadc + 0.5 + ped );
587 if (NUadc < 0) NUadc = 0;
588 if (NUadc > mMaxAdc) NUadc = mMaxAdc;
589 if (adc > 0 && mHist[19]) mHist[19]->Fill(x->strip,NUadc);
590 if (adc > 0 && mHist[2]) mHist[2]->Fill(NUadc);
596 if (mOverwrite) hit->setAdc(NUadc);
604 if (strcmp(name,
"MuDst") == 0) {
606 }
else if (strcmp(name,
"StEvent") == 0) {
609 LOG_WARN<<
"::setSource()"<<
"Source must be \"MuDst\" or \"StEvent\""<<endm;
617 LOG_DEBUG<<
"No kEndcapEmcTowerId"<<endm;
620 StEmcDetector *prepost = emc->detector(kEndcapEmcPreShowerId);
622 LOG_WARN<<
"No kEndcapEmcPreShowerId, towers are fast simu only."<<endm;
627 Float_t prepost_adc[kEEmcNumSectors][kEEmcNumSubSectors][kEEmcNumEtas];
628 memset( prepost_adc, 0,
sizeof(prepost_adc) );
630 for (UInt_t sec = 1;sec <= det->numberOfModules();sec++) {
631 StSPtrVecEmcRawHit &prepost_hits = prepost->module(sec)->hits();
632 if (mDoLightYield)
for (UInt_t ihit = 0;ihit < prepost_hits.size();ihit++) {
634 const UInt_t sub = (hit->sub()-1)%5+1;
635 const UInt_t eta = hit->eta();
636 const UInt_t pre = (hit->sub()-1)/5+1;
638 if (!(sec >= 1 && sec <= 12) || !(sub >= 1 && sub <= 5) || !(eta >= 1 && eta <= 12) || !(pre >= 1 && pre <= 3)) {
639 LOG_ERROR <<
"Indexing errors detected for EPRS: sec = " << sec <<
", sub = " << sub <<
", eta = " << eta <<
", pre = " << pre << endm;
645 const Float_t edeposit = hit->energy();
652 const EEmcDbItem *tower = mEeDb ? mEeDb->getTile(sec,sub-1+
'A', eta,
'T') : 0;
654 LOG_ERROR <<
"Cannot find DB entry for ETOW: sec = " << sec <<
", sub = " << sub <<
", eta = " << eta << endm;
657 Float_t myadc = edeposit / mSamplingFraction * tower->gain;
658 myadc *= ( mRelativeLightYield[pre-1] - 1.0 );
659 prepost_adc[sec-1][sub-1][eta-1] += myadc;
662 StSPtrVecEmcRawHit &tower_hits = det->module(sec)->hits();
663 for (UInt_t ihit = 0;ihit < tower_hits.size();ihit++) {
665 const UInt_t sub = hit->sub();
666 const UInt_t eta = hit->eta();
668 if (!(sec >= 1 && sec <= 12) || !(sub >= 1 && sub <= 5) || !(eta >= 1 && eta <= 12)) {
669 LOG_ERROR <<
"Indexing errors detected for ETOW: sec = " << sec <<
", sub = " << sub <<
", eta = " << eta << endm;
675 const EEmcDbItem *tower = mEeDb ? mEeDb->getTile(sec,sub-1+
'A', eta,
'T') : 0;
677 LOG_ERROR <<
"Cannot find DB entry for ETOW: sec = " << sec <<
", sub = " << sub <<
", eta = " << eta << endm;
681 if (mDropBad && (tower->fail || !checkDBped(tower))) {
685 if (mHist[4]) mHist[4]->Fill( hit->adc() );
687 const Float_t edeposit = hit->energy();
689 Float_t myadc = edeposit / mSamplingFraction * tower->gain;
691 myadc += prepost_adc[sec-1][sub-1][eta-1];
693 myadc *= ( mTowerGainFact[sec-1][sub-1][eta-1] );
695 Float_t ped = tower->ped;
697 if ( mSmearPed ) ped += getPedSmear( tower->sigPed );
702 if (mDropBad && (tower->gain <= 0) && mAddPed) {
707 if (adc < 0) adc = 0;
708 if (adc > mMaxAdc) adc = mMaxAdc;
710 if (mHist[5]) mHist[5]->Fill(adc);
712 if ((Int_t)hit->adc() != adc) nTchange++;
713 LOG_DEBUG <<
"overwriting tower=" << tower->
name <<
" old adc=" << hit->adc() <<
" new adc=" << adc << endm;
717 LOG_DEBUG <<
" Etow changed " << nTchange <<
" ADC values for sector=" << sec << endm;
726 LOG_WARN <<
"No kEndcapEmcPreShowerId" << endm;
730 for (UInt_t sector =1; sector <= det->numberOfModules(); ++sector) {
731 StSPtrVecEmcRawHit& hits = det->module(sector)->hits();
732 for(UInt_t i = 0; i < hits.size(); ++i) {
734 Char_t sub =
'A'+(hit->sub()-1)%5;
737 Char_t layer =
'P'+(hit->sub()-1)/5;
738 Int_t layerP = (hit->sub()-1)/5;
740 const UInt_t isub = (hit->sub()-1)%5+1;
741 const UInt_t ieta = hit->eta();
742 const UInt_t ipre = (hit->sub()-1)/5+1;
744 if (!(sector >= 1 && sector <= 12) || !(isub >= 1 && isub <= 5) || !(ieta >= 1 && ieta <= 12) || !(ipre >= 1 && ipre <= 3)) {
745 LOG_ERROR <<
"Indexing errors detected for EPRS: sec = " << sector <<
", sub = " << isub <<
", eta = " << ieta <<
", pre = " << ipre << endm;
751 const EEmcDbItem* x = mEeDb ? mEeDb->getTile(sector, sub, hit->eta(), layer) : 0;
753 LOG_ERROR <<
"Cannot find DB entry for EPRS: sec = " << sector <<
", sub = " << sub <<
", eta = " << hit->eta() <<
", pre = " << layer << endm;
759 if (mDropBad && (x->fail || !checkDBped(x) || (x->gain <= 0))) {
762 Float_t adc = hit->adc();
763 Float_t energy = hit->energy();
764 Float_t newadc = energy * x->gain;
766 if (mHist[1]) mHist[1]->Fill(adc);
770 const Float_t mipval = energy / mPmip2ene[layerP];
771 const Float_t avgpe = mipval * mPmip2pe;
772 const Float_t Npe = gRandom->Poisson(avgpe);
776 const Float_t sigmape = sqrt(Npe) * mSig1pe;
777 Float_t smearedpe = gRandom->Gaus(Npe, sigmape);
778 if (smearedpe < 0) smearedpe = 0;
780 newadc = smearedpe * mMip2ene * x->gain / mPmip2pe;
785 Float_t ped = mAddPed ? x->ped : 0;
788 if ( mSmearPed ) ped += getPedSmear( x->sigPed );
791 NUadc = Int_t(newadc + 0.5 + ped);
794 if ( NUadc < 0 ) NUadc = 0;
795 if ( NUadc > mMaxAdc ) NUadc = mMaxAdc;
796 if (adc > 0 && mHist[0]) mHist[0]->Fill(NUadc);
802 if (mOverwrite) hit->setAdc(NUadc);
811 for (Char_t plane =
'U'; plane <=
'V'; ++plane) {
816 det = emc->detector(kEndcapSmdUStripId);
818 LOG_DEBUG <<
"No kEndcapSmdUStripId" << endm;
823 det = emc->detector(kEndcapSmdVStripId);
825 LOG_DEBUG <<
"No kEndcapSmdVStripId" << endm;
833 for (UInt_t sector = 1; sector <= det->numberOfModules();++sector) {
834 StSPtrVecEmcRawHit& hits = det->module(sector)->hits();
835 for (UInt_t i = 0; i < hits.size(); ++i) {
837 Int_t strip = hit->eta();
840 if (!(strip-1 >= 0) || !(strip <= 288) || !(iuv-1 >= 0 && iuv-1 < 2) || !(sector > 0 && sector <= MaxSectors)) {
841 LOG_ERROR <<
"Bad index for ESMD: sec = " << sector <<
", iuv = " << iuv <<
", strip = " << strip << endm;
847 const EEmcDbItem* x = mEeDb ? mEeDb->getByStrip(sector, plane, strip) : 0;
849 LOG_ERROR <<
"Cannot find DB entry for ESMD: sec = " << sector <<
", uv = " << iuv-1+
'U' <<
", strip = " << strip << endm;
855 if (mDropBad && (x->fail || !checkDBped(x) || (x->gain <= 0))) {
858 const Float_t adc = hit->adc();
859 const Float_t energy = hit->energy();
860 Float_t newadc = energy * x->gain;
862 if (mHist[12]) mHist[12]->Fill(x->sec);
863 if (mHist[2]) mHist[20]->Fill(x->strip, adc);
864 if (mHist[3]) mHist[3]->Fill(adc);
867 const Float_t mipval = energy / mMip2ene;
868 const Float_t avgpe = mipval * mMip2pe[strip];
869 const Float_t Npe = gRandom->Poisson(avgpe);
872 const Float_t sigmape = sqrt(Npe) * mSig1pe;
873 Float_t smearedpe = gRandom->Gaus(Npe, sigmape);
874 if (smearedpe < 0) smearedpe = 0;
876 newadc = smearedpe * mMip2ene * x->gain / mMip2pe[strip];
880 newadc *= mSmdGainFact[sector-1][iuv-1][strip-1];
882 Float_t ped = mAddPed ? x->ped : 0;
884 if ( mSmearPed ) ped += getPedSmear( x->sigPed );
886 NUadc = Int_t(newadc + 0.5 + ped);
888 if ( NUadc < 0 ) NUadc = 0;
889 if ( NUadc > mMaxAdc ) NUadc = mMaxAdc;
890 if (adc > 0 && mHist[19]) mHist[19]->Fill(x->strip, NUadc);
891 if (adc > 0 && mHist[2]) mHist[2]->Fill(NUadc);
897 if (mOverwrite) hit->setAdc(NUadc);
906 LOG_INFO <<
"setTowerGainSpread(): gain spread: " << s <<
"; gain mean value: " << mean << endm;
908 for ( Int_t sec=0;sec<kEEmcNumSectors;sec++ ) {
909 for ( Int_t sub=0;sub<kEEmcNumSubSectors;sub++ ) {
910 for ( Int_t eta=0;eta<kEEmcNumEtas;eta++ ) {
912 while (f <= -mean || f >= 1.0) f = gRandom->Gaus(0, s);
913 mTowerGainFact[sec][sub][eta] = mean + f;
921 for (Int_t strip = 0;strip < kEEmcNumStrips;strip++) {
928 for (Int_t sec = 0;sec < kEEmcNumSectors;sec++) {
929 for (Int_t uv = 0;uv < kEEmcNumSmdUVs;uv++) {
937 const Float_t mean = 1.0;
939 while (f <= -mean || f >= 1.0) f = gRandom->Gaus(0, s);
940 mSmdGainFact[sec][uv][strip] = mean + f;
944 Bool_t StEEmcSlowMaker::checkDBped(
const EEmcDbItem *x) {
946 return (x && (x->ped >= 0) && (x->sigPed >= 0));
950 Float_t StEEmcSlowMaker::getPedSmear(Float_t sigPed) {
953 if (mTruncatePedSmear > 0) {
955 smear = gRandom->Gaus(0, 1.0);
956 }
while (fabs(smear) > mTruncatePedSmear);
958 return smear * sigPed;
963 StDetectorId detId[4]={kEndcapEmcTowerId,kEndcapEmcPreShowerId,kEndcapSmdUStripId,kEndcapSmdVStripId};
966 for(
int i=0; i<4; i++) {
967 det = emc->detector(detId[i]);
969 for (UInt_t sec = 1;sec <= det->numberOfModules();sec++) {
970 StSPtrVecEmcRawHit &det_hits = det->module(sec)->hits();
971 for (UInt_t ihit = 0;ihit < det_hits.size();ihit++) {
982 for (Int_t i = 0;i < emc->getNEndcapTowerADC();i++)
983 emc->setTowerADC( i+1, 0, eemc );
985 for (Int_t i = 0;i < emc->getNEndcapPrsHits();i++) {
986 Int_t pre,sec,eta,sub;
987 StMuEmcHit *hit = emc->getEndcapPrsHit(i,sec,sub,eta,pre);
988 if (hit) hit->setAdc(0);
991 for (Char_t uv =
'U';uv <=
'V';uv++) {
993 for (Int_t i = 0;i < emc->getNEndcapSmdHits(uv);i++) {
994 StMuEmcHit *hit=emc->getEndcapSmdHit(uv,i,sec,strip);
995 if (hit) hit->setAdc(0);
float getEnergy() const
Return Hit energy.
char name[StEEmcNameLen]
ASCII name of the channel, see Readme.
void setAddPed(Bool_t a=true)
Add pedestal offsets from DB.
static Float_t getPreshowerGain()
(adc=g*de ) fixed gain for pre/post shower
int getAdc() const
Return ADC value.
static Float_t getSmdGain()
(adc=g*de ) fixed gain for SMD
void setOverwrite(Bool_t o=true)
Overwrite the muDst values.
static Float_t getMipdEdx()
Return MIP dE/dx used for SMD, Pre, Post.
void setDropBad(Bool_t d=true)
Drop bad channels marked as "fail" in DB.
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
virtual ~StEEmcSlowMaker()
Class destructor.
virtual const char * GetName() const
special overload
virtual Int_t Init()
Initialization.
void setTowerGainSpread(Float_t s, Float_t mean=1.0)
Defines a spread in the tower gains, generated gains will be between zero and mean + 1...
void setSmearPed(Bool_t s=true)
Smear the pedestal with sigma from DB.
void setSource(const Char_t *name)
Set the source of ADC. Can be "MuDst" (default) or "StEvent".
void setSmdGainSpread(Float_t s, Int_t sector, Int_t uv, Int_t strip_index)
Defines a spread in the SMD gains, generated gains will be between zero and mean + 1...
virtual Int_t Make()
Processes a single event.