Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:06

0001 #ifndef _DATAFORMATS_METRECO_HCALNOISEHPD_H_
0002 #define _DATAFORMATS_METRECO_HCALNOISEHPD_H_
0003 
0004 //
0005 // HcalNoiseHPD.h
0006 //
0007 //   description: Container class of HPD information to study anomalous noise in the HCAL.
0008 //                The information for HcalNoiseHPD's are filled in RecoMET/METProducers/HcalNoiseInfoProducer,
0009 //                but the idnumber is managed by DataFormats/METReco/HcalNoiseRBXArray.
0010 //                Provides relevant digi, rechit, and calotower information.
0011 //
0012 //   author: J.P. Chou, Brown
0013 //
0014 
0015 #include <algorithm>
0016 
0017 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0018 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0019 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0020 #include "DataFormats/HcalRecHit/interface/HBHERecHitAuxSetter.h"
0021 #include "DataFormats/HcalRecHit/interface/CaloRecHitAuxSetter.h"
0022 #include "DataFormats/Common/interface/RefVector.h"
0023 #include "DataFormats/Common/interface/Ref.h"
0024 #include "DataFormats/Common/interface/RefProd.h"
0025 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0026 #include "DataFormats/METReco/interface/HcalCaloFlagLabels.h"
0027 
0028 namespace reco {
0029 
0030   //
0031   // forward declarations
0032   //
0033 
0034   class HcalNoiseHPD;
0035   class RefHBHERecHitEnergyComparison;
0036 
0037   //
0038   // typdefs
0039   //
0040 
0041   typedef std::vector<HcalNoiseHPD> HcalNoiseHPDCollection;
0042 
0043   //
0044   // RefHBHERecHitEnergyComparison is a class functor to compare energies between Ref<HBHERecHitCollection>
0045   //
0046   class RefHBHERecHitEnergyComparison {
0047   public:
0048     bool operator()(const edm::Ref<HBHERecHitCollection>& x, const edm::Ref<HBHERecHitCollection>& y) const {
0049       return x->energy() > y->energy();
0050     }
0051   };
0052 
0053   //
0054   // class definition
0055   //
0056 
0057   class HcalNoiseHPD {
0058     friend class HcalNoiseInfoProducer;  // allows this class the fill the HPDs with info
0059     friend class HcalNoiseRBXArray;      // allows this class to manage the idnumber
0060 
0061   public:
0062     // constructor
0063     HcalNoiseHPD();
0064 
0065     // destructor
0066     virtual ~HcalNoiseHPD();
0067 
0068     //
0069     // Detector ID accessors
0070     //
0071 
0072     // unique integer specifier for the hpd [0,NUM_HPDS-1]
0073     // correlates roughly with the detector phi slice
0074     int idnumber(void) const;
0075 
0076     //
0077     // Digi accessors
0078     //
0079 
0080     // pedestal subtracted fC information for the highest energy pixel in the HPD by timeslice
0081     const std::vector<float> bigCharge(void) const;
0082     float bigChargeTotal(void) const;
0083     float bigChargeHighest2TS(unsigned int firstts = 4) const;
0084     float bigChargeHighest3TS(unsigned int firstts = 4) const;
0085 
0086     // same as above but the integral over the 5 highest energy pixels in the HPD
0087     const std::vector<float> big5Charge(void) const;
0088     float big5ChargeTotal(void) const;
0089     float big5ChargeHighest2TS(unsigned int firstts = 4) const;
0090     float big5ChargeHighest3TS(unsigned int firstts = 4) const;
0091 
0092     // total number of adc zeros
0093     int totalZeros(void) const;
0094 
0095     // largest number of adc zeros in a digi in the HPD
0096     int maxZeros(void) const;
0097 
0098     //
0099     // RecHit accessors
0100     //
0101 
0102     // returns a reference to a vector of references to the rechits
0103     const edm::RefVector<HBHERecHitCollection> recHits(void) const;
0104 
0105     // integral of rechit energies in the HPD with E>threshold (default is 1.5 GeV)
0106     float recHitEnergy(float threshold = 1.5) const;
0107     float recHitEnergyFailR45(float threshold = 1.5) const;
0108 
0109     // minimum and maximum time for rechits with E>threshold (default is 10.0 GeV)
0110     float minRecHitTime(float threshold = 10.0) const;
0111     float maxRecHitTime(float threshold = 10.0) const;
0112 
0113     // number of rechits with E>threshold (default is 1.5 GeV)
0114     int numRecHits(float threshold = 1.5) const;
0115     int numRecHitsFailR45(float threshold = 1.5) const;
0116 
0117     //
0118     // CaloTower accessors
0119     //
0120 
0121     // returns a reference to a vector of references to the calotowers
0122     const edm::RefVector<CaloTowerCollection> caloTowers(void) const;
0123 
0124     // calotower properties integrated over the entire HPD
0125     double caloTowerHadE(void) const;
0126     double caloTowerEmE(void) const;
0127     double caloTowerTotalE(void) const;
0128     double caloTowerEmFraction(void) const;
0129 
0130   private:
0131     // unique id number specifying the HPD
0132     int idnumber_;
0133 
0134     // digi data members
0135     int totalZeros_;
0136     int maxZeros_;
0137     std::vector<float> bigCharge_;
0138     std::vector<float> big5Charge_;
0139 
0140     // a vector of references to rechits
0141     edm::RefVector<HBHERecHitCollection> rechits_;
0142 
0143     // a transient set of rechits for sorting purposes
0144     // at some point before storing, these get transfered to the RefVector rechits_
0145     std::set<edm::Ref<HBHERecHitCollection>, RefHBHERecHitEnergyComparison> refrechitset_;
0146 
0147     // a vector of references to calotowers
0148     edm::RefVector<CaloTowerCollection> calotowers_;
0149   };
0150 
0151 }  // namespace reco
0152 
0153 #endif