22 #include "CLHEP/Random/RandBinomial.h"
23 #include "CLHEP/Random/RandGaussQ.h"
24 #include "CLHEP/Random/RandPoissonQ.h"
33 : theDbService(0), 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;
110 int nSamples = samples.
size();
112 for(
int i = 0;
i < nSamples; ++
i)
114 CLHEP::RandPoissonQ theRandPoissonQ(*engine, meanPE);
115 double npe = theRandPoissonQ.fire();
121 for(
int j =
i;
j < nSamples; ++
j)
123 double timeFromPE = (
j-
i) * 25.;
124 samples[
j] += (*shape)(timeFromPE) * npe;
137 if (!gains || !gwidths )
139 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
double getIonFeedback(DetId detId, double signal, double pedWidth, bool doThermal, bool isInGeV, CLHEP::HepRandomEngine *)
double fCtoGeV(const DetId &detId) const
Electronic response of the preamp.
virtual double correctPE(const DetId &detId, double npe, CLHEP::HepRandomEngine *) const
float getValue(int fCapId) const
get value for capId = 0..3
const HcalDbService * theDbService
void addThermalNoise(CaloSamples &samples, CLHEP::HepRandomEngine *)
int size() const
get the size
const HcalGain * getGain(const HcalGenericDetId &fId) const
const CaloShapes * theShapes
DetId id() const
get the (generic) id
virtual const CaloVShape * shape(const DetId &detId) const