CMS 3D CMS Logo

PulseShapeFunctor.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_HcalRecAlgos_PulseShapeFunctor_h
2 #define RecoLocalCalo_HcalRecAlgos_PulseShapeFunctor_h
3 
5 
6 namespace HcalConst {
7 
8  constexpr int maxSamples = 10;
10  constexpr int nsPerBX = 25;
11  constexpr float iniTimeShift = 92.5f;
12  constexpr float invertnsPerBx = 0.04f;
13  constexpr int shiftTS = 4;
14 
15 } // namespace HcalConst
16 
17 namespace FitterFuncs {
18 
20  public:
22  bool iPedestalConstraint,
23  bool iTimeConstraint,
24  bool iAddPulseJitter,
25  double iPulseJitter,
26  double iTimeMean,
27  double iPedMean,
28  unsigned int nSamplesToFit);
30 
31  void EvalPulse(const float *pars);
32  double EvalPulseM2(const double *pars, const unsigned nPar);
33 
34  void setDefaultcntNANinfit() { cntNANinfit = 0; }
35  int getcntNANinfit() { return cntNANinfit; }
36 
37  void setpsFitx(double *x) {
38  for (int i = 0; i < HcalConst::maxSamples; ++i)
39  psFit_x[i] = x[i];
40  }
41  void setpsFity(double *y) {
42  for (int i = 0; i < HcalConst::maxSamples; ++i)
43  psFit_y[i] = y[i];
44  }
45  void setpsFiterry(double *erry) {
46  for (int i = 0; i < HcalConst::maxSamples; ++i)
47  psFit_erry[i] = erry[i];
48  }
49  void setpsFiterry2(double *erry2) {
50  for (int i = 0; i < HcalConst::maxSamples; ++i)
51  psFit_erry2[i] = erry2[i];
52  }
53  void setpsFitslew(double *slew) {
54  for (int i = 0; i < HcalConst::maxSamples; ++i) {
55  psFit_slew[i] = slew[i];
56  }
57  }
58  double getSiPMDarkCurrent(double darkCurrent, double fcByPE, double lambda);
59  void setinvertpedSig2(double x) { invertpedSig2_ = x; }
60  void setinverttimeSig2(double x) { inverttimeSig2_ = x; }
61 
62  inline void singlePulseShapeFuncMahi(const float *x) { return EvalPulse(x); }
63  inline double singlePulseShapeFunc(const double *x) { return EvalPulseM2(x, 3); }
64  inline double doublePulseShapeFunc(const double *x) { return EvalPulseM2(x, 5); }
65  inline double triplePulseShapeFunc(const double *x) { return EvalPulseM2(x, 7); }
66 
67  void getPulseShape(std::array<double, HcalConst::maxSamples> &fillPulseShape) { fillPulseShape = pulse_shape_; }
68 
69  private:
70  std::array<float, HcalConst::maxPSshapeBin> pulse_hist;
71 
73  std::vector<float> acc25nsVec, diff25nsItvlVec;
74  std::vector<float> accVarLenIdxZEROVec, diffVarItvlIdxZEROVec;
75  std::vector<float> accVarLenIdxMinusOneVec, diffVarItvlIdxMinusOneVec;
76 
77  void funcShape(std::array<double, HcalConst::maxSamples> &ntmpbin,
78  const double pulseTime,
79  const double pulseHeight,
80  const double slew,
81  bool scalePulse);
82  double psFit_x[HcalConst::maxSamples], psFit_y[HcalConst::maxSamples], psFit_erry[HcalConst::maxSamples],
83  psFit_erry2[HcalConst::maxSamples], psFit_slew[HcalConst::maxSamples];
84 
85  unsigned nSamplesToFit_;
90  double pulseJitter_;
91  double timeMean_;
92  double timeSig_;
93  double pedMean_;
94  double timeShift_;
95 
98  std::array<double, HcalConst::maxSamples> pulse_shape_;
99  std::array<double, HcalConst::maxSamples> pulse_shape_sum_;
100  };
101 
102 } // namespace FitterFuncs
103 
104 #endif // PulseShapeFunctor_h
float invertnsPerBx
void singlePulseShapeFuncMahi(const float *x)
double singlePulseShapeFunc(const double *x)
float iniTimeShift
std::array< double, HcalConst::maxSamples > pulse_shape_sum_
std::vector< float > diffVarItvlIdxZEROVec
void getPulseShape(std::array< double, HcalConst::maxSamples > &fillPulseShape)
std::array< float, HcalConst::maxPSshapeBin > pulse_hist
std::vector< float > diff25nsItvlVec
std::vector< float > diffVarItvlIdxMinusOneVec
double pulse(double x, double y, double z, double t)
double triplePulseShapeFunc(const double *x)
double doublePulseShapeFunc(const double *x)
void setpsFiterry2(double *erry2)
std::array< double, HcalConst::maxSamples > pulse_shape_
#define constexpr