CMS 3D CMS Logo

photonIsolationHIProducer.cc
Go to the documentation of this file.
11 
15 
17 
21 
23 public:
24  explicit photonIsolationHIProducer(const edm::ParameterSet& ps);
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28 private:
29  void produce(edm::Event& evt, const edm::EventSetup& es) override;
30 
40 
42 
44 };
45 
47  : photonProducer_(consumes(config.getParameter<edm::InputTag>("photonProducer"))),
48  barrelEcalHits_(consumes(config.getParameter<edm::InputTag>("ebRecHitCollection"))),
49  endcapEcalHits_(consumes(config.getParameter<edm::InputTag>("eeRecHitCollection"))),
50  hbhe_(consumes(config.getParameter<edm::InputTag>("hbhe"))),
51  hf_(consumes(config.getParameter<edm::InputTag>("hf"))),
52  ho_(consumes(config.getParameter<edm::InputTag>("ho"))),
53  barrelClusters_(consumes(config.getParameter<edm::InputTag>("basicClusterBarrel"))),
54  endcapClusters_(consumes(config.getParameter<edm::InputTag>("basicClusterEndcap"))),
55  tracks_(consumes(config.getParameter<edm::InputTag>("trackCollection"))),
56  ecalClusterToolsESGetTokens_{consumesCollector()},
57  trackQuality_(config.getParameter<std::string>("trackQuality")) {
58  produces<reco::HIPhotonIsolationMap>();
59 }
60 
69  evt.getByToken(hbhe_, hbhe);
71  evt.getByToken(hf_, hf);
73  evt.getByToken(ho_, ho);
80 
81  auto outputMap = std::make_unique<reco::HIPhotonIsolationMap>();
83  std::vector<reco::HIPhotonIsolation> isoVector;
84 
86  HcalRechitIsoCalculator RxC(evt, es, hbhe, hf, ho);
89 
90  for (reco::PhotonCollection::const_iterator phoItr = photons->begin(); phoItr != photons->end(); ++phoItr) {
92  // HI-style isolation info
93  iso.ecalClusterIsoR1(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 1, 0));
94  iso.ecalClusterIsoR2(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 2, 0));
95  iso.ecalClusterIsoR3(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 3, 0));
96  iso.ecalClusterIsoR4(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 4, 0));
97  iso.ecalClusterIsoR5(CxC.getBkgSubEcalClusterIso(phoItr->superCluster(), 5, 0));
98 
99  iso.hcalRechitIsoR1(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 1, 0));
100  iso.hcalRechitIsoR2(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 2, 0));
101  iso.hcalRechitIsoR3(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 3, 0));
102  iso.hcalRechitIsoR4(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 4, 0));
103  iso.hcalRechitIsoR5(RxC.getBkgSubHcalRechitIso(phoItr->superCluster(), 5, 0));
104 
105  iso.trackIsoR1PtCut20(TxC.getBkgSubTrackIso(*phoItr, 1, 2));
106  iso.trackIsoR2PtCut20(TxC.getBkgSubTrackIso(*phoItr, 2, 2));
107  iso.trackIsoR3PtCut20(TxC.getBkgSubTrackIso(*phoItr, 3, 2));
108  iso.trackIsoR4PtCut20(TxC.getBkgSubTrackIso(*phoItr, 4, 2));
109  iso.trackIsoR5PtCut20(TxC.getBkgSubTrackIso(*phoItr, 5, 2));
110 
111  // ecal spike rejection info (seed timing)
112  const reco::CaloClusterPtr seed = phoItr->superCluster()->seed();
113  const DetId& id = lazyTool.getMaximum(*seed).first;
114  float time = -999.;
115  const EcalRecHitCollection& rechits = (phoItr->isEB() ? *barrelEcalHits : *endcapEcalHits);
117  if (it != rechits.end()) {
118  time = it->time();
119  }
120  iso.seedTime(time);
121 
122  // ecal spike rejectino info (swiss cross)
123  float eMax = lazyTool.eMax(*seed);
124  float eRight = lazyTool.eRight(*seed);
125  float eLeft = lazyTool.eLeft(*seed);
126  float eTop = lazyTool.eTop(*seed);
127  float eBottom = lazyTool.eBottom(*seed);
128  iso.swissCrx(1 - (eRight + eLeft + eTop + eBottom) / eMax);
129 
130  isoVector.push_back(iso);
131  }
132  filler.insert(photons, isoVector.begin(), isoVector.end());
133  filler.fill();
134  evt.put(std::move(outputMap));
135 }
136 
139 
140  desc.add<edm::InputTag>("photonProducer", edm::InputTag("photons"));
141  desc.add<edm::InputTag>("ebRecHitCollection", edm::InputTag("ecalRecHit:EcalRecHitsEB"));
142  desc.add<edm::InputTag>("eeRecHitCollection", edm::InputTag("ecalRecHit:EcalRecHitsEE"));
143  desc.add<edm::InputTag>("hbhe", edm::InputTag("hbhereco"));
144  desc.add<edm::InputTag>("hf", edm::InputTag("hfreco"));
145  desc.add<edm::InputTag>("ho", edm::InputTag("horeco"));
146  desc.add<edm::InputTag>("basicClusterBarrel", edm::InputTag("islandBasicClusters:islandBarrelBasicClusters"));
147  desc.add<edm::InputTag>("basicClusterEndcap", edm::InputTag("islandBasicClusters:islandEndcapBasicClusters"));
148  desc.add<edm::InputTag>("trackCollection", edm::InputTag("hiGeneralTracks"));
149  desc.add<std::string>("trackQuality", "highPurity");
150 
151  descriptions.add("photonIsolationHIProducer", desc);
152 }
153 
HLT_FULL_cff.endcapClusters
endcapClusters
Definition: HLT_FULL_cff.py:88277
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
photonIsolationHIProducer::produce
void produce(edm::Event &evt, const edm::EventSetup &es) override
Definition: photonIsolationHIProducer.cc:61
MessageLogger.h
photonIsolationHIProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: photonIsolationHIProducer.cc:137
piZeroAnalyzer_cfi.barrelEcalHits
barrelEcalHits
Definition: piZeroAnalyzer_cfi.py:9
ESHandle.h
photonIsolationHIProducer
Definition: photonIsolationHIProducer.cc:22
reco::HIPhotonIsolation::hcalRechitIsoR5
float hcalRechitIsoR5() const
Rechit-based isolation (HCAL) R = 0.5.
Definition: HIPhotonIsolation.h:52
edm::EDGetTokenT< reco::PhotonCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HcalRechitIsoCalculator.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
photonIsolationHIProducer::hf_
edm::EDGetTokenT< HFRecHitCollection > hf_
Definition: photonIsolationHIProducer.cc:35
photonIsolationHIProducer::trackQuality_
std::string trackQuality_
Definition: photonIsolationHIProducer.cc:43
reco::HIPhotonIsolation::trackIsoR1PtCut20
float trackIsoR1PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.1.
Definition: HIPhotonIsolation.h:55
photonIsolationHIProducer::barrelEcalHits_
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
Definition: photonIsolationHIProducer.cc:32
EDProducer.h
edm::SortedCollection< EcalRecHit >
PhotonFwd.h
photonIsolationHIProducer::endcapEcalHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
Definition: photonIsolationHIProducer.cc:33
EcalClusterLazyTools.h
reco::HIPhotonIsolation::hcalRechitIsoR2
float hcalRechitIsoR2() const
Rechit-based isolation (HCAL) R = 0.2.
Definition: HIPhotonIsolation.h:46
edm::Handle< reco::PhotonCollection >
EcalClusterIsoCalculator.h
reco::HIPhotonIsolation::trackIsoR4PtCut20
float trackIsoR4PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.4.
Definition: HIPhotonIsolation.h:61
EcalRecHitCollections.h
piZeroAnalyzer_cfi.endcapEcalHits
endcapEcalHits
Definition: piZeroAnalyzer_cfi.py:10
EcalClusterIsoCalculator
Definition: EcalClusterIsoCalculator.h:17
fileCollector.seed
seed
Definition: fileCollector.py:127
config
Definition: config.py:1
DetId
Definition: DetId.h:17
reco::HIPhotonIsolation::hcalRechitIsoR4
float hcalRechitIsoR4() const
Rechit-based isolation (HCAL) R = 0.4.
Definition: HIPhotonIsolation.h:50
MakerMacros.h
HcalRechitIsoCalculator::getBkgSubHcalRechitIso
double getBkgSubHcalRechitIso(const reco::SuperClusterRef clus, const double i, const double threshold, const double innerR=0.0)
Return the background-subtracted hcal rechit energy in a cone around the SC.
Definition: HcalRechitIsoCalculator.cc:76
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
reco::HIPhotonIsolation::ecalClusterIsoR2
float ecalClusterIsoR2() const
Cluster-based isolation (ECAL) R = 0.2.
Definition: HIPhotonIsolation.h:35
reco::HIPhotonIsolation
Definition: HIPhotonIsolation.h:8
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
photonIsolationHIProducer::photonProducer_
edm::EDGetTokenT< reco::PhotonCollection > photonProducer_
Definition: photonIsolationHIProducer.cc:31
reco::HIPhotonIsolation::ecalClusterIsoR1
float ecalClusterIsoR1() const
Cluster-based isolation (ECAL) R = 0.1.
Definition: HIPhotonIsolation.h:33
reco::HIPhotonIsolation::trackIsoR5PtCut20
float trackIsoR5PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.5.
Definition: HIPhotonIsolation.h:63
reco::HIPhotonIsolation::trackIsoR2PtCut20
float trackIsoR2PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.2.
Definition: HIPhotonIsolation.h:57
reco::HIPhotonIsolation::hcalRechitIsoR1
float hcalRechitIsoR1() const
Rechit-based isolation (HCAL) R = 0.1.
Definition: HIPhotonIsolation.h:44
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
EcalClusterLazyToolsBase::ESGetTokens
Definition: EcalClusterLazyTools.h:53
EcalClusterLazyTools
EDGetToken.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
TrackIsoCalculator.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
photonIsolationHIProducer::barrelClusters_
edm::EDGetTokenT< reco::BasicClusterCollection > barrelClusters_
Definition: photonIsolationHIProducer.cc:37
edm::ParameterSet
Definition: ParameterSet.h:47
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
Event.h
reco::HIPhotonIsolation::ecalClusterIsoR4
float ecalClusterIsoR4() const
Cluster-based isolation (ECAL) R = 0.4.
Definition: HIPhotonIsolation.h:39
cosmicPhotonAnalyzer_cfi.eMax
eMax
Definition: cosmicPhotonAnalyzer_cfi.py:10
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
TrackIsoCalculator
Definition: TrackIsoCalculator.h:8
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
photonIsolationHIProducer_cfi.ho
ho
Definition: photonIsolationHIProducer_cfi.py:10
edm::stream::EDProducer
Definition: EDProducer.h:38
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
edm::EventSetup
Definition: EventSetup.h:57
HcalRechitIsoCalculator
Definition: HcalRechitIsoCalculator.h:19
EcalClusterLazyToolsBase::ESGetTokens::get
ESData get(edm::EventSetup const &eventSetup) const
Definition: EcalClusterLazyTools.h:62
InputTag.h
edm::Ptr< CaloCluster >
HIPhotonIsolation.h
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
HLT_FULL_cff.barrelClusters
barrelClusters
Definition: HLT_FULL_cff.py:88280
photonIsolationHIProducer::ecalClusterToolsESGetTokens_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Definition: photonIsolationHIProducer.cc:41
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
reco::HIPhotonIsolation::ecalClusterIsoR5
float ecalClusterIsoR5() const
Cluster-based isolation (ECAL) R = 0.5.
Definition: HIPhotonIsolation.h:41
eostools.move
def move(src, dest)
Definition: eostools.py:511
photonIsolationHIProducer::hbhe_
edm::EDGetTokenT< HBHERecHitCollection > hbhe_
Definition: photonIsolationHIProducer.cc:34
reco::HIPhotonIsolation::trackIsoR3PtCut20
float trackIsoR3PtCut20() const
Track-based isolation, pt>2.0GeV, R = 0.3.
Definition: HIPhotonIsolation.h:59
reco::HIPhotonIsolation::swissCrx
float swissCrx() const
SwissCross crystal ratio.
Definition: HIPhotonIsolation.h:66
Frameworkfwd.h
reco::HIPhotonIsolation::hcalRechitIsoR3
float hcalRechitIsoR3() const
Rechit-based isolation (HCAL) R = 0.3.
Definition: HIPhotonIsolation.h:48
EventSetup.h
photonIsolationHIProducer::ho_
edm::EDGetTokenT< HORecHitCollection > ho_
Definition: photonIsolationHIProducer.cc:36
EcalClusterIsoCalculator::getBkgSubEcalClusterIso
double getBkgSubEcalClusterIso(const reco::SuperClusterRef clus, const double radius, const double threshold)
Return the background-subtracted ecal cluster energy in a cone around the SC.
Definition: EcalClusterIsoCalculator.cc:93
photonIsolationHIProducer::photonIsolationHIProducer
photonIsolationHIProducer(const edm::ParameterSet &ps)
Definition: photonIsolationHIProducer.cc:46
edm::helper::Filler
Definition: ValueMap.h:22
photonIsolationHIProducer::endcapClusters_
edm::EDGetTokenT< reco::BasicClusterCollection > endcapClusters_
Definition: photonIsolationHIProducer.cc:38
ParameterSet.h
TrackIsoCalculator::getBkgSubTrackIso
double getBkgSubTrackIso(reco::Photon const &clus, const double i, const double threshold, const double innerDR=0)
Return the background-subtracted tracker energy in a cone around the photon.
Definition: TrackIsoCalculator.cc:36
ntuplemaker.time
time
Definition: ntuplemaker.py:310
reco::HIPhotonIsolation::seedTime
float seedTime() const
Ecal rechit seed time.
Definition: HIPhotonIsolation.h:68
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
photonIsolationHIProducer::tracks_
edm::EDGetTokenT< reco::TrackCollection > tracks_
Definition: photonIsolationHIProducer.cc:39
reco::HIPhotonIsolation::ecalClusterIsoR3
float ecalClusterIsoR3() const
Cluster-based isolation (ECAL) R = 0.3.
Definition: HIPhotonIsolation.h:37