3 #include "StPmtSignal.h"
12 TNamed("HAMAMATSU-R6427", "Bases used in Beam test-98"),
13 mPmtGain(pmtGain), mCathodeNoise(cathodeNoise), mDynodeNoise(dynodeNoise) {
15 float tmpArray[mNumDynodes] = {2.,2.,1.,1.,1.,1.,1.,1., 2., 3., 4.};
16 for(
int i=0; i<mNumDynodes; i++) mNodeVoltage[i] = tmpArray[i];
19 float voltageProduct = 1.0;
20 for(
int i=0; i<mNumDynodes; i++) {
21 voltageProduct *= mNodeVoltage[i];
23 float globalCoeff = TMath::Power(
double(mPmtGain/voltageProduct), 1.0/(mNumDynodes) );
24 for(
int i=0; i<mNumDynodes; i++) {
25 mSecondaryCoeff[i] = globalCoeff * mNodeVoltage[i];
30 for(
int i=0; i<mNumDynodes; i++) {
31 mDynodeGain[i+1] = mDynodeGain[i] / mSecondaryCoeff[i];
35 mG1[mNumDynodes] = 0.0;
36 for(
int i=mNumDynodes; i>0; i--) {
37 mG1[i-1] = (1.0 + mG1[i]) / mSecondaryCoeff[i-1];
41 mDNW[mNumDynodes] = 0.0;
42 for(
int i=mNumDynodes; i>0; i--) {
43 mDNW[i-1] = mDynodeNoise * (1.0+mG1[i]) * mDynodeGain[i] * mDynodeGain[i] + mDNW[i];
46 LOG_DEBUG <<
"StPmtSignal properties for " << this->GetName() <<
" and " << this->GetTitle() << endm;
47 LOG_DEBUG <<
"nDynodes = " << mNumDynodes << endm;
48 LOG_DEBUG <<
"cathode noise = " << mCathodeNoise << endm;
49 LOG_DEBUG <<
"dynode noise = " << mDynodeNoise << endm;
50 LOG_DEBUG <<
"approximate PMT gain = " << mPmtGain << endm;
54 double nElectrons = nPhotoElectrons + mRandom.PoissonD(mCathodeNoise);
58 if(version == kFastSimulator) {
60 for(i=0; i<mNumDynodes; i++) {
61 if(nElectrons >= 100)
break;
62 nElectrons = mRandom.PoissonD( mSecondaryCoeff[i] * nElectrons + mDynodeNoise );
64 ADC += mTotalGain * (nElectrons + mDynodeNoise*mG1[i]) * mDynodeGain[i];
65 ADC += mRandom.Gaus(mPedestalMean, TMath::Sqrt(mTotalGain*(ADC*mG1[i]*mDynodeGain[i] + mTotalGain*mDNW[i]) + mPedestalRMS*mPedestalRMS) );
67 else if(version == kFullSimulator) {
68 for(
int i=0; i<mNumDynodes; i++) {
69 nElectrons = mRandom.PoissonD( mSecondaryCoeff[i] * nElectrons + mDynodeNoise );
71 ADC += mTotalGain * nElectrons * mDynodeGain[mNumDynodes];
72 ADC += mRandom.Gaus(mPedestalMean, mPedestalRMS);
75 LOG_ERROR << version <<
" is not a valid simulator version " << endm;
78 int ret =
static_cast<int>(TMath::Floor(ADC));
79 LOG_DEBUG << Form(
"hit has photoElectronGain = (%f/%d) = %e", nElectrons, nPhotoElectrons, static_cast<float>(nElectrons/nPhotoElectrons)) << endm;
int getAdc(int nPhotoElectrons, simulatorVersion version)
return ADC counts for a given # of incident photoelectrons