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 unsigned int TrianglePeakTS,
00034 std::vector<double> LinearThreshold,
00035 std::vector<double> LinearCut,
00036 std::vector<double> RMS8MaxThreshold,
00037 std::vector<double> RMS8MaxCut,
00038 std::vector<double> LeftSlopeThreshold,
00039 std::vector<double> LeftSlopeCut,
00040 std::vector<double> RightSlopeThreshold,
00041 std::vector<double> RightSlopeCut,
00042 std::vector<double> RightSlopeSmallThreshold,
00043 std::vector<double> RightSlopeSmallCut,
00044 bool UseDualFit,
00045 bool TriangleIgnoreSlow);
00046 ~HBHEPulseShapeFlagSetter();
00047 void Clear();
00048 void SetPulseShapeFlags(HBHERecHit& hbhe, const HBHEDataFrame &digi,
00049 const HcalCoder &coder, const HcalCalibrations &calib);
00050 void Initialize();
00051 private:
00052 double mMinimumChargeThreshold;
00053 int mTrianglePeakTS;
00054 std::vector<double> mCharge;
00055
00056 std::vector<std::pair<double, double> > mLambdaLinearCut;
00057 std::vector<std::pair<double, double> > mLambdaRMS8MaxCut;
00058 std::vector<std::pair<double, double> > mLeftSlopeCut;
00059 std::vector<std::pair<double, double> > mRightSlopeCut;
00060 std::vector<std::pair<double, double> > mRightSlopeSmallCut;
00061 bool mUseDualFit;
00062 bool mTriangleIgnoreSlow;
00063 std::vector<double> CumulativeIdealPulse;
00064 private:
00065 TriangleFitResult PerformTriangleFit(const std::vector<double> &Charge);
00066 double PerformNominalFit(const std::vector<double> &Charge);
00067 double PerformDualNominalFit(const std::vector<double> &Charge);
00068 double DualNominalFitSingleTry(const std::vector<double> &Charge, int Offset, int Distance);
00069 double CalculateRMS8Max(const std::vector<double> &Charge);
00070 double PerformLinearFit(const std::vector<double> &Charge);
00071 private:
00072 bool CheckPassFilter(double Charge, double Discriminant, std::vector<std::pair<double, double> > &Cuts,
00073 int Side);
00074 };
00075
00076 struct TriangleFitResult
00077 {
00078 double Chi2;
00079 double LeftSlope;
00080 double RightSlope;
00081 };
00082
00083 #endif
00084