22 #include "CLHEP/Random/RandBinomial.h"
23 #include "CLHEP/Random/RandGaussQ.h"
24 #include "CLHEP/Random/RandPoissonQ.h"
33 : theDbService(nullptr), theShapes(shapes) {}
38 DetId detId,
double signal,
double pedWidth,
bool doThermal,
bool isInGeV, CLHEP::HepRandomEngine* engine) {
45 double charge = signal / GeVperfC;
48 if (charge > 3. * pedWidth) {
51 double electronEmission = 0.08;
52 CLHEP::RandPoissonQ theRandPoissonQ(*engine, electronEmission);
53 npe += theRandPoissonQ.fire();
56 noise =
correctPE(detId, npe, engine) - npe;
58 return (noise * GeVperfC);
62 double rateInTail = 0.000211988;
63 double rateInSecondTail = 4.61579e-06;
74 double p4 = 2.06117e+01;
75 double p5 = 1.09239e+01;
79 double p7 = 5.45548e+01;
80 double p8 = 1.59696e+01;
83 int nFirst = (int)(CLHEP::RandBinomial::shoot(engine, npe, rateInTail));
84 int nSecond = (int)(CLHEP::RandBinomial::shoot(engine, npe, rateInSecondTail));
86 for (
int j = 0;
j < nFirst; ++
j) {
87 noise += CLHEP::RandGaussQ::shoot(engine, p4, p5);
89 for (
int j = 0;
j < nSecond; ++
j) {
90 noise += CLHEP::RandGaussQ::shoot(engine, p7, p8);
104 CLHEP::RandPoissonQ theRandPoissonQ(*engine, meanPE);
105 double npe = theRandPoissonQ.fire();
111 double timeFromPE = (
j -
i) * 25.;
112 samples[
j] += (*shape)(timeFromPE)*npe;
124 if (!gains || !gwidths) {
125 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.
Log< level::Error, false > LogError
float getValue(int fCapId) const
get value for capId = 0..3
const HcalDbService * theDbService
void addThermalNoise(CaloSamples &samples, CLHEP::HepRandomEngine *)
double correctPE(const DetId &detId, double npe, CLHEP::HepRandomEngine *) const override
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