4 #include "CLHEP/Random/RandGaussQ.h" 5 #include "CLHEP/Random/RandPoissonQ.h" 6 #include "CLHEP/Random/RandFlat.h" 15 theCellCount(nCells), theSiPM(nCells,1.),
16 theCrossTalk(0.), theTempDep(0.), theLastHitTime(-1.), nonlin(
nullptr)
31 double dn = double(n);
32 double dk = double(k);
34 double ldn = lambda * dn;
35 double logb = -ldn + dnk*
log(ldn) - TMath::LnGamma(dnk+1);
40 b *= (
exp(-ldn)*
pow(ldn,dnk))/TMath::Factorial(n-k);
51 typename cdfmap::const_iterator it;
62 if (sumb >= EPSILON)
break;
66 unsigned int borelstartn =
i;
73 if (1-sumb < EPSILON)
break;
83 unsigned int in_pes) {
86 double U = CLHEP::RandFlat::shoot(engine);
87 std::vector<double>::const_iterator
up;
88 up= std::lower_bound (cdf.second.cbegin(), cdf.second.cend(),
U);
90 LogDebug(
"HcalSiPM") <<
"cdf size = " << cdf.second.size()
92 <<
", in_pes = " << in_pes
93 <<
", 2ndary_pes = " << (up-cdf.second.cbegin()+cdf.first);
96 return (up - cdf.second.cbegin() + cdf.first);
120 double sum(0.),
hit(0.);
121 for (
unsigned int pe(0); pe < pes; ++pe) {
122 pixel = CLHEP::RandFlat::shootInt(engine,
theCellCount);
137 double tot(0.),
hit(0.);
163 if((xTalk < 0) || (xTalk >= 1)) {
173 for (
int k=1;
k<=100;
k++)
184 if (deltaTime <= 0.)
return 0.;
185 if (deltaTime*
theTauInv > 10.)
return 1.;
187 return (result > 0.99) ? 1.0 :
result;
double cellCharge(double deltaTime) const
void setSaturationPars(const std::vector< float > &pars)
virtual double totalCharge() const
std::vector< double > theSiPM
const cdfpair & BorelCDF(unsigned int k)
double Borel(unsigned int n, double lambda, unsigned int k)
virtual double hitCells(CLHEP::HepRandomEngine *, unsigned int pes, double tempDiff=0., double photonTime=0.)
void setNCells(int nCells)
void setCrossTalk(double xtalk)
unsigned int addCrossTalkCells(CLHEP::HepRandomEngine *engine, unsigned int in_pes)
HcalSiPMnonlinearity * nonlin
unsigned int theCellCount
HcalSiPM(int nCells=1, double tau=15.)
void setTemperatureDependence(double tempDep)
Power< A, B >::type pow(const A &a, const B &b)
std::pair< unsigned int, std::vector< double > > cdfpair