CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HBHEPulseShapeFlag.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 #ifndef HBHE_PULSESHAPE_FLAG_H_IKAJHGEWRHIGKHAWFIKGHAWIKGH
3 #define HBHE_PULSESHAPE_FLAG_H_IKAJHGEWRHIGKHAWFIKGHAWIKGH
4 //---------------------------------------------------------------------------
5 // Fitting-based algorithms for HBHE noise flagging
6 //
7 // Included:
8 // 1. Linear discriminator (chi2 from linear fit / chi2 from nominal fit)
9 // 2. RMS8/Max ((RMS8/Max)^2 / chi2 from nominal fit)
10 // 3. Triangle fit
11 //
12 // Original Author: Yi Chen (Caltech), 6351 (Nov. 8, 2010)
13 //---------------------------------------------------------------------------
14 #include <string>
15 #include <vector>
16 #include <map>
17 //---------------------------------------------------------------------------
24 //---------------------------------------------------------------------------
26 struct TriangleFitResult;
27 //---------------------------------------------------------------------------
29 {
30 public:
32  HBHEPulseShapeFlagSetter(double MinimumChargeThreshold,
33  double TS4TS5ChargeThreshold,
34  unsigned int TrianglePeakTS,
35  std::vector<double> LinearThreshold,
36  std::vector<double> LinearCut,
37  std::vector<double> RMS8MaxThreshold,
38  std::vector<double> RMS8MaxCut,
39  std::vector<double> LeftSlopeThreshold,
40  std::vector<double> LeftSlopeCut,
41  std::vector<double> RightSlopeThreshold,
42  std::vector<double> RightSlopeCut,
43  std::vector<double> RightSlopeSmallThreshold,
44  std::vector<double> RightSlopeSmallCut,
45  std::vector<double> TS4TS5UpperThreshold,
46  std::vector<double> TS4TS5UpperCut,
47  std::vector<double> TS4TS5LowerThreshold,
48  std::vector<double> TS4TS5LowerCut,
49  bool UseDualFit,
50  bool TriangleIgnoreSlow);
52  void Clear();
53  void SetPulseShapeFlags(HBHERecHit& hbhe, const HBHEDataFrame &digi,
54  const HcalCoder &coder, const HcalCalibrations &calib);
55  void Initialize();
56 private:
60  std::vector<double> mCharge; // stores charge for each TS in each digi
61  // the pair is defined as (threshold, cut position)
62  std::vector<std::pair<double, double> > mLambdaLinearCut;
63  std::vector<std::pair<double, double> > mLambdaRMS8MaxCut;
64  std::vector<std::pair<double, double> > mLeftSlopeCut;
65  std::vector<std::pair<double, double> > mRightSlopeCut;
66  std::vector<std::pair<double, double> > mRightSlopeSmallCut;
67  std::vector<std::pair<double, double> > mTS4TS5UpperCut;
68  std::vector<std::pair<double, double> > mTS4TS5LowerCut;
71  std::vector<double> CumulativeIdealPulse;
72 private:
73  TriangleFitResult PerformTriangleFit(const std::vector<double> &Charge);
74  double PerformNominalFit(const std::vector<double> &Charge);
75  double PerformDualNominalFit(const std::vector<double> &Charge);
76  double DualNominalFitSingleTry(const std::vector<double> &Charge, int Offset, int Distance);
77  double CalculateRMS8Max(const std::vector<double> &Charge);
78  double PerformLinearFit(const std::vector<double> &Charge);
79 private:
80  bool CheckPassFilter(double Charge, double Discriminant, std::vector<std::pair<double, double> > &Cuts,
81  int Side);
82 };
83 //---------------------------------------------------------------------------
84 struct TriangleFitResult
85 {
86  double Chi2;
87  double LeftSlope;
88  double RightSlope;
89 };
90 //---------------------------------------------------------------------------
91 #endif
92 
std::vector< std::pair< double, double > > mLambdaLinearCut
double CalculateRMS8Max(const std::vector< double > &Charge)
std::vector< std::pair< double, double > > mTS4TS5LowerCut
double PerformNominalFit(const std::vector< double > &Charge)
double PerformDualNominalFit(const std::vector< double > &Charge)
double PerformLinearFit(const std::vector< double > &Charge)
std::vector< std::pair< double, double > > mLeftSlopeCut
TriangleFitResult PerformTriangleFit(const std::vector< double > &Charge)
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
std::vector< std::pair< double, double > > mRightSlopeCut
bool CheckPassFilter(double Charge, double Discriminant, std::vector< std::pair< double, double > > &Cuts, int Side)
std::vector< double > mCharge
std::vector< std::pair< double, double > > mRightSlopeSmallCut
double DualNominalFitSingleTry(const std::vector< double > &Charge, int Offset, int Distance)
void SetPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
std::vector< double > CumulativeIdealPulse
std::vector< std::pair< double, double > > mLambdaRMS8MaxCut
std::vector< std::pair< double, double > > mTS4TS5UpperCut