Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:08

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