Go to the documentation of this file.00001
00002 #ifndef HBHE_PULSESHAPE_FLAG_H_IKAJHGEWRHIGKHAWFIKGHAWIKGH
00003 #define HBHE_PULSESHAPE_FLAG_H_IKAJHGEWRHIGKHAWFIKGHAWIKGH
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <string>
00015 #include <vector>
00016 #include <map>
00017
00018 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
00019 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00020 #include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
00021 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalCaloFlagLabels.h"
00022 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
00023 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
00024
00025 class HBHEPulseShapeFlagSetter;
00026 struct TriangleFitResult;
00027
00028 class HBHEPulseShapeFlagSetter
00029 {
00030 public:
00031 HBHEPulseShapeFlagSetter();
00032 HBHEPulseShapeFlagSetter(double MinimumChargeThreshold,
00033 double TS4TS5ChargeThreshold,
00034 unsigned int TrianglePeakTS,
00035 std::vector<double> LinearThreshold,
00036 std::vector<double> LinearCut,
00037 std::vector<double> RMS8MaxThreshold,
00038 std::vector<double> RMS8MaxCut,
00039 std::vector<double> LeftSlopeThreshold,
00040 std::vector<double> LeftSlopeCut,
00041 std::vector<double> RightSlopeThreshold,
00042 std::vector<double> RightSlopeCut,
00043 std::vector<double> RightSlopeSmallThreshold,
00044 std::vector<double> RightSlopeSmallCut,
00045 std::vector<double> TS4TS5UpperThreshold,
00046 std::vector<double> TS4TS5UpperCut,
00047 std::vector<double> TS4TS5LowerThreshold,
00048 std::vector<double> TS4TS5LowerCut,
00049 bool UseDualFit,
00050 bool TriangleIgnoreSlow);
00051 ~HBHEPulseShapeFlagSetter();
00052 void Clear();
00053 void SetPulseShapeFlags(HBHERecHit& hbhe, const HBHEDataFrame &digi,
00054 const HcalCoder &coder, const HcalCalibrations &calib);
00055 void Initialize();
00056 private:
00057 double mMinimumChargeThreshold;
00058 double mTS4TS5ChargeThreshold;
00059 int mTrianglePeakTS;
00060 std::vector<double> mCharge;
00061
00062 std::vector<std::pair<double, double> > mLambdaLinearCut;
00063 std::vector<std::pair<double, double> > mLambdaRMS8MaxCut;
00064 std::vector<std::pair<double, double> > mLeftSlopeCut;
00065 std::vector<std::pair<double, double> > mRightSlopeCut;
00066 std::vector<std::pair<double, double> > mRightSlopeSmallCut;
00067 std::vector<std::pair<double, double> > mTS4TS5UpperCut;
00068 std::vector<std::pair<double, double> > mTS4TS5LowerCut;
00069 bool mUseDualFit;
00070 bool mTriangleIgnoreSlow;
00071 std::vector<double> CumulativeIdealPulse;
00072 private:
00073 TriangleFitResult PerformTriangleFit(const std::vector<double> &Charge);
00074 double PerformNominalFit(const std::vector<double> &Charge);
00075 double PerformDualNominalFit(const std::vector<double> &Charge);
00076 double DualNominalFitSingleTry(const std::vector<double> &Charge, int Offset, int Distance);
00077 double CalculateRMS8Max(const std::vector<double> &Charge);
00078 double PerformLinearFit(const std::vector<double> &Charge);
00079 private:
00080 bool CheckPassFilter(double Charge, double Discriminant, std::vector<std::pair<double, double> > &Cuts,
00081 int Side);
00082 };
00083
00084 struct TriangleFitResult
00085 {
00086 double Chi2;
00087 double LeftSlope;
00088 double RightSlope;
00089 };
00090
00091 #endif
00092