11 #include "CLHEP/Random/RandGaussQ.h" 14 : theParameterMap(parameterMap),
15 minFCToDelay_(minFCToDelay)
22 double totalCharge = 0.;
23 for(
int i = 0;
i < 4; ++
i) {
25 if(bin < samples.
size()) {
26 totalCharge += samples[
bin];
49 int maxbin = cs.
size();
56 double scale_factor = 0.6;
57 double scale = cs[soi] / scale_factor;
65 smearns = CLHEP::RandGaussQ::shoot(engine)*
rms;
66 LogDebug(
"HcalTimeSlewSim") <<
"TimeSmear charge " 67 << scale <<
" rms " << rms
68 <<
" smearns " << smearns;
72 for(
int it = 0; it < maxbin-1; ) {
74 double datai = cs[it];
76 double tshift = smearns;
77 double totalCharge = datai/scale_factor;
80 if(totalCharge <= 0.) totalCharge = eps;
81 tshift += hcalTimeSlew_delay->
delay(totalCharge, biasSetting);
82 if(tshift <= 0.) tshift = eps;
85 if ((datai > cut) && ( it == 0 || (datai > cs[it-1]))) {
89 if(datai > cs[it+1]) nts = 3;
93 for (
int j = it; j < it+nts && j < maxbin; ++j) {
97 double t = j*25. - tshift;
98 int firstbin = floor(t/25.);
99 double f = t/25. - firstbin;
100 int nextbin = firstbin + 1;
101 double v1 = (firstbin < 0 || firstbin >= maxbin) ? 0. : cs[firstbin];
102 double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : cs[nextbin];
106 if(j == it) data[j] = v2*
f;
107 else data[j] = v1*(1.-
f) + v2;
110 if(j == it) data[j] = v2*
f;
111 if(j == it+1) data[j] = v1*(1.-
f) + v2*f;
112 if(j == it+nts-1) data[j] = v1*(1.-
f) + v2;
121 double t=it*25.- tshift;
122 int firstbin=floor(t/25.);
123 double f=t/25. - firstbin;
124 int nextbin = firstbin +1;
125 double v2= (nextbin<0 || nextbin >= maxbin) ? 0. : data[nextbin];
127 data[it+1]+= (v2-data[it]);
HcalSubdetector subdet() const
get the subdetector
unique_ptr< ClusterSequence > cs
HcalTimeSlewSim(const CaloVSimParameterMap *parameterMap, double minFCToDelay)
double delay(double fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
int presamples() const
access presample information
double timeSmearRMS(double ampl) const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
void delay(CaloSamples &samples, CLHEP::HepRandomEngine *, const HcalTimeSlew *hcalTimeSlew_delay) const
const CaloVSimParameterMap * theParameterMap
bin
set the eta bin as selection string.
static const int SubdetectorId
int size() const
get the size
double charge(const CaloSamples &samples) const
char data[epos_bytes_allocation]
DetId id() const
get the (generic) id