3 #include "StEmcPmtSimulator.h"
7 #include "StEvent/StEmcRawHit.h"
8 #include "StMcEvent/StMcCalorimeterHit.hh"
9 #include "StEmcUtil/geometry/StEmcGeom.h"
10 #include "StEmcUtil/database/StBemcTables.h"
18 case kBarrelEmcTowerId:
19 mMipPhotoElectrons = 63.0;
20 mMipEnergyDeposit = 0.0198;
23 case kBarrelEmcPreShowerId:
24 mMipPhotoElectrons = 6.0;
25 mMipEnergyDeposit = 0.002;
29 LOG_ERROR <<
"StEmcPmtSimulator isn't configured for " << mDetectorId << endm;
33 case kPrimarySecondaryFullMode:
34 mVer = StPmtSignal::kFullSimulator;
37 case kPrimarySecondaryFastMode:
38 mVer = StPmtSignal::kFastSimulator;
47 if(mcHit->module() <= 0 || mcHit->eta() <= 0 || mcHit->sub() <= 0) {
48 LOG_ERROR <<
"These quantities must all be positive: module=" << mcHit->module()
49 <<
" eta=" << mcHit->eta() <<
" sub=" << mcHit->sub() << endm;
55 float pseudoRapidity; mGeom->getEta(mcHit->module(), mcHit->eta(), pseudoRapidity);
56 int softId; mGeom->getId(mcHit->module(), mcHit->eta(), mcHit->sub(), softId);
58 double photoElectrons = mcHit->dE() * mMipPhotoElectrons / mMipEnergyDeposit;
59 photoElectrons = mRandom.PoissonD(photoElectrons);
62 float calib = mTables->calib(mDetectorId-8, softId);
65 double totalGain = calib ? samplingFraction(pseudoRapidity) * (mMipEnergyDeposit / mMipPhotoElectrons) / calib : 0.0;
67 double pedMean(0.0), pedRMS(0.0);
69 pedMean = mTables->pedestal(mDetectorId-8, softId);
70 pedRMS = mTables->pedestalRMS(mDetectorId-8, softId);
75 case kTestMode:
case kSimpleMode: {
80 case kPrimaryOnlyMode: {
81 ADC = totalGain * photoElectrons;
82 ADC += mRandom.Gaus(pedMean, pedRMS);
86 case kPrimarySecondaryFullMode:
case kPrimarySecondaryFastMode: {
91 ADC = mPmtSignal.
getAdc(static_cast<int>(photoElectrons), mVer);
97 ADC = pedMean + (ADC-pedMean) * mRandom.Gaus(mCalibScale, mCalibSpread);
100 double maxADC = mRandom.Gaus(mMaxADC, mMaxADCSpread);
101 if(ADC < 0) ADC = 0.0;
102 if(ADC > maxADC) ADC = maxADC;
104 rawHit->setAdc(static_cast<unsigned int>(ADC));
106 float energy = (rawHit->adc() - pedMean) * calib;
107 rawHit->setEnergy(energy);
109 LOG_DEBUG << Form(
"det=%2d softId=%5d dE=%e sF=%.1f ADC=%4d ped=%6.2f rms=%4.2f energy=%.4f",
110 mDetectorId, softId, mcHit->dE(), samplingFraction(pseudoRapidity), rawHit->adc(),
111 pedMean, pedRMS, rawHit->energy()) << endm;
void setTotalGain(float val)
set the gain of the full PMT chain in ADC counts / photoelectron emitted from cathode ...
StEmcRawHit * makeRawHit(const StMcCalorimeterHit *mcHit)
workhorse function
virtual StEmcRawHit * makeRawHit(const StMcCalorimeterHit *mcHit)
workhorse function
void setPedestalRMS(float val)
set the width of the pedestal in ADC counts
void setPedestalMean(float val)
set the pedestal in ADC counts
int getAdc(int nPhotoElectrons, simulatorVersion version)
return ADC counts for a given # of incident photoelectrons