Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:20

0001 //--------------------------------------------------------------------------------------------------
0002 //
0003 // EGammaID Helper
0004 //
0005 // Helper Class to compute HGCal Egamma cluster ID observables
0006 //
0007 // Authors: F. Beaudette, A. Lobanov, N. Smith
0008 //--------------------------------------------------------------------------------------------------
0009 
0010 #ifndef RecoEgamma_EgammaTools_HGCalEgammaIDHelper_h
0011 #define RecoEgamma_EgammaTools_HGCalEgammaIDHelper_h
0012 
0013 #include "FWCore/Framework/interface/Frameworkfwd.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Utilities/interface/InputTag.h"
0017 #include "FWCore/Utilities/interface/ESGetToken.h"
0018 #include "FWCore/Framework/interface/ConsumesCollector.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0022 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0023 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0024 #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h"
0025 
0026 #include "RecoEgamma/EgammaTools/interface/EgammaPCAHelper.h"
0027 #include "RecoEgamma/EgammaTools/interface/LongDeps.h"
0028 #include <vector>
0029 #include "HGCalIsoCalculator.h"
0030 
0031 class HGCalEgammaIDHelper {
0032 public:
0033   HGCalEgammaIDHelper() {}
0034   HGCalEgammaIDHelper(const edm::ParameterSet&, edm::ConsumesCollector&& iC);
0035   ~HGCalEgammaIDHelper() {}
0036 
0037   // Use eventInit once per event
0038   void eventInit(const edm::Event& iEvent, const edm::EventSetup& iSetup);
0039 
0040   // Call computeHGCAL before accessing results below
0041   void computeHGCAL(const reco::Photon& thePhoton, float radius);
0042   void computeHGCAL(const reco::GsfElectron& theElectron, float radius);
0043 
0044   // PCA results
0045   double sigmaUU() const { return pcaHelper_.sigmaUU(); }
0046   double sigmaVV() const { return pcaHelper_.sigmaVV(); }
0047   double sigmaEE() const { return pcaHelper_.sigmaEE(); }
0048   double sigmaPP() const { return pcaHelper_.sigmaPP(); }
0049   const TVectorD& eigenValues() const { return pcaHelper_.eigenValues(); }
0050   const TVectorD& sigmas() const { return pcaHelper_.sigmas(); }
0051   const math::XYZPoint& barycenter() const { return pcaHelper_.barycenter(); }
0052   const math::XYZVector& axis() const { return pcaHelper_.axis(); }
0053 
0054   // longitudinal energy deposits and energy per subdetector as well as layers crossed
0055   hgcal::LongDeps energyPerLayer(float radius, bool withHalo = true) {
0056     return pcaHelper_.energyPerLayer(radius, withHalo);
0057   }
0058 
0059   // shower depth (distance between start and shower max) from ShowerDepth tool
0060   float clusterDepthCompatibility(const hgcal::LongDeps& ld, float& measDepth, float& expDepth, float& expSigma) {
0061     return pcaHelper_.clusterDepthCompatibility(ld, measDepth, expDepth, expSigma);
0062   }
0063 
0064   // projective calo isolation
0065   inline float getIsolationRing(unsigned int ring) const { return isoHelper_.getIso(ring); };
0066 
0067   // for debugging purposes
0068   void printHits(float radius) const { pcaHelper_.printHits(radius); }
0069   const hgcal::EGammaPCAHelper* pcaHelper() const { return &pcaHelper_; }
0070 
0071 private:
0072   edm::InputTag eeRecHitInputTag_;
0073   edm::InputTag fhRecHitInputTag_;
0074   edm::InputTag bhRecHitInputTag_;
0075   edm::InputTag hitMapInputTag_;
0076 
0077   std::vector<double> dEdXWeights_;
0078   hgcal::EGammaPCAHelper pcaHelper_;
0079   HGCalIsoCalculator isoHelper_;
0080   edm::EDGetTokenT<HGCRecHitCollection> recHitsEE_;
0081   edm::EDGetTokenT<HGCRecHitCollection> recHitsFH_;
0082   edm::EDGetTokenT<HGCRecHitCollection> recHitsBH_;
0083   edm::EDGetTokenT<std::unordered_map<DetId, const HGCRecHit*>> hitMap_;
0084   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
0085   hgcal::RecHitTools recHitTools_;
0086   bool debug_;
0087 };
0088 
0089 #endif