Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-10 10:03:06

0001 #ifndef PhotonIsolationCalculator_H
0002 #define PhotonIsolationCalculator_H
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0008 #include "FWCore/Utilities/interface/Visibility.h"
0009 
0010 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0011 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0012 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0013 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0014 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h"
0015 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h"
0016 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
0017 #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
0018 
0019 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0020 
0021 #include <vector>
0022 
0023 #include "FWCore/Framework/interface/ConsumesCollector.h"
0024 #include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h"
0025 
0026 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h"
0027 
0028 class EcalSeverityLevelAlgo;
0029 class EcalSeverityLevelAlgoRcd;
0030 
0031 class PhotonIsolationCalculator {
0032 public:
0033   PhotonIsolationCalculator() {}
0034 
0035   ~PhotonIsolationCalculator() {}
0036 
0037   void setup(const edm::ParameterSet& conf,
0038              std::vector<int> const& flagsEB_,
0039              std::vector<int> const& flagsEE_,
0040              std::vector<int> const& severitiesEB_,
0041              std::vector<int> const& severitiesEE_,
0042              edm::ConsumesCollector&& iC);
0043 
0044   void calculate(const reco::Photon*,
0045                  const edm::Event&,
0046                  const edm::EventSetup& es,
0047                  reco::Photon::FiducialFlags& phofid,
0048                  reco::Photon::IsolationVariables& phoisolR03,
0049                  reco::Photon::IsolationVariables& phoisolR04) const;
0050 
0051 private:
0052   static void classify(const reco::Photon* photon,
0053                        bool& isEBPho,
0054                        bool& isEEPho,
0055                        bool& isEBEtaGap,
0056                        bool& isEBPhiGap,
0057                        bool& isEERingGap,
0058                        bool& isEEDeeGap,
0059                        bool& isEBEEGap) dso_internal;
0060 
0061   void calculateTrackIso(const reco::Photon* photon,
0062                          const edm::Event& e,
0063                          double& trkCone,
0064                          int& ntrkCone,
0065                          double pTThresh = 0,
0066                          double RCone = .4,
0067                          double RinnerCone = .1,
0068                          double etaSlice = 0.015,
0069                          double lip = 0.2,
0070                          double d0 = 0.1) const dso_internal;
0071 
0072   double calculateEcalRecHitIso(const reco::Photon* photon,
0073                                 const edm::Event& iEvent,
0074                                 const edm::EventSetup& iSetup,
0075                                 double RCone,
0076                                 double RConeInner,
0077                                 double etaSlice,
0078                                 double eMin,
0079                                 double etMin,
0080                                 bool vetoClusteredHits,
0081                                 bool useNumCrystals) const dso_internal;
0082 
0083   template <bool isoBC>
0084   double calculateHcalRecHitIso(const reco::Photon* photon,
0085                                 const CaloGeometry& geometry,
0086                                 const HcalTopology& hcalTopology,
0087                                 const HcalChannelQuality& hcalChStatus,
0088                                 const HcalSeverityLevelComputer& hcalSevLvlComputer,
0089                                 const CaloTowerConstituentsMap& towerMap,
0090                                 const HBHERecHitCollection& hbheRecHits,
0091                                 double RCone,
0092                                 double RConeInner,
0093                                 int depth) const dso_internal;
0094 
0095 private:
0096   edm::EDGetToken barrelecalCollection_;
0097   edm::EDGetToken endcapecalCollection_;
0098   edm::EDGetTokenT<HBHERecHitCollection> hbheRecHitsTag_;
0099 
0100   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;
0101   edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> hcalTopologyToken_;
0102   edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> hcalChannelQualityToken_;
0103   edm::ESGetToken<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd> hcalSevLvlComputerToken_;
0104   edm::ESGetToken<CaloTowerConstituentsMap, CaloGeometryRecord> towerMapToken_;
0105   edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> ecalSevLvlToken_;
0106 
0107   edm::EDGetToken trackInputTag_;
0108   edm::EDGetToken beamSpotProducerTag_;
0109   double modulePhiBoundary_;
0110   std::vector<double> moduleEtaBoundary_;
0111   bool vetoClusteredEcalHits_;
0112   bool useNumCrystals_;
0113 
0114   std::array<double, 6> trkIsoBarrelRadiusA_;
0115   std::array<double, 5> ecalIsoBarrelRadiusA_;
0116   std::array<double, 6> trkIsoBarrelRadiusB_;
0117   std::array<double, 5> ecalIsoBarrelRadiusB_;
0118 
0119   std::array<double, 6> trkIsoEndcapRadiusA_;
0120   std::array<double, 5> ecalIsoEndcapRadiusA_;
0121   std::array<double, 6> trkIsoEndcapRadiusB_;
0122   std::array<double, 5> ecalIsoEndcapRadiusB_;
0123 
0124   std::array<double, 7> hcalIsoInnerRadAEB_;
0125   std::array<double, 7> hcalIsoOuterRadAEB_;
0126 
0127   std::array<double, 7> hcalIsoInnerRadBEB_;
0128   std::array<double, 7> hcalIsoOuterRadBEB_;
0129 
0130   std::array<double, 7> hcalIsoInnerRadAEE_;
0131   std::array<double, 7> hcalIsoOuterRadAEE_;
0132 
0133   std::array<double, 7> hcalIsoInnerRadBEE_;
0134   std::array<double, 7> hcalIsoOuterRadBEE_;
0135 
0136   EgammaHcalIsolation::arrayHB hcalIsoEThresHB_;
0137   EgammaHcalIsolation::arrayHE hcalIsoEThresHE_;
0138   int maxHcalSeverity_;
0139 
0140   std::vector<int> flagsEB_;
0141   std::vector<int> flagsEE_;
0142   std::vector<int> severityExclEB_;
0143   std::vector<int> severityExclEE_;
0144 };
0145 
0146 #endif  // PhotonIsolationCalculator_H