File indexing completed on 2024-10-08 05:11:59
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef RecoEgamma_PhotonIdentification_PhotonMVABasedHaloTagger_h
0009 #define RecoEgamma_PhotonIdentification_PhotonMVABasedHaloTagger_h
0010
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0015 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0016 #include "FWCore/Framework/interface/ConsumesCollector.h"
0017 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0018 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0019 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0020 #include "CondFormats/GBRForest/interface/GBRForest.h"
0021 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
0022 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h"
0023 #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
0024 #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"
0025 #include <vector>
0026
0027 class PhotonMVABasedHaloTagger {
0028 public:
0029 PhotonMVABasedHaloTagger(const edm::ParameterSet& conf, edm::ConsumesCollector&& iC);
0030
0031 double calculateMVA(const reco::Photon* pho,
0032 const GBRForest* gbr_,
0033 const edm::Event& iEvent,
0034 const edm::EventSetup& es) const;
0035
0036 private:
0037 struct CalClus {
0038 double x_ = 0.;
0039 double y_ = 0.;
0040 double z_ = 0.;
0041 double e_ = 0.;
0042 int nHits_ = 0;
0043 };
0044
0045 struct HcalHyp {
0046 CalClus samedPhi_;
0047 CalClus samedR_;
0048 };
0049
0050 struct PreshowerHyp {
0051 CalClus samedPhi_;
0052 CalClus samedR_;
0053 };
0054
0055 struct EcalClus {
0056 double x_ = 0.;
0057 double y_ = 0.;
0058 double z_ = 0.;
0059 double e_ = 0.;
0060 int nHits_ = 0;
0061 };
0062
0063 PreshowerHyp calmatchedESCoordForBothHypothesis(const CaloGeometry& geo,
0064 const reco::Photon*,
0065 const EcalRecHitCollection& ESRecHits,
0066 const EcalClus& ecalClus) const;
0067
0068 EcalClus calphoClusCoordinECAL(const CaloGeometry& geo,
0069 const reco::Photon*,
0070 const EcalPFRecHitThresholds* thresholds,
0071 const EcalRecHitCollection& ecalRecHits) const;
0072 HcalHyp calmatchedHBHECoordForBothHypothesis(const CaloGeometry& geo,
0073 const reco::Photon*,
0074 const HBHERecHitCollection& HBHERecHits,
0075 const EcalClus& ecalClus) const;
0076 double calAngleBetweenEEAndSubDet(CalClus const& subdet, EcalClus const&) const;
0077
0078 double noiseThrES_;
0079
0080 EgammaHcalIsolation::arrayHB recHitEThresholdHB_;
0081 EgammaHcalIsolation::arrayHE recHitEThresholdHE_;
0082
0083 const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geometryToken_;
0084 const edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> ecalPFRechitThresholdsToken_;
0085 const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_;
0086
0087 edm::EDGetTokenT<double> rhoLabel_;
0088 edm::EDGetTokenT<EcalRecHitCollection> EBecalCollection_;
0089 edm::EDGetTokenT<EcalRecHitCollection> EEecalCollection_;
0090 edm::EDGetTokenT<EcalRecHitCollection> ESCollection_;
0091 edm::EDGetTokenT<HBHERecHitCollection> HBHERecHitsCollection_;
0092
0093
0094 static constexpr float dr2Max_ECALClus_ = 0.2 * 0.2;
0095 static constexpr float rho2Min_ECALpos_ = 31 * 31;
0096 static constexpr float rho2Max_ECALpos_ = 172 * 172;
0097 static constexpr float dRho2Max_HCALClus_SamePhi_ = 26 * 26;
0098 static constexpr float dPhiMax_HCALClus_SamePhi_ = 0.15;
0099 static constexpr float dR2Max_HCALClus_SamePhi_ = 0.15 * 0.15;
0100 static constexpr float dRho2Max_ESClus_ = 2.2 * 2.2;
0101 static constexpr float dXY_ESClus_SamePhi_ = 1;
0102 static constexpr float dXY_ESClus_SamedR_ = 1;
0103 };
0104
0105 #endif