CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/DataFormats/METReco/interface/HcalNoiseHPD.h

Go to the documentation of this file.
00001 #ifndef _DATAFORMATS_METRECO_HCALNOISEHPD_H_
00002 #define _DATAFORMATS_METRECO_HCALNOISEHPD_H_
00003 
00004 //
00005 // HcalNoiseHPD.h
00006 //
00007 //   description: Container class of HPD information to study anomalous noise in the HCAL.
00008 //                The information for HcalNoiseHPD's are filled in RecoMET/METProducers/HcalNoiseInfoProducer,
00009 //                but the idnumber is managed by DataFormats/METReco/HcalNoiseRBXArray.
00010 //                Provides relevant digi, rechit, and calotower information.
00011 //
00012 //   author: J.P. Chou, Brown
00013 //
00014 
00015 #include <algorithm>
00016 
00017 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00018 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
00019 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00020 #include "DataFormats/Common/interface/RefVector.h"
00021 #include "DataFormats/Common/interface/Ref.h"
00022 #include "DataFormats/Common/interface/RefProd.h"
00023 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00024 
00025 namespace reco {
00026 
00027   //
00028   // forward declarations
00029   //
00030   
00031   class HcalNoiseHPD;
00032   class RefHBHERecHitEnergyComparison;
00033   
00034   //
00035   // typdefs
00036   //
00037   
00038   typedef std::vector<HcalNoiseHPD> HcalNoiseHPDCollection;
00039   
00040   //
00041   // RefHBHERecHitEnergyComparison is a class functor to compare energies between Ref<HBHERecHitCollection>
00042   //
00043   class RefHBHERecHitEnergyComparison : public std::binary_function<HBHERecHit,HBHERecHit,bool> {
00044   public:
00045     bool operator()(const edm::Ref<HBHERecHitCollection>& x, const edm::Ref<HBHERecHitCollection>& y) const
00046     { return x->energy()>y->energy(); }
00047   };
00048 
00049 
00050   //  
00051   // class definition
00052   //
00053   
00054   class HcalNoiseHPD {
00055     friend class HcalNoiseInfoProducer; // allows this class the fill the HPDs with info
00056     friend class HcalNoiseRBXArray;     // allows this class to manage the idnumber
00057     
00058   public:
00059     // constructor
00060     HcalNoiseHPD();
00061     
00062     // destructor
00063     virtual ~HcalNoiseHPD();
00064 
00065     //
00066     // Detector ID accessors
00067     //
00068     
00069     // unique integer specifier for the hpd [0,NUM_HPDS-1]
00070     // correlates roughly with the detector phi slice
00071     int idnumber(void) const;
00072     
00073     //
00074     // Digi accessors
00075     //
00076     
00077     // pedestal subtracted fC information for the highest energy pixel in the HPD by timeslice
00078     const std::vector<float> bigCharge(void) const;
00079     float bigChargeTotal(void) const;
00080     float bigChargeHighest2TS(unsigned int firstts=4) const;
00081     float bigChargeHighest3TS(unsigned int firstts=4) const;
00082     
00083     // same as above but the integral over the 5 highest energy pixels in the HPD
00084     const std::vector<float> big5Charge(void) const;
00085     float big5ChargeTotal(void) const;
00086     float big5ChargeHighest2TS(unsigned int firstts=4) const;
00087     float big5ChargeHighest3TS(unsigned int firstts=4) const;
00088     
00089     // total number of adc zeros
00090     int totalZeros(void) const;
00091     
00092     // largest number of adc zeros in a digi in the HPD
00093     int maxZeros(void) const;
00094 
00095     //
00096     // RecHit accessors
00097     //
00098 
00099     // returns a reference to a vector of references to the rechits
00100     const edm::RefVector<HBHERecHitCollection> recHits(void) const;
00101     
00102     // integral of rechit energies in the HPD with E>threshold (default is 1.5 GeV)
00103     float recHitEnergy(float threshold=1.5) const;
00104     
00105     // minimum and maximum time for rechits with E>threshold (default is 10.0 GeV)
00106     float minRecHitTime(float threshold=10.0) const;
00107     float maxRecHitTime(float threshold=10.0) const;
00108     
00109     // number of rechits with E>threshold (default is 1.5 GeV)
00110     int numRecHits(float threshold=1.5) const;
00111 
00112     //
00113     // CaloTower accessors
00114     //
00115     
00116     // returns a reference to a vector of references to the calotowers
00117     const edm::RefVector<CaloTowerCollection> caloTowers(void) const;
00118 
00119     // calotower properties integrated over the entire HPD
00120     double caloTowerHadE(void) const;
00121     double caloTowerEmE(void) const;
00122     double caloTowerTotalE(void) const;
00123     double caloTowerEmFraction(void) const;
00124     
00125     
00126   private:
00127 
00128     // unique id number specifying the HPD
00129     int idnumber_;
00130     
00131     // digi data members
00132     int totalZeros_;
00133     int maxZeros_;
00134     std::vector<float> bigCharge_;
00135     std::vector<float> big5Charge_;
00136     
00137     // a vector of references to rechits
00138     edm::RefVector<HBHERecHitCollection> rechits_;
00139 
00140     // a transient set of rechits for sorting purposes
00141     // at some point before storing, these get transfered to the RefVector rechits_
00142     std::set<edm::Ref<HBHERecHitCollection>, RefHBHERecHitEnergyComparison> refrechitset_;
00143 
00144     // a vector of references to calotowers
00145     edm::RefVector<CaloTowerCollection> calotowers_;
00146   };
00147 
00148 } // end of namespace
00149 
00150 #endif