Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-15 08:47:52

0001 #ifndef ElectronHcalHelper_h
0002 #define ElectronHcalHelper_h
0003 
0004 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0005 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0010 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0011 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h"
0012 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHadTower.h"
0013 #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
0014 #include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h"
0015 
0016 class ConsumesCollector;
0017 class EgammaHadTower;
0018 class HcalTopology;
0019 class HcalChannelQuality;
0020 class HcalHcalSeverityLevelComputer;
0021 class CaloTowerConstituentsMap;
0022 
0023 class ElectronHcalHelper {
0024 public:
0025   struct Configuration {
0026     // common parameters
0027     double hOverEConeSize;
0028 
0029     // strategy
0030     bool onlyBehindCluster, checkHcalStatus;
0031 
0032     // specific parameters if use rechits
0033     edm::EDGetTokenT<HBHERecHitCollection> hbheRecHits;
0034 
0035     EgammaHcalIsolation::arrayHB eThresHB;
0036     int maxSeverityHB;
0037     EgammaHcalIsolation::arrayHE eThresHE;
0038     int maxSeverityHE;
0039   };
0040 
0041   ElectronHcalHelper(const Configuration &cfg, edm::ConsumesCollector &&cc);
0042 
0043   void beginEvent(const edm::Event &evt, const edm::EventSetup &eventSetup);
0044 
0045   inline auto hcalTowersBehindClusters(const reco::SuperCluster &sc) const { return egamma::towersOf(sc, *towerMap_); }
0046   double hcalESum(const reco::SuperCluster &, int depth) const;
0047   double hOverEConeSize() const { return cfg_.hOverEConeSize; }
0048   int maxSeverityHB() const { return cfg_.maxSeverityHB; }
0049   int maxSeverityHE() const { return cfg_.maxSeverityHE; }
0050 
0051   // forward EgammaHadTower methods, if checkHcalStatus is enabled, using towers and H/E
0052   bool hasActiveHcal(const reco::SuperCluster &sc) const;
0053 
0054   // QoL when one needs raw instances of EgammaHcalIsolation in addition to this class
0055   const auto hcalTopology() const { return hcalTopology_; }
0056   const auto hcalChannelQuality() const { return hcalChannelQuality_; }
0057   const auto hcalSevLvlComputer() const { return hcalSevLvlComputer_; }
0058   const auto towerMap() const { return towerMap_; }
0059 
0060 private:
0061   const Configuration cfg_;
0062 
0063   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;
0064   edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> hcalTopologyToken_;
0065   edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> hcalChannelQualityToken_;
0066   edm::ESGetToken<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd> hcalSevLvlComputerToken_;
0067   edm::ESGetToken<CaloTowerConstituentsMap, CaloGeometryRecord> towerMapToken_;
0068 
0069   // event data (rechits strategy)
0070   std::unique_ptr<EgammaHcalIsolation> hcalIso_;
0071   HcalTopology const *hcalTopology_ = nullptr;
0072   HcalChannelQuality const *hcalChannelQuality_ = nullptr;
0073   HcalSeverityLevelComputer const *hcalSevLvlComputer_ = nullptr;
0074   CaloTowerConstituentsMap const *towerMap_ = nullptr;
0075 };
0076 
0077 #endif