CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalShape.cc
Go to the documentation of this file.
2 #include <cmath>
3 
5 : nbin_(256),
6  nt_(nbin_, 0.)
7 {
8  computeShape();
9 }
10 
12  CaloVShape(d),
13  nbin_(d.nbin_),
14  nt_(d.nt_)
15 {
16 }
17 
18 double
20 {
21  return 0. ;
22 }
23 
25 {
26 
27  // pulse shape time constant_s in ns
28  const float ts1 = 8.; // scintillation time constant_s : 1,2,3
29  const float ts2 = 10.;
30  const float ts3 = 29.3;
31  const float thpd = 4.; // HPD current_ collection drift time
32  const float tpre = 9.; // preamp time constant_ (refit on TB04 data)
33 
34  const float wd1 = 2.; // relative weights of decay exponent_s
35  const float wd2 = 0.7;
36  const float wd3 = 1.;
37 
38  // pulse shape componnt_s over a range of time 0 ns to 255 ns in 1 ns steps
39  std::vector<float> nth(nbin_,0.0); // zeroing HPD drift shape
40  std::vector<float> ntp(nbin_,0.0); // zeroing Binkley preamp shape
41  std::vector<float> ntd(nbin_,0.0); // zeroing Scintillator decay shape
42 
43  int i,j,k;
44  float norm;
45 
46  // HPD starts at I and rises to 2I in thpd of time
47  norm=0.0;
48  for(j=0;j<thpd && j<nbin_;j++){
49  nth[j] = 1.0 + j/thpd;
50  norm += nth[j];
51  }
52  // normalize integrated current_ to 1.0
53  for(j=0;j<thpd && j<nbin_;j++){
54  nth[j] /= norm;
55  }
56 
57  // Binkley shape over 6 time constant_s
58  norm=0.0;
59  for(j=0;j<6*tpre && j<nbin_;j++){
60  ntp[j] = j*exp(-(j*j)/(tpre*tpre));
61  norm += ntp[j];
62  }
63  // normalize pulse area to 1.0
64  for(j=0;j<6*tpre && j<nbin_;j++){
65  ntp[j] /= norm;
66  }
67 
68 // ignore stochastic variation of photoelectron emission
69 // <...>
70 
71 // effective tile plus wave-length shifter decay time over 4 time constant_s
72  int tmax = 6 * static_cast<int>(ts3);
73 
74  norm=0.0;
75  for(j=0;j<tmax && j<nbin_;j++){
76  ntd[j] = wd1 * exp(-j/ts1) +
77  wd2 * exp(-j/ts2) +
78  wd3 * exp(-j/ts3) ;
79  norm += ntd[j];
80  }
81  // normalize pulse area to 1.0
82  for(j=0;j<tmax && j<nbin_;j++){
83  ntd[j] /= norm;
84  }
85 
86  int t1,t2,t3,t4;
87  for(i=0;i<tmax && i<nbin_;i++){
88  t1 = i;
89  // t2 = t1 + top*rand;
90  // ignoring jitter from optical path length
91  t2 = t1;
92  for(j=0;j<thpd && j<nbin_;j++){
93  t3 = t2 + j;
94  for(k=0;k<4*tpre && k<nbin_;k++){ // here "4" is set deliberately,
95  t4 = t3 + k; // as in test fortran toy MC ...
96  if(t4<nbin_){
97  int ntb=t4;
98  nt_[ntb] += ntd[i]*nth[j]*ntp[k];
99  }
100  }
101  }
102  }
103 
104  // normalize for 1 GeV pulse height
105  norm = 0.;
106  for(i=0;i<nbin_;i++){
107  norm += nt_[i];
108  }
109 
110  //cout << " Convoluted SHAPE ============== " << endl;
111  for(i=0; i<nbin_; i++){
112  nt_[i] /= norm;
113  // cout << " shape " << i << " = " << nt_[i] << endl;
114  }
115 
116 }
117 
118 double HcalShape::operator () (double time_) const
119 {
120 
121  // return pulse amplitude for request time in ns
122  int jtime = static_cast<int>(time_+0.5);
123  if(jtime>=0 && jtime<nbin_){
124  return nt_[jtime];
125  } else {
126  return 0.0;
127  }
128 
129 }
130 
131 
int i
Definition: DBlmapReader.cc:9
Electronic response of the preamp.
Definition: CaloVShape.h:11
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
std::vector< float > nt_
Definition: HcalShape.h:34
tuple norm
Definition: lumiNorm.py:78
int j
Definition: DBlmapReader.cc:9
shaper for Hcal (not for HF)
Definition: HcalShape.h:15
int k[5][pyjets_maxn]
static const double tmax[3]
int nbin_
Definition: HcalShape.h:33
virtual double operator()(double time) const
Definition: HcalShape.cc:118
HcalShape()
Definition: HcalShape.cc:4
void computeShape()
Definition: HcalShape.cc:24
virtual double timeToRise() const
Definition: HcalShape.cc:19