File indexing completed on 2024-04-06 12:26:39
0001 #ifndef _RECOMET_METALGORITHMS_HCALNOISEALGO_H_
0002 #define _RECOMET_METALGORITHMS_HCALNOISEALGO_H_
0003
0004 #include "DataFormats/METReco/interface/HcalNoiseRBX.h"
0005 #include "DataFormats/Common/interface/RefVector.h"
0006 #include "DataFormats/Common/interface/Ref.h"
0007 #include "DataFormats/Common/interface/RefProd.h"
0008 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010
0011 class CommonHcalNoiseRBXData {
0012 public:
0013 CommonHcalNoiseRBXData(const reco::HcalNoiseRBX &rbx,
0014 double minRecHitE,
0015 double minLowHitE,
0016 double minHighHitE,
0017 double TS4TS5EnergyThreshold,
0018 std::vector<std::pair<double, double> > const &TS4TS5UpperCut,
0019 std::vector<std::pair<double, double> > const &TS4TS5LowerCut,
0020 double MinRBXRechitR45E);
0021 ~CommonHcalNoiseRBXData() {}
0022
0023
0024 inline double energy(void) const { return energy_; }
0025 inline double ratio(void) const { return e2ts_ / e10ts_; }
0026 inline double e2ts(void) const { return e2ts_; }
0027 inline double e10ts(void) const { return e10ts_; }
0028 inline bool validRatio(void) const { return e10ts_ != 0.0; }
0029 inline int numHPDHits(void) const { return numHPDHits_; }
0030 inline int numRBXHits(void) const { return numRBXHits_; }
0031 inline int numHPDNoOtherHits(void) const { return numHPDNoOtherHits_; }
0032 inline int numZeros(void) const { return numZeros_; }
0033 inline double minLowEHitTime(void) const { return minLowEHitTime_; }
0034 inline double maxLowEHitTime(void) const { return maxLowEHitTime_; }
0035 inline double lowEHitTimeSqrd(void) const { return lowEHitTimeSqrd_; }
0036 inline int numLowEHits(void) const { return numLowEHits_; }
0037 inline double minHighEHitTime(void) const { return minHighEHitTime_; }
0038 inline double maxHighEHitTime(void) const { return maxHighEHitTime_; }
0039 inline double highEHitTimeSqrd(void) const { return highEHitTimeSqrd_; }
0040 inline int numHighEHits(void) const { return numHighEHits_; }
0041 inline double RBXEMF(void) const { return RBXEMF_; }
0042 inline double HPDEMF(void) const { return HPDEMF_; }
0043 inline bool PassTS4TS5(void) const { return TS4TS5Decision_; }
0044 inline edm::RefVector<CaloTowerCollection> rbxTowers(void) const { return rbxtowers_; }
0045 inline int r45Count(void) const { return r45Count_; }
0046 inline double r45Fraction(void) const { return r45Fraction_; }
0047 inline double r45EnergyFraction(void) const { return r45EnergyFraction_; }
0048
0049 bool CheckPassFilter(double Charge,
0050 double Discriminant,
0051 std::vector<std::pair<double, double> > const &Cuts,
0052 int Side);
0053
0054 private:
0055
0056 double energy_;
0057 double e2ts_;
0058 double e10ts_;
0059 int numHPDHits_;
0060 int numRBXHits_;
0061 int numHPDNoOtherHits_;
0062 int numZeros_;
0063 double minLowEHitTime_;
0064 double maxLowEHitTime_;
0065 double lowEHitTimeSqrd_;
0066 int numLowEHits_;
0067 double minHighEHitTime_;
0068 double maxHighEHitTime_;
0069 double highEHitTimeSqrd_;
0070 int numHighEHits_;
0071 double HPDEMF_;
0072 double RBXEMF_;
0073 bool TS4TS5Decision_;
0074 edm::RefVector<CaloTowerCollection> rbxtowers_;
0075 int r45Count_;
0076 double r45Fraction_;
0077 double r45EnergyFraction_;
0078 };
0079
0080 class HcalNoiseAlgo {
0081 public:
0082 HcalNoiseAlgo(const edm::ParameterSet &iConfig);
0083 virtual ~HcalNoiseAlgo() {}
0084
0085
0086 bool isProblematic(const CommonHcalNoiseRBXData &) const;
0087
0088
0089 bool passLooseNoiseFilter(const CommonHcalNoiseRBXData &) const;
0090 bool passTightNoiseFilter(const CommonHcalNoiseRBXData &) const;
0091 bool passHighLevelNoiseFilter(const CommonHcalNoiseRBXData &) const;
0092
0093
0094 bool passLooseRatio(const CommonHcalNoiseRBXData &) const;
0095 bool passLooseHits(const CommonHcalNoiseRBXData &) const;
0096 bool passLooseZeros(const CommonHcalNoiseRBXData &) const;
0097 bool passLooseTiming(const CommonHcalNoiseRBXData &) const;
0098 bool passLooseRBXRechitR45(const CommonHcalNoiseRBXData &) const;
0099
0100
0101 bool passTightRatio(const CommonHcalNoiseRBXData &) const;
0102 bool passTightHits(const CommonHcalNoiseRBXData &) const;
0103 bool passTightZeros(const CommonHcalNoiseRBXData &) const;
0104 bool passTightTiming(const CommonHcalNoiseRBXData &) const;
0105 bool passTightRBXRechitR45(const CommonHcalNoiseRBXData &) const;
0106
0107
0108
0109 bool passRatioThreshold(const CommonHcalNoiseRBXData &) const;
0110 bool passZerosThreshold(const CommonHcalNoiseRBXData &) const;
0111 bool passEMFThreshold(const CommonHcalNoiseRBXData &) const;
0112
0113 private:
0114
0115 double pMinERatio_;
0116 double pMinEZeros_;
0117 double pMinEEMF_;
0118
0119
0120 double minERatio_;
0121 double minEZeros_;
0122 double minEEMF_;
0123
0124
0125
0126 double pMinE_;
0127 double pMinRatio_;
0128 double pMaxRatio_;
0129 int pMinHPDHits_;
0130 int pMinRBXHits_;
0131 int pMinHPDNoOtherHits_;
0132 int pMinZeros_;
0133 double pMinLowEHitTime_;
0134 double pMaxLowEHitTime_;
0135 double pMinHighEHitTime_;
0136 double pMaxHighEHitTime_;
0137 double pMaxHPDEMF_;
0138 double pMaxRBXEMF_;
0139 int pMinRBXRechitR45Count_;
0140 double pMinRBXRechitR45Fraction_;
0141 double pMinRBXRechitR45EnergyFraction_;
0142
0143
0144
0145 double lMinRatio_;
0146 double lMaxRatio_;
0147 int lMinHPDHits_;
0148 int lMinRBXHits_;
0149 int lMinHPDNoOtherHits_;
0150 int lMinZeros_;
0151 double lMinLowEHitTime_;
0152 double lMaxLowEHitTime_;
0153 double lMinHighEHitTime_;
0154 double lMaxHighEHitTime_;
0155 std::vector<double> lMinRBXRechitR45Cuts_;
0156
0157
0158
0159 double tMinRatio_;
0160 double tMaxRatio_;
0161 int tMinHPDHits_;
0162 int tMinRBXHits_;
0163 int tMinHPDNoOtherHits_;
0164 int tMinZeros_;
0165 double tMinLowEHitTime_;
0166 double tMaxLowEHitTime_;
0167 double tMinHighEHitTime_;
0168 double tMaxHighEHitTime_;
0169 std::vector<double> tMinRBXRechitR45Cuts_;
0170
0171
0172
0173 double hlMaxHPDEMF_;
0174 double hlMaxRBXEMF_;
0175 };
0176
0177 class JoinCaloTowerRefVectorsWithoutDuplicates {
0178 public:
0179 JoinCaloTowerRefVectorsWithoutDuplicates() {}
0180 ~JoinCaloTowerRefVectorsWithoutDuplicates() {}
0181
0182 void operator()(edm::RefVector<CaloTowerCollection> &v1, const edm::RefVector<CaloTowerCollection> &v2) const;
0183
0184 private:
0185
0186 struct twrrefcomp {
0187 inline bool operator()(const edm::Ref<CaloTowerCollection> &t1, const edm::Ref<CaloTowerCollection> &t2) const {
0188 return t1->id() < t2->id();
0189 }
0190 };
0191 typedef std::set<edm::Ref<CaloTowerCollection>, twrrefcomp> twrrefset_t;
0192 };
0193
0194 #endif