File indexing completed on 2024-10-08 05:11:57
0001 #ifndef EgammaIsolationProducers_EgammaRecHitIsolation_h
0002 #define EgammaIsolationProducers_EgammaRecHitIsolation_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <vector>
0013 #include <functional>
0014
0015
0016 #include "FWCore/Framework/interface/ESHandle.h"
0017 #include "DataFormats/Candidate/interface/Candidate.h"
0018 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0019 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0020 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0021
0022 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
0023
0024 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0025 #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
0026 #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"
0027
0028 class EgammaRecHitIsolation {
0029 public:
0030
0031 EgammaRecHitIsolation(double extRadius,
0032 double intRadius,
0033 double etaSlice,
0034 double etLow,
0035 double eLow,
0036 edm::ESHandle<CaloGeometry>,
0037 const EcalRecHitCollection&,
0038 const EcalSeverityLevelAlgo*,
0039 DetId::Detector detector);
0040
0041 double getEtSum(const reco::Candidate* emObject, EcalPFRecHitThresholds const* thresholds) const {
0042 return getSum_(emObject, true, thresholds);
0043 }
0044 double getEnergySum(const reco::Candidate* emObject, EcalPFRecHitThresholds const* thresholds) const {
0045 return getSum_(emObject, false, thresholds);
0046 }
0047
0048 double getEtSum(const reco::SuperCluster* emObject, EcalPFRecHitThresholds const* thresholds) const {
0049 return getSum_(emObject, true, thresholds);
0050 }
0051 double getEnergySum(const reco::SuperCluster* emObject, EcalPFRecHitThresholds const* thresholds) const {
0052 return getSum_(emObject, false, thresholds);
0053 }
0054
0055 void setUseNumCrystals(bool b = true) { useNumCrystals_ = b; }
0056 void setVetoClustered(bool b = true) { vetoClustered_ = b; }
0057 void doSeverityChecks(const EcalRecHitCollection* const recHits, const std::vector<int>& v) {
0058 ecalBarHits_ = recHits;
0059 severitiesexcl_.clear();
0060 severitiesexcl_.insert(severitiesexcl_.begin(), v.begin(), v.end());
0061 std::sort(severitiesexcl_.begin(), severitiesexcl_.end());
0062 }
0063
0064 void doFlagChecks(const std::vector<int>& v) {
0065 flags_.clear();
0066 flags_.insert(flags_.begin(), v.begin(), v.end());
0067 std::sort(flags_.begin(), flags_.end());
0068 }
0069
0070
0071 ~EgammaRecHitIsolation();
0072
0073 private:
0074 double getSum_(const reco::Candidate*, bool returnEt, const EcalPFRecHitThresholds* thresholds) const;
0075 double getSum_(const reco::SuperCluster*, bool returnEt, const EcalPFRecHitThresholds* thresholds) const;
0076
0077 double extRadius_;
0078 double intRadius_;
0079 double etaSlice_;
0080 double etLow_;
0081 double eLow_;
0082
0083 edm::ESHandle<CaloGeometry> theCaloGeom_;
0084 const EcalRecHitCollection& caloHits_;
0085 const EcalSeverityLevelAlgo* sevLevel_;
0086
0087 bool useNumCrystals_;
0088 bool vetoClustered_;
0089 const EcalRecHitCollection* ecalBarHits_;
0090 std::vector<int> severitiesexcl_;
0091 std::vector<int> flags_;
0092
0093 const CaloSubdetectorGeometry* subdet_[2];
0094 };
0095
0096 #endif