11 #include "CLHEP/Random/RandGaussQ.h" 14 : theParameterMap(parameterMap), minFCToDelay_(
minFCToDelay) {}
18 double totalCharge = 0.;
19 for (
int i = 0;
i < 4; ++
i) {
29 CLHEP::HepRandomEngine* engine,
45 int maxbin =
cs.size();
50 int soi =
cs.presamples();
52 double scale_factor = 0.6;
53 double scale =
cs[soi] / scale_factor;
58 if (
params.doTimeSmear()) {
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];
HcalTimeSlewSim(const CaloVSimParameterMap *parameterMap, double minFCToDelay)
constexpr HcalSubdetector subdet() const
get the subdetector
double charge(const CaloSamples &samples) const
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...
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
const CaloVSimParameterMap * theParameterMap
char data[epos_bytes_allocation]
static constexpr int32_t SubdetectorId
void delay(CaloSamples &samples, CLHEP::HepRandomEngine *, const HcalTimeSlew *hcalTimeSlew_delay) const