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 double invertnsPerBx = 0.04;
13  constexpr int shiftTS = 4;
14 
15 }
16 
17 namespace FitterFuncs{
18 
20  public:
21  PulseShapeFunctor(const HcalPulseShapes::Shape& pulse,bool iPedestalConstraint, bool iTimeConstraint,bool iAddPulseJitter,
22  double iPulseJitter,double iTimeMean,double iPedMean,
23  unsigned int nSamplesToFit);
25 
26  double EvalPulse(const double *pars, const unsigned nPar);
27 
28  void setDefaultcntNANinfit(){ cntNANinfit =0; }
29  int getcntNANinfit(){ return cntNANinfit; }
30 
31  void setpsFitx(double *x ){ for(int i=0; i<HcalConst::maxSamples; ++i) psFit_x[i] = x[i]; }
32  void setpsFity(double *y ){ for(int i=0; i<HcalConst::maxSamples; ++i) psFit_y[i] = y[i]; }
33  void setpsFiterry (double *erry ){ for(int i=0; i<HcalConst::maxSamples; ++i) psFit_erry [i] = erry [i]; }
34  void setpsFiterry2(double *erry2 ){ for(int i=0; i<HcalConst::maxSamples; ++i) psFit_erry2 [i] = erry2[i]; }
35  void setpsFitslew (double *slew ){ for(int i=0; i<HcalConst::maxSamples; ++i) {psFit_slew [i] = slew [i]; } }
36  double getSiPMDarkCurrent(double darkCurrent, double fcByPE, double lambda);
37  void setinvertpedSig2(double x) { invertpedSig2_ = x; }
38  void setinverttimeSig2(double x) { inverttimeSig2_ = x; }
39 
40  double singlePulseShapeFunc( const double *x );
41  double doublePulseShapeFunc( const double *x );
42  double triplePulseShapeFunc( const double *x );
43 
44  void getPulseShape(std::array<double,HcalConst::maxSamples>& fillPulseShape) {
45  fillPulseShape = pulse_shape_;
46  }
47 
48  private:
49  std::array<float,HcalConst::maxPSshapeBin> pulse_hist;
50 
52  std::vector<float> acc25nsVec, diff25nsItvlVec;
53  std::vector<float> accVarLenIdxZEROVec, diffVarItvlIdxZEROVec;
54  std::vector<float> accVarLenIdxMinusOneVec, diffVarItvlIdxMinusOneVec;
55  void funcShape(std::array<double,HcalConst::maxSamples> & ntmpbin, const double pulseTime, const double pulseHeight,const double slew);
56  double psFit_x[HcalConst::maxSamples], psFit_y[HcalConst::maxSamples], psFit_erry[HcalConst::maxSamples], psFit_erry2[HcalConst::maxSamples], psFit_slew[HcalConst::maxSamples];
57 
58  unsigned nSamplesToFit_;
63  double pulseJitter_;
64  double timeMean_;
65  double timeSig_;
66  double pedMean_;
67  double timeShift_;
68 
71  std::array<double,HcalConst::maxSamples> pulse_shape_;
72  std::array<double,HcalConst::maxSamples> pulse_shape_sum_;
73 
74  };
75 
76 }
77 
78 #endif // PulseShapeFunctor_h
constexpr double invertnsPerBx
std::array< double, HcalConst::maxSamples > pulse_shape_
#define constexpr
constexpr int shiftTS
std::vector< float > diffVarItvlIdxZEROVec
constexpr int maxSamples
constexpr int nsPerBX
void getPulseShape(std::array< double, HcalConst::maxSamples > &fillPulseShape)
std::array< float, HcalConst::maxPSshapeBin > pulse_hist
std::vector< float > diff25nsItvlVec
std::vector< float > diffVarItvlIdxMinusOneVec
std::array< double, HcalConst::maxSamples > pulse_shape_sum_
void setpsFiterry2(double *erry2)
constexpr int maxPSshapeBin
constexpr float iniTimeShift