22 #include "CLHEP/Random/RandBinomial.h" 23 #include "CLHEP/Random/RandGaussQ.h" 24 #include "CLHEP/Random/RandPoissonQ.h" 33 : theDbService(
nullptr), theShapes(shapes)
47 if(isInGeV) GeVperfC = 1./
fCtoGeV(detId);
49 double charge = signal / GeVperfC;
52 if (charge > 3. * pedWidth) {
55 double electronEmission = 0.08;
56 CLHEP::RandPoissonQ theRandPoissonQ(*engine, electronEmission);
57 npe += theRandPoissonQ.fire();
60 noise =
correctPE(detId, npe, engine) - npe;
62 return (noise * GeVperfC);
69 double rateInTail = 0.000211988;
70 double rateInSecondTail = 4.61579e-06;
81 double p4 = 2.06117e+01;
82 double p5 = 1.09239e+01;
86 double p7 = 5.45548e+01;
87 double p8 = 1.59696e+01;
90 int nFirst = (
int)(CLHEP::RandBinomial::shoot(engine, npe, rateInTail));
91 int nSecond = (
int)(CLHEP::RandBinomial::shoot(engine, npe, rateInSecondTail));
93 for (
int j = 0; j < nFirst; ++j) {
94 noise += CLHEP::RandGaussQ::shoot(engine, p4, p5);
96 for (
int j = 0; j < nSecond; ++j) {
97 noise += CLHEP::RandGaussQ::shoot(engine, p7, p8);
108 double meanPE = 0.02;
114 CLHEP::RandPoissonQ theRandPoissonQ(*engine, meanPE);
115 double npe = theRandPoissonQ.fire();
123 double timeFromPE = (j-
i) * 25.;
124 samples[j] += (*shape)(timeFromPE) * npe;
138 if (!gains || !gwidths )
140 edm::LogError(
"HcalAmplifier") <<
"Could not fetch HCAL conditions for channel " << hcalGenDetId;
HPDIonFeedbackSim(const edm::ParameterSet &, const CaloShapes *shapes)
need a shaper in order to set thermal noise
const HcalGainWidth * getGainWidth(const HcalGenericDetId &fId) const
~HPDIonFeedbackSim() override
double getIonFeedback(DetId detId, double signal, double pedWidth, bool doThermal, bool isInGeV, CLHEP::HepRandomEngine *)
virtual const CaloVShape * shape(const DetId &detId, bool precise=false) const
static const double pe2Charge
double fCtoGeV(const DetId &detId) const
Electronic response of the preamp.
float getValue(int fCapId) const
get value for capId = 0..3
const HcalDbService * theDbService
void addThermalNoise(CaloSamples &samples, CLHEP::HepRandomEngine *)
constexpr size_t nSamples
int size() const
get the size
const HcalGain * getGain(const HcalGenericDetId &fId) const
const CaloShapes * theShapes
DetId id() const
get the (generic) id
double correctPE(const DetId &detId, double npe, CLHEP::HepRandomEngine *) const override