Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-08 05:11:59

0001 /** \class PhotonMVABasedHaloTagger
0002  *   \author Shilpi Jain (University of Minnesota)
0003  * Links to the presentation: 
0004  1. ECAL DPG: https://indico.cern.ch/event/991261/contributions/4283096/attachments/2219229/3757719/beamHalo_31march_v1.pdf
0005  2. JetMET POG: https://indico.cern.ch/event/1027614/contributions/4314949/attachments/2224472/3767396/beamHalo_12April.pdf
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   ///values of dR etc to cluster the hits in various sub-detectors
0094   static constexpr float dr2Max_ECALClus_ = 0.2 * 0.2;
0095   static constexpr float rho2Min_ECALpos_ = 31 * 31;            //cm
0096   static constexpr float rho2Max_ECALpos_ = 172 * 172;          //cm
0097   static constexpr float dRho2Max_HCALClus_SamePhi_ = 26 * 26;  //cm
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;  //cm
0101   static constexpr float dXY_ESClus_SamePhi_ = 1;       ///cm
0102   static constexpr float dXY_ESClus_SamedR_ = 1;        ///cm
0103 };
0104 
0105 #endif  // PhotonMVABasedHaloTagger_H