CMS 3D CMS Logo

CastorShape.cc
Go to the documentation of this file.
2 #include <cmath>
3 
4 CastorShape::CastorShape() : nbin_(256), nt_(nbin_, 0.) { computeShapeCastor(); }
5 
7 
9  // cout << endl << " ===== computeShapeCastor !!! " << endl << endl;
10 
11  const float ts = 3.0; // time constant in t * exp(-(t/ts)**2)
12 
13  int j;
14  float norm;
15 
16  // HF SHAPE
17  norm = 0.0;
18  for (j = 0; j < 3 * ts && j < nbin_; j++) {
19  // nt_[j] = ((float)j)*exp(-((float)(j*j))/(ts*ts));
20  nt_[j] = j * exp(-(j * j) / (ts * ts));
21  norm += nt_[j];
22  }
23  // normalize pulse area to 1.0
24  for (j = 0; j < 3 * ts && j < nbin_; j++) {
25  nt_[j] /= norm;
26  }
27 }
28 
29 double CastorShape::operator()(double time) const {
30  // return pulse amplitude for request time in ns
31  int jtime;
32  jtime = static_cast<int>(time + 0.5);
33 
34  if (jtime >= 0 && jtime < nbin_)
35  return nt_[jtime];
36  else
37  return 0.0;
38 }
39 
40 double CastorShape::timeToRise() const { return 0.0; }
void computeShapeCastor()
Definition: CastorShape.cc:8
Electronic response of the preamp.
Definition: CaloVShape.h:11
std::vector< float > nt_
Definition: CastorShape.h:29
double operator()(double time) const override
Definition: CastorShape.cc:29
double timeToRise() const override
Definition: CastorShape.cc:40
shaper for Castor
Definition: CastorShape.h:15