Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  * PhotonIsoProducer.h
0003  *
0004  *  Created on: 13 Oct 2017
0005  *      Author: jkiesele, ncsmith
0006  */
0007 
0008 #ifndef RecoEgamma_EgammaTools_HGCalIsoCalculator_h
0009 #define RecoEgamma_EgammaTools_HGCalIsoCalculator_h
0010 
0011 #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h"
0012 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0013 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
0014 
0015 /*
0016  *
0017  * This class calculates the energy around the photon/electron in DR=0.15 that is
0018  * not associated to the seed cluster.
0019  * The energy is summed in 5 rings (default) between HGCal layer 1 and 30
0020  * This gives back 5 calorimeter isolation values.
0021  * Only the first values should be significantly affected by pileup.
0022  *
0023  * Usage:
0024  *
0025  * PhotonHGCalIsoCalculator prod;
0026  * prod.setRecHitTools(rechittools)
0027  * prod.setRecHits(recHitsEEHandle,recHitsFHHandle,recHitsBHHandle)
0028  *
0029  * <optional>
0030  * prod.setDeltaR(0.15)
0031  * <optional>
0032  * prod.setNRings(5)
0033  * <optional>
0034  * prod.setMinDeltaR(0)
0035  *
0036  * for p in photons
0037  *   prod.produceHGCalIso(p.superCluster()->seed())
0038  *   a=prod.getIso(0)
0039  *   b=prod.getIso(1)
0040  *   c=prod.getIso(2)
0041  *   d=prod.getIso(3)
0042  *   e=prod.getIso(4)
0043  *
0044  *
0045  */
0046 class HGCalIsoCalculator {
0047 public:
0048   HGCalIsoCalculator();
0049 
0050   ~HGCalIsoCalculator();
0051 
0052   void setDeltaR(const float dr) { dr2_ = dr * dr; }
0053 
0054   void setMinDeltaR(const float dr) { mindr2_ = dr * dr; }
0055 
0056   void setRecHitTools(const hgcal::RecHitTools* recHitTools) { rechittools_ = recHitTools; }
0057 
0058   void setNRings(const size_t nrings);
0059 
0060   void setNLayers(unsigned int nLayers) { nlayers_ = nLayers; }
0061 
0062   /// fill - once per event
0063   void setRecHits(edm::Handle<HGCRecHitCollection> hitsEE,
0064                   edm::Handle<HGCRecHitCollection> hitsFH,
0065                   edm::Handle<HGCRecHitCollection> hitsBH);
0066 
0067   void produceHGCalIso(const reco::CaloClusterPtr& seedCluster);
0068 
0069   const float getIso(const unsigned int ring) const;
0070 
0071 private:
0072   std::vector<float> isoringdeposits_;
0073   std::vector<unsigned int> ringasso_;
0074 
0075   float dr2_, mindr2_;
0076 
0077   const hgcal::RecHitTools* rechittools_;
0078   edm::Handle<HGCRecHitCollection> recHitsEE_;
0079   edm::Handle<HGCRecHitCollection> recHitsFH_;
0080   edm::Handle<HGCRecHitCollection> recHitsBH_;
0081   std::vector<std::pair<float, float>> hitEtaPhiCache_;
0082   bool debug_;
0083   unsigned int nlayers_;
0084 };
0085 
0086 #endif /* RecoEgamma_EgammaTools_HGCalIsoCalculator_h */