11 #include "CLHEP/Random/RandGaussQ.h" 14 : theParameterMap(parameterMap),
15 minFCToDelay_(minFCToDelay)
23 double totalCharge = 0.;
24 for(
int i = 0;
i < 4; ++
i) {
26 if(bin < samples.
size()) {
27 totalCharge += samples[
bin];
51 int maxbin = cs.
size();
58 double scale_factor = 0.6;
59 double scale = cs[soi] / scale_factor;
67 smearns = CLHEP::RandGaussQ::shoot(engine)*
rms;
68 LogDebug(
"HcalTimeSlewSim") <<
"TimeSmear charge " 69 << scale <<
" rms " << rms
70 <<
" smearns " << smearns;
74 for(
int it = 0; it < maxbin-1; ) {
76 double datai = cs[it];
78 double tshift = smearns;
79 double totalCharge = datai/scale_factor;
82 if(totalCharge <= 0.) totalCharge = eps;
84 if(tshift <= 0.) tshift = eps;
87 if ((datai > cut) && ( it == 0 || (datai > cs[it-1]))) {
91 if(datai > cs[it+1]) nts = 3;
95 for (
int j = it; j < it+nts && j < maxbin; ++j) {
99 double t = j*25. - tshift;
100 int firstbin = floor(t/25.);
101 double f = t/25. - firstbin;
102 int nextbin = firstbin + 1;
103 double v1 = (firstbin < 0 || firstbin >= maxbin) ? 0. : cs[firstbin];
104 double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : cs[nextbin];
108 if(j == it) data[j] = v2*
f;
109 else data[j] = v1*(1.-
f) + v2;
112 if(j == it) data[j] = v2*
f;
113 if(j == it+1) data[j] = v1*(1.-
f) + v2*f;
114 if(j == it+nts-1) data[j] = v1*(1.-
f) + v2;
123 double t=it*25.- tshift;
124 int firstbin=floor(t/25.);
125 double f=t/25. - firstbin;
126 int nextbin = firstbin +1;
127 double v2= (nextbin<0 || nextbin >= maxbin) ? 0. : data[nextbin];
129 data[it+1]+= (v2-data[it]);
auto_ptr< ClusterSequence > cs
HcalSubdetector subdet() const
get the subdetector
HcalTimeSlewSim(const CaloVSimParameterMap *parameterMap, double minFCToDelay)
int presamples() const
access presample information
void delay(CaloSamples &samples, CLHEP::HepRandomEngine *) const
double timeSmearRMS(double ampl) const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
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
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...