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,bool iAddTimeSlew,
22  double iPulseJitter,double iTimeMean,double iTimeSig,double iPedMean,double iPedSig,
23  double iNoise, unsigned int nSamplesToFit);
25 
26  double EvalPulse(const double *pars, unsigned int 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 
39  double singlePulseShapeFunc( const double *x );
40  double doublePulseShapeFunc( const double *x );
41  double triplePulseShapeFunc( const double *x );
42 
43  void getPulseShape(std::array<double,HcalConst::maxSamples>& fillPulseShape) {
44  fillPulseShape = pulse_shape_;
45  }
46 
47  private:
48  std::array<float,HcalConst::maxPSshapeBin> pulse_hist;
49 
51  std::vector<float> acc25nsVec, diff25nsItvlVec;
52  std::vector<float> accVarLenIdxZEROVec, diffVarItvlIdxZEROVec;
53  std::vector<float> accVarLenIdxMinusOneVec, diffVarItvlIdxMinusOneVec;
54  void funcShape(std::array<double,HcalConst::maxSamples> & ntmpbin, const double &pulseTime, const double &pulseHeight,const double &slew);
55  double psFit_x[HcalConst::maxSamples], psFit_y[HcalConst::maxSamples], psFit_erry[HcalConst::maxSamples], psFit_erry2[HcalConst::maxSamples], psFit_slew[HcalConst::maxSamples];
56 
57  unsigned nSamplesToFit_;
62  double pulseJitter_;
63  double timeMean_;
64  double timeSig_;
65  double pedMean_;
66  double pedSig_;
67  double noise_;
68  double timeShift_;
69 
70  double inverttimeSig_, inverttimeSig2_;
71  double invertpedSig_, invertpedSig2_;
72  std::array<double,HcalConst::maxSamples> pulse_shape_;
73  std::array<double,HcalConst::maxSamples> pulse_shape_sum_;
74 
75  };
76 
77 }
78 
79 #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