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;
9  constexpr int maxPSshapeBin = 256;
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 
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;
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);
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
FitterFuncs::PulseShapeFunctor::nSamplesToFit_
unsigned nSamplesToFit_
Definition: PulseShapeFunctor.h:85
FitterFuncs::PulseShapeFunctor::setDefaultcntNANinfit
void setDefaultcntNANinfit()
Definition: PulseShapeFunctor.h:34
FitterFuncs::PulseShapeFunctor::unConstrainedFit_
bool unConstrainedFit_
Definition: PulseShapeFunctor.h:89
FitterFuncs::PulseShapeFunctor::diff25nsItvlVec
std::vector< float > diff25nsItvlVec
Definition: PulseShapeFunctor.h:73
mps_fire.i
i
Definition: mps_fire.py:355
FitterFuncs::PulseShapeFunctor::setinvertpedSig2
void setinvertpedSig2(double x)
Definition: PulseShapeFunctor.h:59
FitterFuncs::PulseShapeFunctor::pedestalConstraint_
bool pedestalConstraint_
Definition: PulseShapeFunctor.h:86
FitterFuncs::PulseShapeFunctor::singlePulseShapeFuncMahi
void singlePulseShapeFuncMahi(const float *x)
Definition: PulseShapeFunctor.h:62
HcalConst::maxSamples
constexpr int maxSamples
Definition: PulseShapeFunctor.h:8
FitterFuncs::PulseShapeFunctor::psFit_slew
double psFit_slew[HcalConst::maxSamples]
Definition: PulseShapeFunctor.h:82
HcalPulseShapes.h
FitterFuncs::PulseShapeFunctor
Definition: PulseShapeFunctor.h:19
FitterFuncs::PulseShapeFunctor::timeConstraint_
bool timeConstraint_
Definition: PulseShapeFunctor.h:87
pulse
double pulse(double x, double y, double z, double t)
Definition: SiStripPulseShape.cc:49
FitterFuncs::PulseShapeFunctor::doublePulseShapeFunc
double doublePulseShapeFunc(const double *x)
Definition: PulseShapeFunctor.h:64
FitterFuncs::PulseShapeFunctor::setinverttimeSig2
void setinverttimeSig2(double x)
Definition: PulseShapeFunctor.h:60
HcalConst::iniTimeShift
constexpr float iniTimeShift
Definition: PulseShapeFunctor.h:11
FitterFuncs::PulseShapeFunctor::setpsFiterry
void setpsFiterry(double *erry)
Definition: PulseShapeFunctor.h:45
FitterFuncs::PulseShapeFunctor::psFit_erry2
double psFit_erry2[HcalConst::maxSamples]
Definition: PulseShapeFunctor.h:82
FitterFuncs::PulseShapeFunctor::EvalPulse
void EvalPulse(const float *pars)
Definition: PulseShapeFunctor.cc:125
FitterFuncs::PulseShapeFunctor::accVarLenIdxZEROVec
std::vector< float > accVarLenIdxZEROVec
Definition: PulseShapeFunctor.h:74
FitterFuncs::PulseShapeFunctor::funcShape
void funcShape(std::array< double, HcalConst::maxSamples > &ntmpbin, const double pulseTime, const double pulseHeight, const double slew, bool scalePulse)
Definition: PulseShapeFunctor.cc:71
FitterFuncs::PulseShapeFunctor::pulse_shape_
std::array< double, HcalConst::maxSamples > pulse_shape_
Definition: PulseShapeFunctor.h:98
FitterFuncs::PulseShapeFunctor::psFit_y
double psFit_y[HcalConst::maxSamples]
Definition: PulseShapeFunctor.h:82
FitterFuncs::PulseShapeFunctor::cntNANinfit
int cntNANinfit
Definition: PulseShapeFunctor.h:72
FitterFuncs::PulseShapeFunctor::setpsFitslew
void setpsFitslew(double *slew)
Definition: PulseShapeFunctor.h:53
HcalResponse_cfi.nPar
nPar
Definition: HcalResponse_cfi.py:33
HcalConst::nsPerBX
constexpr int nsPerBX
Definition: PulseShapeFunctor.h:10
FitterFuncs::PulseShapeFunctor::pulse_hist
std::array< float, HcalConst::maxPSshapeBin > pulse_hist
Definition: PulseShapeFunctor.h:70
FitterFuncs::PulseShapeFunctor::singlePulseShapeFunc
double singlePulseShapeFunc(const double *x)
Definition: PulseShapeFunctor.h:63
FitterFuncs::PulseShapeFunctor::inverttimeSig2_
double inverttimeSig2_
Definition: PulseShapeFunctor.h:96
FitterFuncs::PulseShapeFunctor::accVarLenIdxMinusOneVec
std::vector< float > accVarLenIdxMinusOneVec
Definition: PulseShapeFunctor.h:75
FitterFuncs::PulseShapeFunctor::setpsFitx
void setpsFitx(double *x)
Definition: PulseShapeFunctor.h:37
FitterFuncs::PulseShapeFunctor::EvalPulseM2
double EvalPulseM2(const double *pars, const unsigned nPar)
Definition: PulseShapeFunctor.cc:132
FitterFuncs::PulseShapeFunctor::triplePulseShapeFunc
double triplePulseShapeFunc(const double *x)
Definition: PulseShapeFunctor.h:65
FitterFuncs::PulseShapeFunctor::pedMean_
double pedMean_
Definition: PulseShapeFunctor.h:93
FitterFuncs::PulseShapeFunctor::psFit_x
double psFit_x[HcalConst::maxSamples]
Definition: PulseShapeFunctor.h:82
HcalConst::invertnsPerBx
constexpr float invertnsPerBx
Definition: PulseShapeFunctor.h:12
FitterFuncs::PulseShapeFunctor::addPulseJitter_
bool addPulseJitter_
Definition: PulseShapeFunctor.h:88
HcalConst::maxPSshapeBin
constexpr int maxPSshapeBin
Definition: PulseShapeFunctor.h:9
FitterFuncs::PulseShapeFunctor::psFit_erry
double psFit_erry[HcalConst::maxSamples]
Definition: PulseShapeFunctor.h:82
FitterFuncs::PulseShapeFunctor::timeSig_
double timeSig_
Definition: PulseShapeFunctor.h:92
FitterFuncs::PulseShapeFunctor::getPulseShape
void getPulseShape(std::array< double, HcalConst::maxSamples > &fillPulseShape)
Definition: PulseShapeFunctor.h:67
FitterFuncs
Definition: PulseShapeFunctor.h:17
HcalConst::shiftTS
constexpr int shiftTS
Definition: PulseShapeFunctor.h:13
FitterFuncs::PulseShapeFunctor::diffVarItvlIdxZEROVec
std::vector< float > diffVarItvlIdxZEROVec
Definition: PulseShapeFunctor.h:74
FitterFuncs::PulseShapeFunctor::timeShift_
double timeShift_
Definition: PulseShapeFunctor.h:94
FitterFuncs::PulseShapeFunctor::~PulseShapeFunctor
~PulseShapeFunctor()
Definition: PulseShapeFunctor.cc:123
FitterFuncs::PulseShapeFunctor::acc25nsVec
std::vector< float > acc25nsVec
Definition: PulseShapeFunctor.h:73
FitterFuncs::PulseShapeFunctor::pulseJitter_
double pulseJitter_
Definition: PulseShapeFunctor.h:90
HcalPulseShape
Definition: HcalPulseShape.h:6
FitterFuncs::PulseShapeFunctor::invertpedSig2_
double invertpedSig2_
Definition: PulseShapeFunctor.h:97
FitterFuncs::PulseShapeFunctor::getcntNANinfit
int getcntNANinfit()
Definition: PulseShapeFunctor.h:35
FitterFuncs::PulseShapeFunctor::diffVarItvlIdxMinusOneVec
std::vector< float > diffVarItvlIdxMinusOneVec
Definition: PulseShapeFunctor.h:75
FitterFuncs::PulseShapeFunctor::pulse_shape_sum_
std::array< double, HcalConst::maxSamples > pulse_shape_sum_
Definition: PulseShapeFunctor.h:99
FitterFuncs::PulseShapeFunctor::setpsFiterry2
void setpsFiterry2(double *erry2)
Definition: PulseShapeFunctor.h:49
FitterFuncs::PulseShapeFunctor::PulseShapeFunctor
PulseShapeFunctor(const HcalPulseShapes::Shape &pulse, bool iPedestalConstraint, bool iTimeConstraint, bool iAddPulseJitter, double iPulseJitter, double iTimeMean, double iPedMean, unsigned int nSamplesToFit)
Definition: PulseShapeFunctor.cc:10
FitterFuncs::PulseShapeFunctor::setpsFity
void setpsFity(double *y)
Definition: PulseShapeFunctor.h:41
FitterFuncs::PulseShapeFunctor::getSiPMDarkCurrent
double getSiPMDarkCurrent(double darkCurrent, double fcByPE, double lambda)
FitterFuncs::PulseShapeFunctor::timeMean_
double timeMean_
Definition: PulseShapeFunctor.h:91
HcalConst
Definition: PulseShapeFunctor.h:6