18 #include "CLHEP/Random/RandGaussQ.h" 19 #include "CLHEP/Random/RandFlat.h" 25 : theDbService(nullptr),
27 theNoiseSignalGenerator(nullptr),
28 theIonFeedbackSim(nullptr),
29 theTimeSlewSim(nullptr),
33 preMixAdd_(PreMix2) {}
73 int maxbin =
cs.size();
74 int precisebin =
cs.preciseSize();
80 for (
int i = 0;
i < precisebin;
i++) {
82 data.preciseAtMod(
i) +=
86 (
j < 0 ? 0. :
cs.preciseAt(
j));
88 int samplebin = (
int)
i * maxbin / precisebin;
106 if (hcalGenDetId.isHcalCastorDetId())
108 if (hcalGenDetId.isHcalZDCDetId())
114 double noise[32] = {0.};
117 for (
int i = 0;
i <
frame.size();
i++)
118 gauss[
i] = CLHEP::RandGaussQ::shoot(engine, 0., 1.);
123 for (
int tbin = 0; tbin <
frame.size(); ++tbin) {
135 double* fNoise)
const {
141 double s_xx_mean = 0.25 * (
width.pedestal(0) *
width.pedestal(0) +
width.pedestal(1) *
width.pedestal(1) +
147 double s_xy_mean = -0.5 * s_xx_mean;
151 s_xy_mean = 0.08 * s_xx_mean;
153 double term = s_xx_mean * s_xx_mean - 2. * s_xy_mean * s_xy_mean;
157 double sigma =
sqrt(0.5 * (s_xx_mean +
sqrt(term)));
158 double corr = sigma == 0. ? 0. : 0.5 * s_xy_mean / sigma;
160 for (
int i = 0;
i < fFrames;
i++) {
161 fNoise[
i] = fGauss[
i] * sigma;
163 fNoise[
i] += fGauss[
i - 1] *
corr;
165 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
void pe2fC(CaloSamples &frame) const
Main class for Parameters in different subdetectors.
const HcalCalibrationWidths & getHcalCalibrationWidths(const HcalGenericDetId &fId) const
HcalAmplifier(const CaloVSimParameterMap *parameters, bool addNoise, bool PreMix1, bool PreMix2)
constexpr double pedestal(int fCapId) const
get pedestal for capid=0..3
void addThermalNoise(CaloSamples &samples, CLHEP::HepRandomEngine *)
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
const HcalDbService * theDbService
Abs< T >::type abs(const T &t)
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
HcalTimeSlewSim * theTimeSlewSim
void applyQIEdelay(CaloSamples &frame, int delayQIE) const
void makeNoise(HcalGenericDetId::HcalGenericSubdetector hcalSubDet, const HcalCalibrationWidths &width, int fFrames, double *fGauss, double *fNoise) const
HcalGenericSubdetector genericSubdet() const
unsigned theStartingCapId
char data[epos_bytes_allocation]
HPDIonFeedbackSim * theIonFeedbackSim
void delay(CaloSamples &samples, CLHEP::HepRandomEngine *, const HcalTimeSlew *hcalTimeSlew_delay) const
void setDbService(const HcalDbService *service)
bool contains(const DetId &detId) const
virtual void amplify(CaloSamples &linearFrame, CLHEP::HepRandomEngine *) const
void addPedestals(CaloSamples &frame, CLHEP::HepRandomEngine *) const