18 #include "CLHEP/Random/RandGaussQ.h" 19 #include "CLHEP/Random/RandFlat.h" 26 theParameterMap(parameters),
27 theNoiseSignalGenerator(
nullptr),
81 if(hcalGenDetId.isHcalCastorDetId())
return;
82 if(hcalGenDetId.isHcalZDCDetId())
return;
87 double noise [32] = {0.};
91 for (
int i = 0;
i < frame.
size();
i++) gauss[
i] = CLHEP::RandGaussQ::shoot(engine, 0., 1.);
92 makeNoise(hcalSubDet, calibWidths, frame.
size(), gauss, noise);
96 for (
int tbin = 0; tbin < frame.
size(); ++tbin) {
120 double s_xy_mean = -0.5 * s_xx_mean;
125 double term = s_xx_mean*s_xx_mean - 2.*s_xy_mean*s_xy_mean;
127 if (term < 0.) term = 1.e-50 ;
128 double sigma =
sqrt (0.5 * (s_xx_mean +
sqrt(term)));
129 double corr = sigma == 0. ? 0. : 0.5*s_xy_mean / sigma;
131 for (
int i = 0;
i < fFrames;
i++) {
132 fNoise [
i] = fGauss[
i]*sigma;
133 if (
i > 0) fNoise [
i] += fGauss[
i-1]*
corr;
134 if (
i < fFrames-1) fNoise [
i] += fGauss[
i+1]*
corr;
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
const CaloVNoiseSignalGenerator * theNoiseSignalGenerator
const CaloVSimParameterMap * theParameterMap
const HcalTimeSlew * theTimeSlew
Main class for Parameters in different subdetectors.
HcalAmplifier(const CaloVSimParameterMap *parameters, bool addNoise, bool PreMix1, bool PreMix2)
void addThermalNoise(CaloSamples &samples, CLHEP::HepRandomEngine *)
double pedestal(int fCapId) const
get pedestal width for capid=0..3
const HcalDbService * theDbService
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
bool contains(const DetId &detId) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void delay(CaloSamples &samples, CLHEP::HepRandomEngine *, const HcalTimeSlew *hcalTimeSlew_delay) const
const HcalCalibrationWidths & getHcalCalibrationWidths(const HcalGenericDetId &fId) const
virtual void amplify(CaloSamples &linearFrame, CLHEP::HepRandomEngine *) const
HcalTimeSlewSim * theTimeSlewSim
constexpr double pedestal(int fCapId) const
get pedestal for capid=0..3
int size() const
get the size
unsigned theStartingCapId
void addPedestals(CaloSamples &frame, CLHEP::HepRandomEngine *) const
void pe2fC(CaloSamples &frame) const
void makeNoise(HcalGenericDetId::HcalGenericSubdetector hcalSubDet, const HcalCalibrationWidths &width, int fFrames, double *fGauss, double *fNoise) const
DetId id() const
get the (generic) id
HPDIonFeedbackSim * theIonFeedbackSim
HcalGenericSubdetector genericSubdet() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
void setDbService(const HcalDbService *service)
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs