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  double TS3TS4ChargeThreshold,
35  double TS3TS4UpperChargeThreshold,
36  double TS5TS6ChargeThreshold,
37  double TS5TS6UpperChargeThreshold,
38  double R45PlusOneRange,
39  double R45MinusOneRange,
40  unsigned int TrianglePeakTS,
41  const std::vector<double>& LinearThreshold,
42  const std::vector<double>& LinearCut,
43  const std::vector<double>& RMS8MaxThreshold,
44  const std::vector<double>& RMS8MaxCut,
45  const std::vector<double>& LeftSlopeThreshold,
46  const std::vector<double>& LeftSlopeCut,
47  const std::vector<double>& RightSlopeThreshold,
48  const std::vector<double>& RightSlopeCut,
49  const std::vector<double>& RightSlopeSmallThreshold,
50  const std::vector<double>& RightSlopeSmallCut,
51  const std::vector<double>& TS4TS5UpperThreshold,
52  const std::vector<double>& TS4TS5UpperCut,
53  const std::vector<double>& TS4TS5LowerThreshold,
54  const std::vector<double>& TS4TS5LowerCut,
55  bool UseDualFit,
56  bool TriangleIgnoreSlow);
58  void Clear();
59  void SetPulseShapeFlags(HBHERecHit& hbhe, const HBHEDataFrame &digi,
60  const HcalCoder &coder, const HcalCalibrations &calib);
61  void Initialize();
62 private:
72  std::vector<double> mCharge; // stores charge for each TS in each digi
73  // the pair is defined as (threshold, cut position)
74  std::vector<std::pair<double, double> > mLambdaLinearCut;
75  std::vector<std::pair<double, double> > mLambdaRMS8MaxCut;
76  std::vector<std::pair<double, double> > mLeftSlopeCut;
77  std::vector<std::pair<double, double> > mRightSlopeCut;
78  std::vector<std::pair<double, double> > mRightSlopeSmallCut;
79  std::vector<std::pair<double, double> > mTS4TS5UpperCut;
80  std::vector<std::pair<double, double> > mTS4TS5LowerCut;
83  std::vector<double> CumulativeIdealPulse;
84 private:
85  TriangleFitResult PerformTriangleFit(const std::vector<double> &Charge);
86  double PerformNominalFit(const std::vector<double> &Charge);
87  double PerformDualNominalFit(const std::vector<double> &Charge);
88  double DualNominalFitSingleTry(const std::vector<double> &Charge, int Offset, int Distance, bool newCharges=true);
89  double CalculateRMS8Max(const std::vector<double> &Charge);
90  double PerformLinearFit(const std::vector<double> &Charge);
91 private:
92  bool CheckPassFilter(double Charge, double Discriminant, std::vector<std::pair<double, double> > &Cuts,
93  int Side);
94  std::vector<double> f1_;
95  std::vector<double> f2_;
96  std::vector<double> errors_;
97 
98 };
99 //---------------------------------------------------------------------------
100 struct TriangleFitResult
101 {
102  double Chi2;
103  double LeftSlope;
104  double RightSlope;
105 };
106 //---------------------------------------------------------------------------
107 #endif
108 
tuple TS4TS5UpperCut
std::vector< double > f1_
std::vector< std::pair< double, double > > mLambdaLinearCut
std::vector< double > f2_
double CalculateRMS8Max(const std::vector< double > &Charge)
std::vector< std::pair< double, double > > mTS4TS5LowerCut
double PerformNominalFit(const std::vector< double > &Charge)
double DualNominalFitSingleTry(const std::vector< double > &Charge, int Offset, int Distance, bool newCharges=true)
double PerformDualNominalFit(const std::vector< double > &Charge)
tuple TS4TS5LowerThreshold
double PerformLinearFit(const std::vector< double > &Charge)
tuple TS4TS5LowerCut
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
tuple TS4TS5UpperThreshold
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
void SetPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
std::vector< double > errors_
std::vector< double > CumulativeIdealPulse
std::vector< std::pair< double, double > > mLambdaRMS8MaxCut
std::vector< std::pair< double, double > > mTS4TS5UpperCut