11 #include "CLHEP/Random/RandGaussQ.h" 14 : theParameterMap(parameterMap), minFCToDelay_(minFCToDelay) {}
18 double totalCharge = 0.;
19 for (
int i = 0;
i < 4; ++
i) {
21 if (bin < samples.
size()) {
22 totalCharge += samples[
bin];
29 CLHEP::HepRandomEngine* engine,
45 int maxbin = cs.
size();
52 double scale_factor = 0.6;
53 double scale = cs[soi] / scale_factor;
60 smearns = CLHEP::RandGaussQ::shoot(engine) *
rms;
61 LogDebug(
"HcalTimeSlewSim") <<
"TimeSmear charge " << scale <<
" rms " << rms <<
" smearns " << smearns;
65 for (
int it = 0; it < maxbin - 1;) {
66 double datai = cs[it];
68 double tshift = smearns;
69 double totalCharge = datai / scale_factor;
72 if (totalCharge <= 0.)
74 tshift += hcalTimeSlew_delay->
delay(totalCharge, biasSetting);
79 if ((datai > cut) && (it == 0 || (datai > cs[it - 1]))) {
83 if (datai > cs[it + 1])
88 for (
int j = it;
j < it + nts &&
j < maxbin; ++
j) {
91 double t =
j * 25. - tshift;
92 int firstbin = floor(t / 25.);
93 double f = t / 25. - firstbin;
94 int nextbin = firstbin + 1;
95 double v1 = (firstbin < 0 || firstbin >= maxbin) ? 0. : cs[firstbin];
96 double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : cs[nextbin];
103 data[
j] = v1 * (1. -
f) + v2;
108 data[
j] = v1 * (1. -
f) + v2 * f;
109 if (
j == it + nts - 1)
110 data[
j] = v1 * (1. -
f) + v2;
118 double t = it * 25. - tshift;
119 int firstbin = floor(t / 25.);
120 double f = t / 25. - firstbin;
121 int nextbin = firstbin + 1;
122 double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : data[nextbin];
124 data[it + 1] += (v2 - data[it]);
HcalSubdetector subdet() const
get the subdetector
unique_ptr< ClusterSequence > cs
HcalTimeSlewSim(const CaloVSimParameterMap *parameterMap, double minFCToDelay)
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
static const int SubdetectorId
int size() const
get the size
double charge(const CaloSamples &samples) const
char data[epos_bytes_allocation]
float delay(float 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...
DetId id() const
get the (generic) id