3 #include "CLHEP/Random/RandPoisson.h"
4 #include "CLHEP/Random/RandGauss.h"
5 #include "CLHEP/Random/RandBinomial.h"
26 cout <<
"--------------------------------" << endl;
27 cout <<
"ScintillatorPpdDigi parameters" << endl;
30 cout <<
" npix = " <<
_npix << endl;
35 cout <<
"--------------------------------" << endl;
41 float correctedEnergy(energy);
44 cout <<
"ERROR, crazy parameters for ScintillatorPpdDigi: PE/MIP=" <<
_pe_per_mip <<
", MIP calib=" <<
_calib_mip <<
", #pixels=" <<
_npix << endl;
45 cout <<
"you must specify at least the #PE/MIP, MIP calibration, and #pixels for realistic scintillator digitisation!!" << endl;
46 cout <<
"refusing to proceed!" << endl;
83 npe = CLHEP::RandBinomial::shoot(
_npix, p);
90 npe *= CLHEP::RandGauss::shoot(1,
_pixSpread/sqrt(npe) );
118 const float r = 0.95;
120 if (npe < r*smearedNpix){
121 npe = -smearedNpix * std::log ( 1. - ( npe / smearedNpix ) );
123 npe = 1/(1-r)*(npe-r*smearedNpix)-smearedNpix*std::log(1-r);
130 return correctedEnergy;
float getDigitisedEnergy(float energy)
float _elecMaxDynRange_MIP