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(0)
30 double dn = double(n);
31 double dk = double(k);
33 double ldn = lambda * dn;
34 double logb = -ldn + dnk*
log(ldn) - TMath::LnGamma(dnk+1);
39 b *= (
exp(-ldn)*
pow(ldn,dnk))/TMath::Factorial(n-k);
50 typename cdfmap::const_iterator it;
61 if (sumb >= EPSILON)
break;
65 unsigned int borelstartn =
i;
72 if (1-sumb < EPSILON)
break;
82 unsigned int in_pes) {
85 double U = CLHEP::RandFlat::shoot(engine);
86 std::vector<double>::const_iterator
up;
87 up= std::lower_bound (cdf.second.cbegin(), cdf.second.cend(),
U);
89 LogDebug(
"HcalSiPM") <<
"cdf size = " << cdf.second.size()
91 <<
", in_pes = " << in_pes
92 <<
", 2ndary_pes = " << (up-cdf.second.cbegin()+cdf.first);
95 return (up - cdf.second.cbegin() + cdf.first);
119 double sum(0.),
hit(0.);
120 for (
unsigned int pe(0); pe < pes; ++pe) {
121 pixel = CLHEP::RandFlat::shootInt(engine,
theCellCount);
136 double tot(0.),
hit(0.);
162 if((xTalk < 0) || (xTalk >= 1)) {
172 for (
int k=1;
k<=100;
k++)
183 if (deltaTime <= 0.)
return 0.;
184 if (deltaTime*
theTauInv > 10.)
return 1.;
186 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