4 #include "CLHEP/Random/RandGaussQ.h"
5 #include "CLHEP/Random/RandPoissonQ.h"
6 #include "CLHEP/Random/RandFlat.h"
15 : theCellCount(nCells), theSiPM(nCells, 1.), 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;
58 double b = 0., sumb = 0.;
67 unsigned int borelstartn =
i;
74 if (1 - sumb < EPSILON)
87 double U = CLHEP::RandFlat::shoot(engine);
88 std::vector<double>::const_iterator
up;
91 LogDebug(
"HcalSiPM") <<
"cdf size = " << cdf.second.size() <<
", U = " << U <<
", in_pes = " << in_pes
92 <<
", 2ndary_pes = " << (up - cdf.second.cbegin() + cdf.first);
95 return (up - cdf.second.cbegin() + cdf.first);
100 double HcalSiPM::hitCells(CLHEP::HepRandomEngine* engine,
unsigned int pes,
double tempDiff,
double photonTime) {
119 double sum(0.),
hit(0.);
120 for (
unsigned int pe(0); pe < pes; ++pe) {
121 pixel = CLHEP::RandFlat::shootInt(engine,
theCellCount);
135 double tot(0.),
hit(0.);
163 if ((xTalk < 0) || (xTalk >= 1)) {
173 for (
int k = 1;
k <= 100;
k++)
189 return (result > 0.99) ? 1.0 :
result;
static std::vector< std::string > checklist log
double cellCharge(double deltaTime) const
void setSaturationPars(const std::vector< float > &pars)
virtual double totalCharge() const
Exp< T >::type exp(const T &t)
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
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ nCells
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
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