Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-08 23:09:55

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 #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
0028 #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"
0029 
0030 class EcalSeverityLevelAlgo;
0031 class EcalSeverityLevelAlgoRcd;
0032 
0033 class PhotonIsolationCalculator {
0034 public:
0035   PhotonIsolationCalculator(const edm::ParameterSet& conf,
0036                             std::vector<int> const& flagsEB_,
0037                             std::vector<int> const& flagsEE_,
0038                             std::vector<int> const& severitiesEB_,
0039                             std::vector<int> const& severitiesEE_,
0040                             edm::ConsumesCollector&& iC);
0041 
0042   ~PhotonIsolationCalculator() = default;
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,
0050                  const HcalPFCuts* hcalCuts) const;
0051 
0052 private:
0053   static void classify(const reco::Photon* photon,
0054                        bool& isEBPho,
0055                        bool& isEEPho,
0056                        bool& isEBEtaGap,
0057                        bool& isEBPhiGap,
0058                        bool& isEERingGap,
0059                        bool& isEEDeeGap,
0060                        bool& isEBEEGap) dso_internal;
0061 
0062   void calculateTrackIso(const reco::Photon* photon,
0063                          const edm::Event& e,
0064                          double& trkCone,
0065                          int& ntrkCone,
0066                          double pTThresh = 0,
0067                          double RCone = .4,
0068                          double RinnerCone = .1,
0069                          double etaSlice = 0.015,
0070                          double lip = 0.2,
0071                          double d0 = 0.1) const dso_internal;
0072 
0073   double calculateEcalRecHitIso(const reco::Photon* photon,
0074                                 const edm::Event& iEvent,
0075                                 const edm::EventSetup& iSetup,
0076                                 double RCone,
0077                                 double RConeInner,
0078                                 double etaSlice,
0079                                 double eMin,
0080                                 double etMin,
0081                                 bool vetoClusteredHits,
0082                                 bool useNumCrystals) const dso_internal;
0083 
0084   template <bool isoBC>
0085   double calculateHcalRecHitIso(const reco::Photon* photon,
0086                                 const CaloGeometry& geometry,
0087                                 const HcalTopology& hcalTopology,
0088                                 const HcalChannelQuality& hcalChStatus,
0089                                 const HcalSeverityLevelComputer& hcalSevLvlComputer,
0090                                 const CaloTowerConstituentsMap& towerMap,
0091                                 const HBHERecHitCollection& hbheRecHits,
0092                                 double RCone,
0093                                 double RConeInner,
0094                                 int depth,
0095                                 const HcalPFCuts* hcalCuts) const dso_internal;
0096 
0097 private:
0098   edm::EDGetToken barrelecalCollection_;
0099   edm::EDGetToken endcapecalCollection_;
0100   edm::EDGetTokenT<HBHERecHitCollection> hbheRecHitsTag_;
0101 
0102   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;
0103   edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> hcalTopologyToken_;
0104   edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> hcalChannelQualityToken_;
0105   edm::ESGetToken<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd> hcalSevLvlComputerToken_;
0106   edm::ESGetToken<CaloTowerConstituentsMap, CaloGeometryRecord> towerMapToken_;
0107   edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> ecalSevLvlToken_;
0108   edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> ecalPFRechitThresholdsToken_;
0109 
0110   edm::EDGetToken trackInputTag_;
0111   edm::EDGetToken beamSpotProducerTag_;
0112   double modulePhiBoundary_;
0113   std::vector<double> moduleEtaBoundary_;
0114   bool vetoClusteredEcalHits_;
0115   bool useNumCrystals_;
0116 
0117   std::array<double, 6> trkIsoBarrelRadiusA_;
0118   std::array<double, 5> ecalIsoBarrelRadiusA_;
0119   std::array<double, 6> trkIsoBarrelRadiusB_;
0120   std::array<double, 5> ecalIsoBarrelRadiusB_;
0121 
0122   std::array<double, 6> trkIsoEndcapRadiusA_;
0123   std::array<double, 5> ecalIsoEndcapRadiusA_;
0124   std::array<double, 6> trkIsoEndcapRadiusB_;
0125   std::array<double, 5> ecalIsoEndcapRadiusB_;
0126 
0127   std::array<double, 7> hcalIsoInnerRadAEB_;
0128   std::array<double, 7> hcalIsoOuterRadAEB_;
0129 
0130   std::array<double, 7> hcalIsoInnerRadBEB_;
0131   std::array<double, 7> hcalIsoOuterRadBEB_;
0132 
0133   std::array<double, 7> hcalIsoInnerRadAEE_;
0134   std::array<double, 7> hcalIsoOuterRadAEE_;
0135 
0136   std::array<double, 7> hcalIsoInnerRadBEE_;
0137   std::array<double, 7> hcalIsoOuterRadBEE_;
0138 
0139   EgammaHcalIsolation::arrayHB hcalIsoEThresHB_;
0140   EgammaHcalIsolation::arrayHE hcalIsoEThresHE_;
0141   int maxHcalSeverity_;
0142 
0143   std::vector<int> flagsEB_;
0144   std::vector<int> flagsEE_;
0145   std::vector<int> severityExclEB_;
0146   std::vector<int> severityExclEE_;
0147 };
0148 
0149 #endif  // PhotonIsolationCalculator_H