![]() |
![]() |
00001 #ifndef _RECOMET_METALGORITHMS_HCALNOISEALGO_H_ 00002 #define _RECOMET_METALGORITHMS_HCALNOISEALGO_H_ 00003 00004 #include "DataFormats/METReco/interface/HcalNoiseRBX.h" 00005 #include "DataFormats/Common/interface/RefVector.h" 00006 #include "DataFormats/Common/interface/Ref.h" 00007 #include "DataFormats/Common/interface/RefProd.h" 00008 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" 00009 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00010 00011 class CommonHcalNoiseRBXData { 00012 00013 public: 00014 CommonHcalNoiseRBXData(const reco::HcalNoiseRBX& rbx, double minRecHitE, double minLowHitE, double minHighHitE); 00015 ~CommonHcalNoiseRBXData() {} 00016 00017 // accessors to internal variables 00018 inline double energy(void) const { return energy_; } 00019 inline double ratio(void) const { return e2ts_/e10ts_; } 00020 inline double e2ts(void) const { return e2ts_; } 00021 inline double e10ts(void) const { return e10ts_; } 00022 inline bool validRatio(void) const { return e10ts_!=0.0; } 00023 inline int numHPDHits(void) const { return numHPDHits_; } 00024 inline int numRBXHits(void) const { return numRBXHits_; } 00025 inline int numHPDNoOtherHits(void) const { return numHPDNoOtherHits_; } 00026 inline int numZeros(void) const { return numZeros_; } 00027 inline double minLowEHitTime(void) const { return minLowEHitTime_; } 00028 inline double maxLowEHitTime(void) const { return maxLowEHitTime_; } 00029 inline double lowEHitTimeSqrd(void) const { return lowEHitTimeSqrd_; } 00030 inline int numLowEHits(void) const { return numLowEHits_; } 00031 inline double minHighEHitTime(void) const { return minHighEHitTime_; } 00032 inline double maxHighEHitTime(void) const { return maxHighEHitTime_; } 00033 inline double highEHitTimeSqrd(void) const { return highEHitTimeSqrd_; } 00034 inline int numHighEHits(void) const { return numHighEHits_; } 00035 inline double RBXEMF(void) const { return RBXEMF_; } 00036 inline double HPDEMF(void) const { return HPDEMF_; } 00037 inline edm::RefVector<CaloTowerCollection> rbxTowers(void) const { return rbxtowers_; } 00038 00039 private: 00040 00041 // values 00042 double energy_; // RBX hadronic energy as determined by the sum of calotowers 00043 double e2ts_; // pedestal subtracted charge in two peak TS for RBX 00044 double e10ts_; // pedestal subtracted charge in all 10 TS for RBX 00045 int numHPDHits_; // largest number of hits in an HPD in the RBX 00046 int numRBXHits_; // number of hits in the RBX 00047 int numHPDNoOtherHits_; // largest number of hits in an HPD when no other HPD has a hit in the RBX 00048 int numZeros_; // number of ADC 0 counts in all hits in all TS in the RBX 00049 double minLowEHitTime_; // minimum time found for any low energy hit in the RBX 00050 double maxLowEHitTime_; // maximum time found for any low energy hit in the RBX 00051 double lowEHitTimeSqrd_; // low energy hit time^2 00052 int numLowEHits_; // number of low energy hits 00053 double minHighEHitTime_; // minimum time found for any high energy hit in the RBX 00054 double maxHighEHitTime_; // maximum time found for any high energy hit in the RBX 00055 double highEHitTimeSqrd_; // high energy hit time^2 00056 int numHighEHits_; // number of high energy hits 00057 double HPDEMF_; // minimum electromagnetic fraction found in an HPD in the RBX 00058 double RBXEMF_; // electromagnetic fraction of the RBX 00059 edm::RefVector<CaloTowerCollection> rbxtowers_; // calotowers associated with the RBX 00060 00061 }; 00062 00063 class HcalNoiseAlgo { 00064 00065 public: 00066 00067 HcalNoiseAlgo(const edm::ParameterSet& iConfig); 00068 virtual ~HcalNoiseAlgo() {} 00069 00070 // an rbx is "interesting/problematic" (i.e. is recorded to the event record) 00071 bool isProblematic(const CommonHcalNoiseRBXData&) const; 00072 00073 // an rbx passes a noise filter 00074 bool passLooseNoiseFilter(const CommonHcalNoiseRBXData&) const; 00075 bool passTightNoiseFilter(const CommonHcalNoiseRBXData&) const; 00076 bool passHighLevelNoiseFilter(const CommonHcalNoiseRBXData&) const; 00077 00078 // loose filter broken down into separate components 00079 bool passLooseRatio(const CommonHcalNoiseRBXData&) const; 00080 bool passLooseHits(const CommonHcalNoiseRBXData&) const; 00081 bool passLooseZeros(const CommonHcalNoiseRBXData&) const; 00082 bool passLooseTiming(const CommonHcalNoiseRBXData&) const; 00083 00084 // tight filter broken down into separate components 00085 bool passTightRatio(const CommonHcalNoiseRBXData&) const; 00086 bool passTightHits(const CommonHcalNoiseRBXData&) const; 00087 bool passTightZeros(const CommonHcalNoiseRBXData&) const; 00088 bool passTightTiming(const CommonHcalNoiseRBXData&) const; 00089 00090 // an rbx passes an energy (or other) threshold to test a certain variable 00091 // for instance, the EMF cut might require that the RBX have 20 GeV of energy 00092 bool passRatioThreshold(const CommonHcalNoiseRBXData&) const; 00093 bool passZerosThreshold(const CommonHcalNoiseRBXData&) const; 00094 bool passEMFThreshold(const CommonHcalNoiseRBXData&) const; 00095 00096 00097 private: 00098 00099 // energy thresholds used for problematic cuts 00100 double pMinERatio_; // minimum energy to apply ratio cuts 00101 double pMinEZeros_; // minimum energy to apply zeros cuts 00102 double pMinEEMF_; // minimum energy to apply EMF cuts 00103 00104 // energy thresholds used for loose, tight and high level cuts 00105 double minERatio_; // minimum energy to apply ratio cuts 00106 double minEZeros_; // minimum energy to apply zeros cuts 00107 double minEEMF_; // minimum energy to apply EMF cuts 00108 00109 // "problematic" cuts 00110 // used to determine whether an RBX is stored in the EDM 00111 double pMinE_; // minimum energy 00112 double pMinRatio_; // minimum ratio 00113 double pMaxRatio_; // maximum ratio 00114 int pMinHPDHits_; // minimum # of HPD hits 00115 int pMinRBXHits_; // minimum # of RBX hits 00116 int pMinHPDNoOtherHits_; // minimum # of HPD hits with no other hits in the RBX 00117 int pMinZeros_; // minimum # of zeros 00118 double pMinLowEHitTime_; // minimum low energy hit time 00119 double pMaxLowEHitTime_; // maximum low energy hit time 00120 double pMinHighEHitTime_; // minimum high energy hit time 00121 double pMaxHighEHitTime_; // maximum high energy hit time 00122 double pMaxHPDEMF_; // maximum HPD EMF 00123 double pMaxRBXEMF_; // maximum RBX EMF 00124 00125 // "loose" cuts 00126 // used to determine whether an RBX fails the loose noise cuts 00127 double lMinRatio_; // minimum ratio 00128 double lMaxRatio_; // maximum ratio 00129 int lMinHPDHits_; // minimum # of HPD hits 00130 int lMinRBXHits_; // minimum # of RBX hits 00131 int lMinHPDNoOtherHits_; // minimum # of HPD hits with no other hits in the RBX 00132 int lMinZeros_; // minimum # of zeros 00133 double lMinLowEHitTime_; // minimum low energy hit time 00134 double lMaxLowEHitTime_; // maximum low energy hit time 00135 double lMinHighEHitTime_; // minimum high energy hit time 00136 double lMaxHighEHitTime_; // maximum high energy hit time 00137 00138 // "tight" cuts 00139 // used to determine whether an RBX fails the tight noise cuts 00140 double tMinRatio_; // minimum ratio 00141 double tMaxRatio_; // maximum ratio 00142 int tMinHPDHits_; // minimum # of HPD hits 00143 int tMinRBXHits_; // minimum # of RBX hits 00144 int tMinHPDNoOtherHits_; // minimum # of HPD hits with no other hits in the RBX 00145 int tMinZeros_; // minimum # of zeros 00146 double tMinLowEHitTime_; // minimum low energy hit time 00147 double tMaxLowEHitTime_; // maximum low energy hit time 00148 double tMinHighEHitTime_; // minimum high energy hit time 00149 double tMaxHighEHitTime_; // maximum high energy hit time 00150 00151 // "high level" cuts 00152 // used to determine where an RBX fails the high level noise cuts 00153 double hlMaxHPDEMF_; // maximum HPD EMF 00154 double hlMaxRBXEMF_; // maximum RBX EMF 00155 00156 }; 00157 00158 class JoinCaloTowerRefVectorsWithoutDuplicates 00159 { 00160 public: 00161 JoinCaloTowerRefVectorsWithoutDuplicates() {} 00162 ~JoinCaloTowerRefVectorsWithoutDuplicates() {} 00163 00164 void operator()(edm::RefVector<CaloTowerCollection>& v1, const edm::RefVector<CaloTowerCollection>& v2) const; 00165 00166 private: 00167 00168 // helper function to compare calotower references 00169 struct twrrefcomp { 00170 inline bool operator() ( const edm::Ref<CaloTowerCollection> & t1, const edm::Ref<CaloTowerCollection> & t2 ) { 00171 return t1->id() < t2->id(); 00172 } 00173 }; 00174 typedef std::set< edm::Ref<CaloTowerCollection>, twrrefcomp> twrrefset_t; 00175 }; 00176 00177 00178 #endif