CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/RecoMET/METAlgorithms/interface/HcalNoiseAlgo.h

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