26 theParameterMap(parameters),
27 theNoiseSignalGenerator(0),
106 double noise [32] = {0.};
114 for (
int tbin = 0; tbin < frame.
size(); ++tbin) {
116 double pedestal = calibs.
pedestal(capId) + noise[tbin];
117 frame[tbin] += pedestal;
123 double fudgefactor = 1;
128 if(hcalGenDetId.isHcalCastorDetId())
return;
129 if(hcalGenDetId.isHcalZDCDetId())
return;
133 int theStartingCapId_2 = (int)floor(
theRandFlat->fire(0.,4.));
135 double noise [32] = {0.};
140 makeNoise(*thisChanCholesky, frame.
size(), gauss, noise, (int)theStartingCapId_2);
146 for (
int tbin = 0; tbin < frame.
size(); ++tbin) {
147 int capId = (theStartingCapId_2 + tbin)%4;
148 double x = noise[tbin] * fudgefactor + thisChanADCPeds->
getValue(capId);
149 int x1=(int)std::floor(x);
150 int x2=(int)std::floor(x+1);
151 float y2=coder->
charge(*shape,x2,capId);
152 float y1=coder->
charge(*shape,x1,capId);
153 frame[tbin] = (y2-y1)*(x-x1)+y1;
158 if(fFrames > 10)
return;
160 for(
int i = 0;
i != 10;
i++){
161 for(
int j = 0;
j != 10;
j++){
162 fNoise[
i] += thisChanCholesky.
getValue(m,
i,
j) * fGauss[
j];
183 double s_xy_mean = -0.5 * s_xx_mean;
188 double term = s_xx_mean*s_xx_mean - 2.*s_xy_mean*s_xy_mean;
190 if (term < 0.) term = 1.e-50 ;
191 double sigma =
sqrt (0.5 * (s_xx_mean +
sqrt(term)));
192 double corr = sigma == 0. ? 0. : 0.5*s_xy_mean / sigma;
194 for (
int i = 0;
i < fFrames;
i++) {
195 fNoise [
i] = fGauss[
i]*sigma;
196 if (
i > 0) fNoise [
i] += fGauss[
i-1]*
corr;
197 if (
i < fFrames-1) fNoise [
i] += fGauss[
i+1]*
corr;
void setUseOldHB(bool useOld)
float getValue(int capid, int i, int j) const
void setHOtuningParameter(double tp)
void makeNoiseOld(HcalGenericDetId::HcalGenericSubdetector hcalSubDet, const HcalCalibrationWidths &width, int fFrames, double *fGauss, double *fNoise) const
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
const CaloVNoiseSignalGenerator * theNoiseSignalGenerator
void addThermalNoise(CaloSamples &samples)
const CaloVSimParameterMap * theParameterMap
void setUseOldHF(bool useOld)
double pedestal(int fCapId) const
get pedestal for capid=0..3
void setHFtuningParameter(double tp)
Main class for Parameters in different subdetectors.
CLHEP::RandGaussQ * theRandGaussQ
void setUseOldHO(bool useOld)
const HcalTimeSlewSim * theTimeSlewSim
void setHEtuningParameter(double tp)
void setUseOldHE(bool useOld)
double pedestal(int fCapId) const
get pedestal width for capid=0..3
void setRandomEngine(CLHEP::HepRandomEngine &engine)
need a shaper in order to set thermal noise
const HcalDbService * theDbService
void setRandomEngine(CLHEP::HepRandomEngine &engine)
bool contains(const DetId &detId) const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
float getValue(int fCapId) const
get value for capId = 0..3
const HcalCalibrationWidths & getHcalCalibrationWidths(const HcalGenericDetId &fId) const
HcalAmplifier(const CaloVSimParameterMap *parameters, bool addNoise)
int size() const
get the size
virtual void amplify(CaloSamples &linearFrame) const
void makeNoise(const HcalCholeskyMatrix &thisChanCholesky, int fFrames, double *fGauss, double *fNoise, int m) const
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
void delay(CaloSamples &samples) const
unsigned theStartingCapId
void addPedestals(CaloSamples &frame) const
void pe2fC(CaloSamples &frame) const
const HcalCholeskyMatrix * getValues(DetId fId) const
CLHEP::RandFlat * theRandFlat
DetId id() const
get the (generic) id
HPDIonFeedbackSim * theIonFeedbackSim
HcalGenericSubdetector genericSubdet() const
void setHBtuningParameter(double tp)
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
const Item * getValues(DetId fId) const
void setDbService(const HcalDbService *service)
const HcalPedestals * myADCPeds
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs
const HcalQIEShape * getHcalShape() const
const HcalCholeskyMatrices * myCholeskys
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.