CMS 3D CMS Logo

ReducedEGProducer.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <vector>
3 #include <memory>
4 #include <unordered_set>
5 
6 // Framework
9 
11 
15 
28 
31 
34 
37 
39 
41 
43  : photonT_(consumes<reco::PhotonCollection>(config.getParameter<edm::InputTag>("photons"))),
44  gsfElectronT_(consumes<reco::GsfElectronCollection>(config.getParameter<edm::InputTag>("gsfElectrons"))),
45  gsfTrackT_(consumes<reco::GsfTrackCollection>(config.getParameter<edm::InputTag>("gsfTracks"))),
46  conversionT_(consumes<reco::ConversionCollection>(config.getParameter<edm::InputTag>("conversions"))),
47  singleConversionT_(consumes<reco::ConversionCollection>(config.getParameter<edm::InputTag>("singleConversions"))),
48  barrelEcalHits_(consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("barrelEcalHits"))),
49  endcapEcalHits_(consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("endcapEcalHits"))),
50  doPreshowerEcalHits_(!config.getParameter<edm::InputTag>("preshowerEcalHits").label().empty()),
51  preshowerEcalHits_(doPreshowerEcalHits_
52  ? consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("preshowerEcalHits"))
53  : edm::EDGetTokenT<EcalRecHitCollection>()),
54  hbheHits_(consumes<HBHERecHitCollection>(config.getParameter<edm::InputTag>("hbheHits"))),
55  photonPfCandMapT_(consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
56  config.getParameter<edm::InputTag>("photonsPFValMap"))),
57  gsfElectronPfCandMapT_(consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
58  config.getParameter<edm::InputTag>("gsfElectronsPFValMap"))),
59  recoHIPhotonIsolationMapInputToken_{
60  !config.getParameter<edm::InputTag>("hiPhotonIsolationMapInput").label().empty()
61  ? consumes<reco::HIPhotonIsolationMap>(config.getParameter<edm::InputTag>("hiPhotonIsolationMapInput"))
63  recoHIPhotonIsolationMapOutputName_{!recoHIPhotonIsolationMapInputToken_.isUninitialized()
64  ? config.getParameter<std::string>("hiPhotonIsolationMapOutput")
65  : std::string{}},
66  //calibration flags
67  applyPhotonCalibOnData_(config.getParameter<bool>("applyPhotonCalibOnData")),
68  applyPhotonCalibOnMC_(config.getParameter<bool>("applyPhotonCalibOnMC")),
69  applyGsfElectronCalibOnData_(config.getParameter<bool>("applyGsfElectronCalibOnData")),
70  applyGsfElectronCalibOnMC_(config.getParameter<bool>("applyGsfElectronCalibOnMC")),
71  //output collections
72  outPhotons_("reducedGedPhotons"),
73  outPhotonCores_("reducedGedPhotonCores"),
74  outOOTPhotons_("reducedOOTPhotons"),
75  outOOTPhotonCores_("reducedOOTPhotonCores"),
76  outGsfElectrons_("reducedGedGsfElectrons"),
77  outGsfElectronCores_("reducedGedGsfElectronCores"),
78  outGsfTracks_("reducedGsfTracks"),
79  outConversions_("reducedConversions"),
80  outSingleConversions_("reducedSingleLegConversions"),
81  outSuperClusters_("reducedSuperClusters"),
82  outEBEEClusters_("reducedEBEEClusters"),
83  outESClusters_("reducedESClusters"),
84  outOOTSuperClusters_("reducedOOTSuperClusters"),
85  outOOTEBEEClusters_("reducedOOTEBEEClusters"),
86  outOOTESClusters_("reducedOOTESClusters"),
87  outEBRecHits_("reducedEBRecHits"),
88  outEERecHits_("reducedEERecHits"),
89  outESRecHits_("reducedESRecHits"),
90  outHBHERecHits_("reducedHBHEHits"),
91  outPhotonPfCandMap_("reducedPhotonPfCandMap"),
92  outGsfElectronPfCandMap_("reducedGsfElectronPfCandMap"),
93  outPhotonIds_(config.getParameter<std::vector<std::string>>("photonIDOutput")),
94  outGsfElectronIds_(config.getParameter<std::vector<std::string>>("gsfElectronIDOutput")),
95  outPhotonFloatValueMaps_(config.getParameter<std::vector<std::string>>("photonFloatValueMapOutput")),
96  outOOTPhotonFloatValueMaps_(config.getParameter<std::vector<std::string>>("ootPhotonFloatValueMapOutput")),
97  outGsfElectronFloatValueMaps_(config.getParameter<std::vector<std::string>>("gsfElectronFloatValueMapOutput")),
98  keepPhotonSel_(config.getParameter<std::string>("keepPhotons")),
99  slimRelinkPhotonSel_(config.getParameter<std::string>("slimRelinkPhotons")),
100  relinkPhotonSel_(config.getParameter<std::string>("relinkPhotons")),
101  keepOOTPhotonSel_(config.getParameter<std::string>("keepOOTPhotons")),
102  slimRelinkOOTPhotonSel_(config.getParameter<std::string>("slimRelinkOOTPhotons")),
103  relinkOOTPhotonSel_(config.getParameter<std::string>("relinkOOTPhotons")),
104  keepGsfElectronSel_(config.getParameter<std::string>("keepGsfElectrons")),
105  slimRelinkGsfElectronSel_(config.getParameter<std::string>("slimRelinkGsfElectrons")),
106  relinkGsfElectronSel_(config.getParameter<std::string>("relinkGsfElectrons")),
107  hcalHitSel_(config.getParameter<edm::ParameterSet>("hcalHitSel"), consumesCollector()) {
108  const edm::InputTag& aTag = config.getParameter<edm::InputTag>("ootPhotons");
109  caloTopology_ = esConsumes();
110  if (not aTag.label().empty())
111  ootPhotonT_ = consumes<reco::PhotonCollection>(aTag);
112 
113  for (const edm::InputTag& tag : config.getParameter<std::vector<edm::InputTag>>("photonIDSources")) {
114  photonIdTs_.emplace_back(consumes<edm::ValueMap<bool>>(tag));
115  }
116 
117  for (const edm::InputTag& tag : config.getParameter<std::vector<edm::InputTag>>("gsfElectronIDSources")) {
118  gsfElectronIdTs_.emplace_back(consumes<edm::ValueMap<float>>(tag));
119  }
120 
121  for (const edm::InputTag& tag : config.getParameter<std::vector<edm::InputTag>>("photonFloatValueMapSources")) {
122  photonFloatValueMapTs_.emplace_back(consumes<edm::ValueMap<float>>(tag));
123  }
124 
125  for (const edm::InputTag& tag : config.getParameter<std::vector<edm::InputTag>>("ootPhotonFloatValueMapSources")) {
126  ootPhotonFloatValueMapTs_.emplace_back(consumes<edm::ValueMap<float>>(tag));
127  }
128 
129  for (const edm::InputTag& tag : config.getParameter<std::vector<edm::InputTag>>("gsfElectronFloatValueMapSources")) {
130  gsfElectronFloatValueMapTs_.emplace_back(consumes<edm::ValueMap<float>>(tag));
131  }
132 
133  if (applyPhotonCalibOnData_ || applyPhotonCalibOnMC_) {
134  setToken(photonCalibEnergyT_, config, "photonCalibEnergySource");
135  setToken(photonCalibEnergyErrT_, config, "photonCalibEnergyErrSource");
136  }
137  if (applyGsfElectronCalibOnData_ || applyGsfElectronCalibOnMC_) {
138  setToken(gsfElectronCalibEnergyT_, config, "gsfElectronCalibEnergySource");
139  setToken(gsfElectronCalibEnergyErrT_, config, "gsfElectronCalibEnergyErrSource");
140  setToken(gsfElectronCalibEcalEnergyT_, config, "gsfElectronCalibEcalEnergySource");
141  setToken(gsfElectronCalibEcalEnergyErrT_, config, "gsfElectronCalibEcalEnergyErrSource");
142  }
143 
144  produces<reco::PhotonCollection>(outPhotons_);
145  produces<reco::PhotonCoreCollection>(outPhotonCores_);
146  if (!ootPhotonT_.isUninitialized()) {
147  produces<reco::PhotonCollection>(outOOTPhotons_);
148  produces<reco::PhotonCoreCollection>(outOOTPhotonCores_);
149  }
150  produces<reco::GsfElectronCollection>(outGsfElectrons_);
151  produces<reco::GsfElectronCoreCollection>(outGsfElectronCores_);
152  produces<reco::GsfTrackCollection>(outGsfTracks_);
153  produces<reco::ConversionCollection>(outConversions_);
154  produces<reco::ConversionCollection>(outSingleConversions_);
155  produces<reco::SuperClusterCollection>(outSuperClusters_);
156  produces<reco::CaloClusterCollection>(outEBEEClusters_);
157  produces<reco::CaloClusterCollection>(outESClusters_);
158  if (!ootPhotonT_.isUninitialized()) {
159  produces<reco::SuperClusterCollection>(outOOTSuperClusters_);
160  produces<reco::CaloClusterCollection>(outOOTEBEEClusters_);
161  produces<reco::CaloClusterCollection>(outOOTESClusters_);
162  }
163  produces<EcalRecHitCollection>(outEBRecHits_);
164  produces<EcalRecHitCollection>(outEERecHits_);
165  if (doPreshowerEcalHits_)
166  produces<EcalRecHitCollection>(outESRecHits_);
167  produces<HBHERecHitCollection>(outHBHERecHits_);
168  produces<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(outPhotonPfCandMap_);
169  produces<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(outGsfElectronPfCandMap_);
170  for (const std::string& outid : outPhotonIds_) {
171  produces<edm::ValueMap<bool>>(outid);
172  }
173  for (const std::string& outid : outGsfElectronIds_) {
174  produces<edm::ValueMap<float>>(outid);
175  }
176  for (const std::string& outid : outPhotonFloatValueMaps_) {
177  produces<edm::ValueMap<float>>(outid);
178  }
179  if (!ootPhotonT_.isUninitialized()) {
180  for (const std::string& outid : outOOTPhotonFloatValueMaps_) {
181  produces<edm::ValueMap<float>>(outid);
182  }
183  }
184  for (const std::string& outid : outGsfElectronFloatValueMaps_) {
185  produces<edm::ValueMap<float>>(outid);
186  }
187  if (!recoHIPhotonIsolationMapInputToken_.isUninitialized()) {
188  produces<reco::HIPhotonIsolationMap>(recoHIPhotonIsolationMapOutputName_);
189  }
190 }
191 
193 
194 void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEventSetup) {
195  //get input collections
196 
198  theEvent.getByToken(photonT_, photonHandle);
199 
200  edm::Handle<reco::PhotonCollection> ootPhotonHandle;
202  theEvent.getByToken(ootPhotonT_, ootPhotonHandle);
203 
205  theEvent.getByToken(gsfElectronT_, gsfElectronHandle);
206 
208  theEvent.getByToken(gsfTrackT_, gsfTrackHandle);
209 
212 
213  edm::Handle<reco::ConversionCollection> singleConversionHandle;
214  theEvent.getByToken(singleConversionT_, singleConversionHandle);
215 
216  edm::Handle<EcalRecHitCollection> barrelHitHandle;
217  theEvent.getByToken(barrelEcalHits_, barrelHitHandle);
218 
219  edm::Handle<EcalRecHitCollection> endcapHitHandle;
220  theEvent.getByToken(endcapEcalHits_, endcapHitHandle);
221 
222  edm::Handle<EcalRecHitCollection> preshowerHitHandle;
224  theEvent.getByToken(preshowerEcalHits_, preshowerHitHandle);
225 
226  edm::Handle<HBHERecHitCollection> hbheHitHandle;
227  theEvent.getByToken(hbheHits_, hbheHitHandle);
228 
230  theEvent.getByToken(photonPfCandMapT_, photonPfCandMapHandle);
231 
233  theEvent.getByToken(gsfElectronPfCandMapT_, gsfElectronPfCandMapHandle);
234 
235  std::vector<edm::Handle<edm::ValueMap<bool>>> photonIdHandles(photonIdTs_.size());
236  int index = 0; // universal index for range based loops
237  for (const auto& photonIdT : photonIdTs_) {
238  theEvent.getByToken(photonIdT, photonIdHandles[index++]);
239  }
240 
241  std::vector<edm::Handle<edm::ValueMap<float>>> gsfElectronIdHandles(gsfElectronIdTs_.size());
242  index = 0;
243  for (const auto& gsfElectronIdT : gsfElectronIdTs_) {
244  theEvent.getByToken(gsfElectronIdT, gsfElectronIdHandles[index++]);
245  }
246 
247  std::vector<edm::Handle<edm::ValueMap<float>>> photonFloatValueMapHandles(photonFloatValueMapTs_.size());
248  index = 0;
249  for (const auto& photonFloatValueMapT : photonFloatValueMapTs_) {
250  theEvent.getByToken(photonFloatValueMapT, photonFloatValueMapHandles[index++]);
251  }
252 
253  std::vector<edm::Handle<edm::ValueMap<float>>> ootPhotonFloatValueMapHandles(ootPhotonFloatValueMapTs_.size());
254  if (!ootPhotonT_.isUninitialized()) {
255  index = 0;
256  for (const auto& ootPhotonFloatValueMapT : ootPhotonFloatValueMapTs_) {
257  theEvent.getByToken(ootPhotonFloatValueMapT, ootPhotonFloatValueMapHandles[index++]);
258  }
259  }
260 
261  std::vector<edm::Handle<edm::ValueMap<float>>> gsfElectronFloatValueMapHandles(gsfElectronFloatValueMapTs_.size());
262  index = 0;
263  for (const auto& gsfElectronFloatValueMapT : gsfElectronFloatValueMapTs_) {
264  theEvent.getByToken(gsfElectronFloatValueMapT, gsfElectronFloatValueMapHandles[index++]);
265  }
266 
267  edm::Handle<edm::ValueMap<float>> gsfElectronCalibEnergyHandle;
268  edm::Handle<edm::ValueMap<float>> gsfElectronCalibEnergyErrHandle;
269  edm::Handle<edm::ValueMap<float>> gsfElectronCalibEcalEnergyHandle;
270  edm::Handle<edm::ValueMap<float>> gsfElectronCalibEcalEnergyErrHandle;
272  theEvent.getByToken(gsfElectronCalibEnergyT_, gsfElectronCalibEnergyHandle);
273  theEvent.getByToken(gsfElectronCalibEnergyErrT_, gsfElectronCalibEnergyErrHandle);
274  theEvent.getByToken(gsfElectronCalibEcalEnergyT_, gsfElectronCalibEcalEnergyHandle);
275  theEvent.getByToken(gsfElectronCalibEcalEnergyErrT_, gsfElectronCalibEcalEnergyErrHandle);
276  }
277  edm::Handle<edm::ValueMap<float>> photonCalibEnergyHandle;
278  edm::Handle<edm::ValueMap<float>> photonCalibEnergyErrHandle;
280  theEvent.getByToken(photonCalibEnergyT_, photonCalibEnergyHandle);
281  theEvent.getByToken(photonCalibEnergyErrT_, photonCalibEnergyErrHandle);
282  }
283 
284  edm::ESHandle<CaloTopology> theCaloTopology = theEventSetup.getHandle(caloTopology_);
285  const CaloTopology* caloTopology = &(*theCaloTopology);
286 
287  //initialize output collections
288  auto photons = std::make_unique<reco::PhotonCollection>();
289  auto photonCores = std::make_unique<reco::PhotonCoreCollection>();
290  auto ootPhotons = std::make_unique<reco::PhotonCollection>();
291  auto ootPhotonCores = std::make_unique<reco::PhotonCoreCollection>();
292  auto gsfElectrons = std::make_unique<reco::GsfElectronCollection>();
293  auto gsfElectronCores = std::make_unique<reco::GsfElectronCoreCollection>();
294  auto gsfTracks = std::make_unique<reco::GsfTrackCollection>();
295  auto conversions = std::make_unique<reco::ConversionCollection>();
296  auto singleConversions = std::make_unique<reco::ConversionCollection>();
297  auto superClusters = std::make_unique<reco::SuperClusterCollection>();
298  auto ebeeClusters = std::make_unique<reco::CaloClusterCollection>();
299  auto esClusters = std::make_unique<reco::CaloClusterCollection>();
300  auto ootSuperClusters = std::make_unique<reco::SuperClusterCollection>();
301  auto ootEbeeClusters = std::make_unique<reco::CaloClusterCollection>();
302  auto ootEsClusters = std::make_unique<reco::CaloClusterCollection>();
303  auto ebRecHits = std::make_unique<EcalRecHitCollection>();
304  auto eeRecHits = std::make_unique<EcalRecHitCollection>();
305  auto esRecHits = std::make_unique<EcalRecHitCollection>();
306  auto hbheRecHits = std::make_unique<HBHERecHitCollection>();
307  auto photonPfCandMap = std::make_unique<edm::ValueMap<std::vector<reco::PFCandidateRef>>>();
308  auto gsfElectronPfCandMap = std::make_unique<edm::ValueMap<std::vector<reco::PFCandidateRef>>>();
309 
310  //maps to collection indices of output objects
311  std::map<reco::PhotonCoreRef, unsigned int> photonCoreMap;
312  std::map<reco::PhotonCoreRef, unsigned int> ootPhotonCoreMap;
313  std::map<reco::GsfElectronCoreRef, unsigned int> gsfElectronCoreMap;
314  std::map<reco::GsfTrackRef, unsigned int> gsfTrackMap;
315  std::map<reco::ConversionRef, unsigned int> conversionMap;
316  std::map<reco::ConversionRef, unsigned int> singleConversionMap;
317  std::map<reco::SuperClusterRef, unsigned int> superClusterMap;
318  std::map<reco::CaloClusterPtr, unsigned int> ebeeClusterMap;
319  std::map<reco::CaloClusterPtr, unsigned int> esClusterMap;
320  std::map<reco::SuperClusterRef, unsigned int> ootSuperClusterMap;
321  std::map<reco::CaloClusterPtr, unsigned int> ootEbeeClusterMap;
322  std::map<reco::CaloClusterPtr, unsigned int> ootEsClusterMap;
323  std::unordered_set<DetId> rechitMap;
324  std::unordered_set<DetId> hcalRechitMap;
325 
326  std::unordered_set<unsigned int> superClusterFullRelinkMap;
327  std::unordered_set<unsigned int> ootSuperClusterFullRelinkMap;
328 
329  //vectors for pfcandidate valuemaps
330  std::vector<std::vector<reco::PFCandidateRef>> pfCandIsoPairVecPho;
331  std::vector<std::vector<reco::PFCandidateRef>> pfCandIsoPairVecEle;
332 
333  //vectors for id valuemaps
334  std::vector<std::vector<bool>> photonIdVals(photonIdHandles.size());
335  std::vector<std::vector<float>> gsfElectronIdVals(gsfElectronIdHandles.size());
336  std::vector<std::vector<float>> photonFloatValueMapVals(photonFloatValueMapHandles.size());
337  std::vector<std::vector<float>> ootPhotonFloatValueMapVals(ootPhotonFloatValueMapHandles.size());
338  std::vector<std::vector<float>> gsfElectronFloatValueMapVals(gsfElectronFloatValueMapHandles.size());
339 
340  // HI photon iso value maps
341  reco::HIPhotonIsolationMap const* recoHIPhotonIsolationMapInputValueMap =
343  : nullptr;
344  std::vector<reco::HIPhotonIsolation> recoHIPhotonIsolationMapInputVals;
345 
346  //loop over photons and fill maps
347  index = -1;
348  for (const auto& photon : *photonHandle) {
349  index++;
350 
351  reco::PhotonRef photonref(photonHandle, index);
352  photons->push_back(photon);
353  auto& newPhoton = photons->back();
354 
355  if ((applyPhotonCalibOnData_ && theEvent.isRealData()) || (applyPhotonCalibOnMC_ && !theEvent.isRealData())) {
356  calibratePhoton(newPhoton, photonref, *photonCalibEnergyHandle, *photonCalibEnergyErrHandle);
357  }
358 
359  //we do this after calibration
360  bool keep = keepPhotonSel_(newPhoton);
361  if (!keep) {
362  photons->pop_back();
363  continue;
364  }
365 
366  //fill pf candidate value map vector
367  pfCandIsoPairVecPho.push_back((*photonPfCandMapHandle)[photonref]);
368 
369  //fill photon id valuemap vectors
370  int subindex = 0;
371  for (const auto& photonIdHandle : photonIdHandles) {
372  photonIdVals[subindex++].push_back((*photonIdHandle)[photonref]);
373  }
374 
375  subindex = 0;
376  for (const auto& photonFloatValueMapHandle : photonFloatValueMapHandles) {
377  photonFloatValueMapVals[subindex++].push_back((*photonFloatValueMapHandle)[photonref]);
378  }
379 
380  // HI photon isolation
381  if (!recoHIPhotonIsolationMapInputToken_.isUninitialized()) {
382  recoHIPhotonIsolationMapInputVals.push_back((*recoHIPhotonIsolationMapInputValueMap)[photonref]);
383  }
384 
385  //link photon core
386  const reco::PhotonCoreRef& photonCore = photon.photonCore();
387  linkCore(photonCore, *photonCores, photonCoreMap);
388 
389  bool slimRelink = slimRelinkPhotonSel_(newPhoton);
390  //no supercluster relinking unless slimRelink selection is satisfied
391  if (!slimRelink)
392  continue;
393 
394  bool relink = relinkPhotonSel_(newPhoton);
395 
396  //link supercluster
397  const reco::SuperClusterRef& superCluster = photon.superCluster();
398  linkSuperCluster(superCluster, superClusterMap, *superClusters, relink, superClusterFullRelinkMap);
399 
400  //conversions only for full relinking
401  if (!relink)
402  continue;
403 
404  const reco::ConversionRefVector& convrefs = photon.conversions();
405  linkConversions(convrefs, *conversions, conversionMap);
406 
407  //explicitly references conversions
408  const reco::ConversionRefVector& singleconvrefs = photon.conversionsOneLeg();
409  linkConversions(singleconvrefs, *singleConversions, singleConversionMap);
410 
411  //hcal hits
412  linkHcalHits(*photon.superCluster(), *hbheHitHandle, hcalRechitMap);
413  }
414 
415  //loop over oot photons and fill maps
416  //special note1: since not PFCand --> no PF isolation, IDs (but we do have FloatValueMap!)
417  //special note2: conversion sequence not run over bcs from oot phos, so skip relinking of oot phos
418  //special note3: clusters and superclusters in own collections!
419  if (!ootPhotonT_.isUninitialized()) {
420  index = -1;
421  for (const auto& ootPhoton : *ootPhotonHandle) {
422  index++;
423 
424  bool keep = keepOOTPhotonSel_(ootPhoton);
425  if (!keep)
426  continue;
427 
428  reco::PhotonRef ootPhotonref(ootPhotonHandle, index);
429 
430  ootPhotons->push_back(ootPhoton);
431 
432  //fill photon pfclusteriso valuemap vectors
433  int subindex = 0;
434  for (const auto& ootPhotonFloatValueMapHandle : ootPhotonFloatValueMapHandles) {
435  ootPhotonFloatValueMapVals[subindex++].push_back((*ootPhotonFloatValueMapHandle)[ootPhotonref]);
436  }
437 
438  //link photon core
439  const reco::PhotonCoreRef& ootPhotonCore = ootPhoton.photonCore();
440  linkCore(ootPhotonCore, *ootPhotonCores, ootPhotonCoreMap);
441 
442  bool slimRelink = slimRelinkOOTPhotonSel_(ootPhoton);
443  //no supercluster relinking unless slimRelink selection is satisfied
444  if (!slimRelink)
445  continue;
446 
447  bool relink = relinkOOTPhotonSel_(ootPhoton);
448 
449  const reco::SuperClusterRef& ootSuperCluster = ootPhoton.superCluster();
450  linkSuperCluster(ootSuperCluster, ootSuperClusterMap, *ootSuperClusters, relink, ootSuperClusterFullRelinkMap);
451  //hcal hits
452  linkHcalHits(*ootPhoton.superCluster(), *hbheHitHandle, hcalRechitMap);
453  }
454  }
455 
456  //loop over electrons and fill maps
457  index = -1;
458  for (const auto& gsfElectron : *gsfElectronHandle) {
459  index++;
460 
461  reco::GsfElectronRef gsfElectronref(gsfElectronHandle, index);
462  gsfElectrons->push_back(gsfElectron);
463  auto& newGsfElectron = gsfElectrons->back();
464  if ((applyGsfElectronCalibOnData_ && theEvent.isRealData()) ||
465  (applyGsfElectronCalibOnMC_ && !theEvent.isRealData())) {
466  calibrateElectron(newGsfElectron,
467  gsfElectronref,
468  *gsfElectronCalibEnergyHandle,
469  *gsfElectronCalibEnergyErrHandle,
470  *gsfElectronCalibEcalEnergyHandle,
471  *gsfElectronCalibEcalEnergyErrHandle);
472  }
473 
474  bool keep = keepGsfElectronSel_(newGsfElectron);
475  if (!keep) {
476  gsfElectrons->pop_back();
477  continue;
478  }
479 
480  pfCandIsoPairVecEle.push_back((*gsfElectronPfCandMapHandle)[gsfElectronref]);
481 
482  //fill electron id valuemap vectors
483  int subindex = 0;
484  for (const auto& gsfElectronIdHandle : gsfElectronIdHandles) {
485  gsfElectronIdVals[subindex++].push_back((*gsfElectronIdHandle)[gsfElectronref]);
486  }
487 
488  subindex = 0;
489  for (const auto& gsfElectronFloatValueMapHandle : gsfElectronFloatValueMapHandles) {
490  gsfElectronFloatValueMapVals[subindex++].push_back((*gsfElectronFloatValueMapHandle)[gsfElectronref]);
491  }
492 
493  const reco::GsfElectronCoreRef& gsfElectronCore = gsfElectron.core();
494  linkCore(gsfElectronCore, *gsfElectronCores, gsfElectronCoreMap);
495 
496  const reco::GsfTrackRef& gsfTrack = gsfElectron.gsfTrack();
497 
498  // Save the main gsfTrack
499  if (!gsfTrackMap.count(gsfTrack)) {
500  gsfTracks->push_back(*gsfTrack);
501  gsfTrackMap[gsfTrack] = gsfTracks->size() - 1;
502  }
503 
504  // Save additional ambiguous gsf tracks in a map:
505  for (auto igsf = gsfElectron.ambiguousGsfTracksBegin(); igsf != gsfElectron.ambiguousGsfTracksEnd(); ++igsf) {
506  const reco::GsfTrackRef& ambigGsfTrack = *igsf;
507  if (!gsfTrackMap.count(ambigGsfTrack)) {
508  gsfTracks->push_back(*ambigGsfTrack);
509  gsfTrackMap[ambigGsfTrack] = gsfTracks->size() - 1;
510  }
511  }
512 
513  bool slimRelink = slimRelinkGsfElectronSel_(newGsfElectron);
514  //no supercluster relinking unless slimRelink selection is satisfied
515  if (!slimRelink)
516  continue;
517 
518  bool relink = relinkGsfElectronSel_(newGsfElectron);
519 
520  const reco::SuperClusterRef& superCluster = gsfElectron.superCluster();
521  linkSuperCluster(superCluster, superClusterMap, *superClusters, relink, superClusterFullRelinkMap);
522 
523  //conversions only for full relinking
524  if (!relink)
525  continue;
526 
527  const reco::ConversionRefVector& convrefs = gsfElectron.core()->conversions();
528  linkConversions(convrefs, *conversions, conversionMap);
529 
530  //explicitly references conversions
531  const reco::ConversionRefVector& singleconvrefs = gsfElectron.core()->conversionsOneLeg();
532  linkConversions(singleconvrefs, *singleConversions, singleConversionMap);
533 
534  //conversions matched by trackrefs
535  linkConversionsByTrackRef(conversionHandle, gsfElectron, *conversions, conversionMap);
536 
537  //single leg conversions matched by trackrefs
538  linkConversionsByTrackRef(singleConversionHandle, gsfElectron, *singleConversions, singleConversionMap);
539 
540  //hcal hits
541  linkHcalHits(*gsfElectron.superCluster(), *hbheHitHandle, hcalRechitMap);
542  }
543 
544  //loop over output SuperClusters and fill maps
545  index = 0;
546  for (auto& superCluster : *superClusters) {
547  //link seed cluster no matter what
548  const reco::CaloClusterPtr& seedCluster = superCluster.seed();
549  linkCaloCluster(seedCluster, *ebeeClusters, ebeeClusterMap);
550 
551  //only proceed if superCluster is marked for full relinking
552  bool fullrelink = superClusterFullRelinkMap.count(index++);
553  if (!fullrelink) {
554  //zero detid vector which is anyways not useful without stored rechits
555  superCluster.clearHitsAndFractions();
556  continue;
557  }
558 
559  // link calo clusters
560  linkCaloClusters(superCluster,
561  *ebeeClusters,
562  ebeeClusterMap,
563  rechitMap,
564  barrelHitHandle,
565  endcapHitHandle,
566  caloTopology,
567  *esClusters,
568  esClusterMap);
569 
570  //conversions matched geometrically
571  linkConversionsByTrackRef(conversionHandle, superCluster, *conversions, conversionMap);
572 
573  //single leg conversions matched by trackrefs
574  linkConversionsByTrackRef(singleConversionHandle, superCluster, *singleConversions, singleConversionMap);
575  }
576 
577  //loop over output OOTSuperClusters and fill maps
578  if (!ootPhotonT_.isUninitialized()) {
579  index = 0;
580  for (auto& ootSuperCluster : *ootSuperClusters) {
581  //link seed cluster no matter what
582  const reco::CaloClusterPtr& ootSeedCluster = ootSuperCluster.seed();
583  linkCaloCluster(ootSeedCluster, *ootEbeeClusters, ootEbeeClusterMap);
584 
585  //only proceed if ootSuperCluster is marked for full relinking
586  bool fullrelink = ootSuperClusterFullRelinkMap.count(index++);
587  if (!fullrelink) {
588  //zero detid vector which is anyways not useful without stored rechits
589  ootSuperCluster.clearHitsAndFractions();
590  continue;
591  }
592 
593  // link calo clusters
594  linkCaloClusters(ootSuperCluster,
595  *ootEbeeClusters,
596  ootEbeeClusterMap,
597  rechitMap,
598  barrelHitHandle,
599  endcapHitHandle,
600  caloTopology,
601  *ootEsClusters,
602  ootEsClusterMap);
603  }
604  }
605  //now finalize and add to the event collections in "reverse" order
606 
607  //rechits (fill output collections of rechits to be stored)
608  for (const EcalRecHit& rechit : *barrelHitHandle) {
609  if (rechitMap.count(rechit.detid())) {
610  ebRecHits->push_back(rechit);
611  }
612  }
613 
614  for (const EcalRecHit& rechit : *endcapHitHandle) {
615  if (rechitMap.count(rechit.detid())) {
616  eeRecHits->push_back(rechit);
617  }
618  }
619 
620  theEvent.put(std::move(ebRecHits), outEBRecHits_);
621  theEvent.put(std::move(eeRecHits), outEERecHits_);
622 
623  if (doPreshowerEcalHits_) {
624  for (const EcalRecHit& rechit : *preshowerHitHandle) {
625  if (rechitMap.count(rechit.detid())) {
626  esRecHits->push_back(rechit);
627  }
628  }
629  theEvent.put(std::move(esRecHits), outESRecHits_);
630  }
631 
632  for (const HBHERecHit& rechit : *hbheHitHandle) {
633  if (hcalRechitMap.count(rechit.detid())) {
634  hbheRecHits->push_back(rechit);
635  }
636  }
637  theEvent.put(std::move(hbheRecHits), outHBHERecHits_);
638 
639  //CaloClusters
640  //put calocluster output collections in event and get orphan handles to create ptrs
641  const auto& outEBEEClusterHandle = theEvent.put(std::move(ebeeClusters), outEBEEClusters_);
642  const auto& outESClusterHandle = theEvent.put(std::move(esClusters), outESClusters_);
643  ;
644 
645  //Loop over SuperClusters and relink GEDPhoton + GSFElectron CaloClusters
646  for (reco::SuperCluster& superCluster : *superClusters) {
647  relinkCaloClusters(superCluster, ebeeClusterMap, esClusterMap, outEBEEClusterHandle, outESClusterHandle);
648  }
649 
650  //OOTCaloClusters
651  //put ootcalocluster output collections in event and get orphan handles to create ptrs
652  edm::OrphanHandle<reco::CaloClusterCollection> outOOTEBEEClusterHandle;
654  //Loop over OOTSuperClusters and relink OOTPhoton CaloClusters
655  if (!ootPhotonT_.isUninitialized()) {
656  outOOTEBEEClusterHandle = theEvent.put(std::move(ootEbeeClusters), outOOTEBEEClusters_);
657  outOOTESClusterHandle = theEvent.put(std::move(ootEsClusters), outOOTESClusters_);
658  for (reco::SuperCluster& ootSuperCluster : *ootSuperClusters) {
660  ootSuperCluster, ootEbeeClusterMap, ootEsClusterMap, outOOTEBEEClusterHandle, outOOTESClusterHandle);
661  }
662  }
663  //put superclusters and conversions in the event
664  const auto& outSuperClusterHandle = theEvent.put(std::move(superClusters), outSuperClusters_);
665  const auto& outConversionHandle = theEvent.put(std::move(conversions), outConversions_);
666  const auto& outSingleConversionHandle = theEvent.put(std::move(singleConversions), outSingleConversions_);
667  const auto& outGsfTrackHandle = theEvent.put(std::move(gsfTracks), outGsfTracks_);
668 
669  //Loop over PhotonCores and relink GEDPhoton SuperClusters (and conversions)
670  for (reco::PhotonCore& photonCore : *photonCores) {
671  // superclusters
672  relinkSuperCluster(photonCore, superClusterMap, outSuperClusterHandle);
673 
674  //conversions
675  const reco::ConversionRefVector& convrefs = photonCore.conversions();
676  relinkConversions(photonCore, convrefs, conversionMap, outConversionHandle);
677 
678  //single leg conversions
679  const reco::ConversionRefVector& singleconvrefs = photonCore.conversionsOneLeg();
680  relinkConversions(photonCore, singleconvrefs, singleConversionMap, outSingleConversionHandle);
681  }
682 
683  //Relink GSFElectron SuperClusters and main GSF Tracks
684  for (reco::GsfElectronCore& gsfElectronCore : *gsfElectronCores) {
685  relinkSuperCluster(gsfElectronCore, superClusterMap, outSuperClusterHandle);
686  relinkGsfTrack(gsfElectronCore, gsfTrackMap, outGsfTrackHandle);
687  }
688 
689  //put ootsuperclusters in the event
690  edm::OrphanHandle<reco::SuperClusterCollection> outOOTSuperClusterHandle;
692  outOOTSuperClusterHandle = theEvent.put(std::move(ootSuperClusters), outOOTSuperClusters_);
693 
694  //Relink OOTPhoton SuperClusters
695  for (reco::PhotonCore& ootPhotonCore : *ootPhotonCores) {
696  relinkSuperCluster(ootPhotonCore, ootSuperClusterMap, outOOTSuperClusterHandle);
697  }
698 
699  //put photoncores and gsfelectroncores into the event
700  const auto& outPhotonCoreHandle = theEvent.put(std::move(photonCores), outPhotonCores_);
701  edm::OrphanHandle<reco::PhotonCoreCollection> outOOTPhotonCoreHandle;
703  outOOTPhotonCoreHandle = theEvent.put(std::move(ootPhotonCores), outOOTPhotonCores_);
704  const auto& outgsfElectronCoreHandle = theEvent.put(std::move(gsfElectronCores), outGsfElectronCores_);
705 
706  //loop over photons, oot photons, and electrons and relink the cores
707  for (reco::Photon& photon : *photons) {
708  relinkPhotonCore(photon, photonCoreMap, outPhotonCoreHandle);
709  }
710 
711  if (!ootPhotonT_.isUninitialized()) {
712  for (reco::Photon& ootPhoton : *ootPhotons) {
713  relinkPhotonCore(ootPhoton, ootPhotonCoreMap, outOOTPhotonCoreHandle);
714  }
715  }
716 
717  for (reco::GsfElectron& gsfElectron : *gsfElectrons) {
718  relinkGsfElectronCore(gsfElectron, gsfElectronCoreMap, outgsfElectronCoreHandle);
719 
720  // -----
721  // Also in this loop let's relink ambiguous tracks
722  std::vector<reco::GsfTrackRef> ambigTracksInThisElectron;
723  // Here we loop over the ambiguous tracks and save them in a vector
724  for (auto igsf = gsfElectron.ambiguousGsfTracksBegin(); igsf != gsfElectron.ambiguousGsfTracksEnd(); ++igsf) {
725  ambigTracksInThisElectron.push_back(*igsf);
726  }
727 
728  // Now we need to clear them (they are the refs to original collection):
729  gsfElectron.clearAmbiguousGsfTracks();
730 
731  // And here we add them back, now from a new reduced collection:
732  for (const auto& it : ambigTracksInThisElectron) {
733  const auto& gsftkmapped = gsfTrackMap.find(it);
734 
735  if (gsftkmapped != gsfTrackMap.end()) {
736  reco::GsfTrackRef gsftkref(outGsfTrackHandle, gsftkmapped->second);
737  gsfElectron.addAmbiguousGsfTrack(gsftkref);
738  } else
739  throw cms::Exception("There must be a problem with linking and mapping of ambiguous gsf tracks...");
740  }
741 
742  if (gsfElectron.ambiguousGsfTracksSize() > 0)
743  gsfElectron.setAmbiguous(true); // Set the flag
744 
745  ambigTracksInThisElectron.clear();
746  }
747 
748  //(finally) store the output photon and electron collections
749  const auto& outPhotonHandle = theEvent.put(std::move(photons), outPhotons_);
752  outOOTPhotonHandle = theEvent.put(std::move(ootPhotons), outOOTPhotons_);
753  const auto& outGsfElectronHandle = theEvent.put(std::move(gsfElectrons), outGsfElectrons_);
754 
755  //still need to output relinked valuemaps
756 
757  //photon pfcand isolation valuemap
758  edm::ValueMap<std::vector<reco::PFCandidateRef>>::Filler fillerPhotons(*photonPfCandMap);
759  fillerPhotons.insert(outPhotonHandle, pfCandIsoPairVecPho.begin(), pfCandIsoPairVecPho.end());
760  fillerPhotons.fill();
761 
762  //electron pfcand isolation valuemap
763  edm::ValueMap<std::vector<reco::PFCandidateRef>>::Filler fillerGsfElectrons(*gsfElectronPfCandMap);
764  fillerGsfElectrons.insert(outGsfElectronHandle, pfCandIsoPairVecEle.begin(), pfCandIsoPairVecEle.end());
765  fillerGsfElectrons.fill();
766 
767  theEvent.put(std::move(photonPfCandMap), outPhotonPfCandMap_);
768  theEvent.put(std::move(gsfElectronPfCandMap), outGsfElectronPfCandMap_);
769 
770  auto fillMap = [](auto refH, auto& vec, edm::Event& ev, const std::string& cAl = "") {
771  typedef edm::ValueMap<typename std::decay<decltype(vec)>::type::value_type> MapType;
772  auto oMap = std::make_unique<MapType>();
773  {
774  typename MapType::Filler filler(*oMap);
775  filler.insert(refH, vec.begin(), vec.end());
776  filler.fill();
777  }
778  ev.put(std::move(oMap), cAl);
779  };
780 
781  //photon id value maps
782  index = 0;
783  for (auto const& vals : photonIdVals) {
784  fillMap(outPhotonHandle, vals, theEvent, outPhotonIds_[index++]);
785  }
786 
787  //electron id value maps
788  index = 0;
789  for (auto const& vals : gsfElectronIdVals) {
790  fillMap(outGsfElectronHandle, vals, theEvent, outGsfElectronIds_[index++]);
791  }
792 
793  // photon iso value maps
794  index = 0;
795  for (auto const& vals : photonFloatValueMapVals) {
796  fillMap(outPhotonHandle, vals, theEvent, outPhotonFloatValueMaps_[index++]);
797  }
798 
799  if (!ootPhotonT_.isUninitialized()) {
800  //oot photon iso value maps
801  index = 0;
802  for (auto const& vals : ootPhotonFloatValueMapVals) {
803  fillMap(outOOTPhotonHandle, vals, theEvent, outOOTPhotonFloatValueMaps_[index++]);
804  }
805  }
806 
807  // HI photon iso value maps
808  if (!recoHIPhotonIsolationMapInputToken_.isUninitialized()) {
809  fillMap(outPhotonHandle, recoHIPhotonIsolationMapInputVals, theEvent, recoHIPhotonIsolationMapOutputName_);
810  }
811 
812  //electron iso value maps
813  index = 0;
814  for (auto const& vals : gsfElectronFloatValueMapVals) {
815  fillMap(outGsfElectronHandle, vals, theEvent, outGsfElectronFloatValueMaps_[index++]);
816  }
817 }
818 
819 template <typename T, typename U>
820 void ReducedEGProducer::linkCore(const T& core, U& cores, std::map<T, unsigned int>& coreMap) {
821  if (!coreMap.count(core)) {
822  cores.push_back(*core);
823  coreMap[core] = cores.size() - 1;
824  }
825 }
826 
828  std::map<reco::SuperClusterRef, unsigned int>& superClusterMap,
830  const bool relink,
831  std::unordered_set<unsigned int>& superClusterFullRelinkMap) {
832  const auto& mappedsc = superClusterMap.find(superCluster);
833  //get index in output collection in order to keep track whether superCluster
834  //will be subject to full relinking
835  unsigned int mappedscidx = 0;
836  if (mappedsc == superClusterMap.end()) {
837  superClusters.push_back(*superCluster);
838  mappedscidx = superClusters.size() - 1;
839  superClusterMap[superCluster] = mappedscidx;
840  } else {
841  mappedscidx = mappedsc->second;
842  }
843 
844  //additionally mark supercluster for full relinking
845  if (relink)
846  superClusterFullRelinkMap.insert(mappedscidx);
847 }
848 
851  std::map<reco::ConversionRef, unsigned int>& conversionMap) {
852  for (const auto& convref : convrefs) {
853  linkConversion(convref, conversions, conversionMap);
854  }
855 }
856 
858  const reco::GsfElectron& gsfElectron,
860  std::map<reco::ConversionRef, unsigned int>& conversionMap) {
861  int index = 0;
862  for (const auto& conversion : *conversionHandle) {
864 
865  bool matched = ConversionTools::matchesConversion(gsfElectron, conversion, true, true);
866  if (!matched)
867  continue;
868 
869  linkConversion(convref, conversions, conversionMap);
870  }
871 }
872 
874  const reco::SuperCluster& superCluster,
876  std::map<reco::ConversionRef, unsigned int>& conversionMap) {
877  int index = 0;
878  for (const auto& conversion : *conversionHandle) {
880 
881  bool matched = ConversionTools::matchesConversion(superCluster, conversion, 0.2);
882  if (!matched)
883  continue;
884 
885  linkConversion(convref, conversions, conversionMap);
886  }
887 }
888 
891  std::map<reco::ConversionRef, unsigned int>& conversionMap) {
892  if (!conversionMap.count(convref)) {
893  conversions.push_back(*convref);
894  conversionMap[convref] = conversions.size() - 1;
895  }
896 }
897 
899  reco::CaloClusterCollection& caloClusters,
900  std::map<reco::CaloClusterPtr, unsigned int>& caloClusterMap) {
901  if (!caloClusterMap.count(caloCluster)) {
902  caloClusters.push_back(*caloCluster);
903  caloClusterMap[caloCluster] = caloClusters.size() - 1;
904  }
905 }
906 
908  reco::CaloClusterCollection& ebeeClusters,
909  std::map<reco::CaloClusterPtr, unsigned int>& ebeeClusterMap,
910  std::unordered_set<DetId>& rechitMap,
911  const edm::Handle<EcalRecHitCollection>& barrelHitHandle,
912  const edm::Handle<EcalRecHitCollection>& endcapHitHandle,
913  const CaloTopology* caloTopology,
914  reco::CaloClusterCollection& esClusters,
915  std::map<reco::CaloClusterPtr, unsigned int>& esClusterMap) {
916  for (const auto& cluster : superCluster.clusters()) {
917  linkCaloCluster(cluster, ebeeClusters, ebeeClusterMap);
918 
919  for (const auto& hitfrac : cluster->hitsAndFractions()) {
920  rechitMap.insert(hitfrac.first);
921  }
922  //make sure to also take all hits in the 5x5 around the max energy xtal
923  bool barrel = cluster->hitsAndFractions().front().first.subdetId() == EcalBarrel;
924  const EcalRecHitCollection* rhcol = barrel ? barrelHitHandle.product() : endcapHitHandle.product();
925  DetId seed = EcalClusterTools::getMaximum(*cluster, rhcol).first;
926 
927  std::vector<DetId> dets5x5 =
929  for (const auto& detid : dets5x5) {
930  rechitMap.insert(detid);
931  }
932  }
933  for (const auto& cluster : superCluster.preshowerClusters()) {
934  linkCaloCluster(cluster, esClusters, esClusterMap);
935 
936  for (const auto& hitfrac : cluster->hitsAndFractions()) {
937  rechitMap.insert(hitfrac.first);
938  }
939  }
940 }
941 
944  std::unordered_set<DetId>& hcalDetIds) {
945  hcalHitSel_.addDetIds(superClus, recHits, hcalDetIds);
946 }
947 
949  const std::map<reco::CaloClusterPtr, unsigned int>& ebeeClusterMap,
950  const std::map<reco::CaloClusterPtr, unsigned int>& esClusterMap,
951  const edm::OrphanHandle<reco::CaloClusterCollection>& outEBEEClusterHandle,
952  const edm::OrphanHandle<reco::CaloClusterCollection>& outESClusterHandle) {
953  //remap seed cluster
954  const auto& seedmapped = ebeeClusterMap.find(superCluster.seed());
955  if (seedmapped != ebeeClusterMap.end()) {
956  //make new ptr
957  reco::CaloClusterPtr clusptr(outEBEEClusterHandle, seedmapped->second);
958  superCluster.setSeed(clusptr);
959  }
960 
961  //remap all clusters
963  for (const auto& cluster : superCluster.clusters()) {
964  const auto& clustermapped = ebeeClusterMap.find(cluster);
965  if (clustermapped != ebeeClusterMap.end()) {
966  //make new ptr
967  reco::CaloClusterPtr clusptr(outEBEEClusterHandle, clustermapped->second);
968  clusters.push_back(clusptr);
969  } else {
970  //can only relink if all clusters are being relinked, so if one is missing, then skip the relinking completely
971  clusters.clear();
972  break;
973  }
974  }
975  if (!clusters.empty()) {
976  superCluster.setClusters(clusters);
977  }
978 
979  //remap preshower clusters
980  reco::CaloClusterPtrVector esclusters;
981  for (const auto& cluster : superCluster.preshowerClusters()) {
982  const auto& clustermapped = esClusterMap.find(cluster);
983  if (clustermapped != esClusterMap.end()) {
984  //make new ptr
985  reco::CaloClusterPtr clusptr(outESClusterHandle, clustermapped->second);
986  esclusters.push_back(clusptr);
987  } else {
988  //can only relink if all clusters are being relinked, so if one is missing, then skip the relinking completely
989  esclusters.clear();
990  break;
991  }
992  }
993  if (!esclusters.empty()) {
994  superCluster.setPreshowerClusters(esclusters);
995  }
996 }
997 
998 template <typename T>
1000  T& core,
1001  const std::map<reco::SuperClusterRef, unsigned int>& superClusterMap,
1002  const edm::OrphanHandle<reco::SuperClusterCollection>& outSuperClusterHandle) {
1003  const auto& scmapped = superClusterMap.find(core.superCluster());
1004  if (scmapped != superClusterMap.end()) {
1005  //make new ref
1006  reco::SuperClusterRef scref(outSuperClusterHandle, scmapped->second);
1007  core.setSuperCluster(scref);
1008  }
1009 }
1010 
1012  const std::map<reco::GsfTrackRef, unsigned int>& gsfTrackMap,
1013  const edm::OrphanHandle<reco::GsfTrackCollection>& outGsfTrackHandle) {
1014  const auto& gsftkmapped = gsfTrackMap.find(gsfElectronCore.gsfTrack());
1015  if (gsftkmapped != gsfTrackMap.end()) {
1016  reco::GsfTrackRef gsftkref(outGsfTrackHandle, gsftkmapped->second);
1017  gsfElectronCore.setGsfTrack(gsftkref);
1018  }
1019 }
1020 
1022  const reco::ConversionRefVector& convrefs,
1023  const std::map<reco::ConversionRef, unsigned int>& conversionMap,
1024  const edm::OrphanHandle<reco::ConversionCollection>& outConversionHandle) {
1025  reco::ConversionRefVector outconvrefs;
1026  for (const auto& convref : convrefs) {
1027  const auto& convmapped = conversionMap.find(convref);
1028  if (convmapped != conversionMap.end()) {
1029  //make new ref
1030  reco::ConversionRef outref(outConversionHandle, convmapped->second);
1031  } else {
1032  //can only relink if all conversions are being relinked, so if one is missing, then skip the relinking completely
1033  outconvrefs.clear();
1034  break;
1035  }
1036  }
1037  if (!outconvrefs.empty()) {
1038  photonCore.setConversions(outconvrefs);
1039  }
1040 }
1041 
1043  const std::map<reco::PhotonCoreRef, unsigned int>& photonCoreMap,
1044  const edm::OrphanHandle<reco::PhotonCoreCollection>& outPhotonCoreHandle) {
1045  const auto& coremapped = photonCoreMap.find(photon.photonCore());
1046  if (coremapped != photonCoreMap.end()) {
1047  //make new ref
1048  reco::PhotonCoreRef coreref(outPhotonCoreHandle, coremapped->second);
1049  photon.setPhotonCore(coreref);
1050  }
1051 }
1052 
1054  reco::GsfElectron& gsfElectron,
1055  const std::map<reco::GsfElectronCoreRef, unsigned int>& gsfElectronCoreMap,
1056  const edm::OrphanHandle<reco::GsfElectronCoreCollection>& outgsfElectronCoreHandle) {
1057  const auto& coremapped = gsfElectronCoreMap.find(gsfElectron.core());
1058  if (coremapped != gsfElectronCoreMap.end()) {
1059  //make new ref
1060  reco::GsfElectronCoreRef coreref(outgsfElectronCoreHandle, coremapped->second);
1061  gsfElectron.setCore(coreref);
1062  }
1063 }
1064 
1066  const reco::PhotonRef& oldPhoRef,
1067  const edm::ValueMap<float>& energyMap,
1068  const edm::ValueMap<float>& energyErrMap) {
1069  float newEnergy = energyMap[oldPhoRef];
1070  float newEnergyErr = energyErrMap[oldPhoRef];
1071  photon.setCorrectedEnergy(reco::Photon::P4type::regression2, newEnergy, newEnergyErr, true);
1072 }
1073 
1075  const reco::GsfElectronRef& oldEleRef,
1076  const edm::ValueMap<float>& energyMap,
1077  const edm::ValueMap<float>& energyErrMap,
1078  const edm::ValueMap<float>& ecalEnergyMap,
1079  const edm::ValueMap<float>& ecalEnergyErrMap) {
1080  const float newEnergy = energyMap[oldEleRef];
1081  const float newEnergyErr = energyErrMap[oldEleRef];
1082  const float newEcalEnergy = ecalEnergyMap[oldEleRef];
1083  const float newEcalEnergyErr = ecalEnergyErrMap[oldEleRef];
1084 
1085  //make a copy of this as the setCorrectedEcalEnergy call with modifiy the electrons p4
1086  const math::XYZTLorentzVector oldP4 = electron.p4();
1087  const float corr = newEnergy / oldP4.E();
1088 
1089  electron.setCorrectedEcalEnergy(newEcalEnergy);
1090  electron.setCorrectedEcalEnergyError(newEcalEnergyErr);
1091 
1092  math::XYZTLorentzVector newP4{oldP4.x() * corr, oldP4.y() * corr, oldP4.z() * corr, newEnergy};
1093  electron.correctMomentum(newP4, electron.trackMomentumError(), newEnergyErr);
1094 }
ReducedEGProducer::outPhotonPfCandMap_
const std::string outPhotonPfCandMap_
Definition: ReducedEGProducer.h:200
ReducedEGProducer::endcapEcalHits_
const edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
Definition: ReducedEGProducer.h:150
muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
ReducedEGProducer::applyGsfElectronCalibOnMC_
const bool applyGsfElectronCalibOnMC_
Definition: ReducedEGProducer.h:171
muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
EGHcalRecHitSelector::setup
void setup(const edm::EventSetup &iSetup)
Definition: EGHcalRecHitSelector.h:29
ReducedEGProducer::photonCalibEnergyT_
edm::EDGetTokenT< edm::ValueMap< float > > photonCalibEnergyT_
Definition: ReducedEGProducer.h:172
ReducedEGProducer::ReducedEGProducer
ReducedEGProducer(const edm::ParameterSet &ps)
Definition: ReducedEGProducer.cc:42
EcalRecHit
Definition: EcalRecHit.h:15
ReducedEGProducer::outPhotonFloatValueMaps_
const std::vector< std::string > outPhotonFloatValueMaps_
Definition: ReducedEGProducer.h:204
edm::RefVector::clear
void clear()
Clear the vector.
Definition: RefVector.h:142
ReducedEGProducer::singleConversionT_
const edm::EDGetTokenT< reco::ConversionCollection > singleConversionT_
Definition: ReducedEGProducer.h:147
reco::SuperCluster::setPreshowerClusters
void setPreshowerClusters(const CaloClusterPtrVector &clusters)
Definition: SuperCluster.h:116
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
ReducedEGProducer::doPreshowerEcalHits_
const bool doPreshowerEcalHits_
Definition: ReducedEGProducer.h:151
MessageLogger.h
reco::SuperCluster::clusters
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
Definition: SuperCluster.h:80
ReducedEGProducer::linkCaloClusters
void linkCaloClusters(const reco::SuperCluster &superCluster, reco::CaloClusterCollection &ebeeClusters, std::map< reco::CaloClusterPtr, unsigned int > &ebeeClusterMap, std::unordered_set< DetId > &rechitMap, const edm::Handle< EcalRecHitCollection > &barrelHitHandle, const edm::Handle< EcalRecHitCollection > &endcapHitHandle, const CaloTopology *caloTopology, reco::CaloClusterCollection &esClusters, std::map< reco::CaloClusterPtr, unsigned int > &esClusterMap)
Definition: ReducedEGProducer.cc:907
ReducedEGProducer::relinkOOTPhotonSel_
const StringCutObjectSelector< reco::Photon > relinkOOTPhotonSel_
Definition: ReducedEGProducer.h:213
edm::conversion
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ReducedEGProducer::outOOTPhotons_
const std::string outOOTPhotons_
Definition: ReducedEGProducer.h:183
ReducedEGProducer::linkHcalHits
void linkHcalHits(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, std::unordered_set< DetId > &hcalDetIds)
Definition: ReducedEGProducer.cc:942
ReducedEGProducer::beginRun
void beginRun(edm::Run const &, const edm::EventSetup &) final
Definition: ReducedEGProducer.cc:192
ReducedEGProducer::calibratePhoton
static void calibratePhoton(reco::Photon &photon, const reco::PhotonRef &oldPhoRef, const edm::ValueMap< float > &energyMap, const edm::ValueMap< float > &energyErrMap)
Definition: ReducedEGProducer.cc:1065
ReducedEGProducer::outEBEEClusters_
const std::string outEBEEClusters_
Definition: ReducedEGProducer.h:191
PFCandidate.h
ReducedEGProducer::keepPhotonSel_
const StringCutObjectSelector< reco::Photon > keepPhotonSel_
Definition: ReducedEGProducer.h:208
reco::SuperCluster
Definition: SuperCluster.h:18
EcalSeverityLevelAlgoRcd.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
ReducedEGProducer::conversionT_
const edm::EDGetTokenT< reco::ConversionCollection > conversionT_
Definition: ReducedEGProducer.h:146
ootPhotons_cff.ootPhotons
ootPhotons
Definition: ootPhotons_cff.py:13
edm
HLT enums.
Definition: AlignableModifier.h:19
ReducedEGProducer::gsfElectronCalibEnergyT_
edm::EDGetTokenT< edm::ValueMap< float > > gsfElectronCalibEnergyT_
Definition: ReducedEGProducer.h:174
ReducedEGProducer::outGsfTracks_
const std::string outGsfTracks_
Definition: ReducedEGProducer.h:187
ReducedEGProducer::slimRelinkPhotonSel_
const StringCutObjectSelector< reco::Photon > slimRelinkPhotonSel_
Definition: ReducedEGProducer.h:209
HBHERecHit
Definition: HBHERecHit.h:13
ReducedEGProducer::relinkGsfTrack
void relinkGsfTrack(reco::GsfElectronCore &electroncore, const std::map< reco::GsfTrackRef, unsigned int > &gsfTrackMap, const edm::OrphanHandle< reco::GsfTrackCollection > &outGsfTrackHandle)
Definition: ReducedEGProducer.cc:1011
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
ReducedEGProducer::outOOTPhotonFloatValueMaps_
const std::vector< std::string > outOOTPhotonFloatValueMaps_
Definition: ReducedEGProducer.h:205
ReducedEGProducer::hcalHitSel_
EGHcalRecHitSelector hcalHitSel_
Definition: ReducedEGProducer.h:218
ReducedEGProducer::keepGsfElectronSel_
const StringCutObjectSelector< reco::GsfElectron > keepGsfElectronSel_
Definition: ReducedEGProducer.h:214
ootPhotonCore_cff.ootPhotonCore
ootPhotonCore
Definition: ootPhotonCore_cff.py:4
edm::EDGetTokenT::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
edm::SortedCollection< EcalRecHit >
PhotonFwd.h
ReducedEGProducer::photonPfCandMapT_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > photonPfCandMapT_
Definition: ReducedEGProducer.h:155
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition: GsfElectronFwd.h:14
printConversionInfo.conversionHandle
conversionHandle
Definition: printConversionInfo.py:15
edm::RefVector< ConversionCollection >
PhotonCore.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
EGHcalRecHitSelector::addDetIds
void addDetIds(const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
Definition: EGHcalRecHitSelector.h:49
ReducedEGProducer::outHBHERecHits_
const std::string outHBHERecHits_
Definition: ReducedEGProducer.h:199
electronIsolatorFromEffectiveArea_cfi.gsfElectrons
gsfElectrons
Definition: electronIsolatorFromEffectiveArea_cfi.py:4
edm::Handle< reco::PhotonCollection >
CaloTopology
Definition: CaloTopology.h:19
ReducedEGProducer::outEBRecHits_
const std::string outEBRecHits_
Definition: ReducedEGProducer.h:196
EcalBarrel
Definition: EcalSubdetector.h:10
ReducedEGProducer::outESRecHits_
const std::string outESRecHits_
Definition: ReducedEGProducer.h:198
EgammaHadTower.h
edm::Ref< PhotonCollection >
reco::ConversionCollection
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
ReducedEGProducer::relinkConversions
void relinkConversions(reco::PhotonCore &photonCore, const reco::ConversionRefVector &convrefs, const std::map< reco::ConversionRef, unsigned int > &conversionMap, const edm::OrphanHandle< reco::ConversionCollection > &outConversionHandle)
Definition: ReducedEGProducer.cc:1021
CaloConeSelector.h
HLT_FULL_cff.superClusters
superClusters
Definition: HLT_FULL_cff.py:15171
reco::GsfElectron::core
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
reco::SuperCluster::setSeed
void setSeed(const CaloClusterPtr &r)
list of used xtals by DetId // now inherited by CaloCluster
Definition: SuperCluster.h:107
fileCollector.seed
seed
Definition: fileCollector.py:127
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
config
Definition: config.py:1
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
DetId
Definition: DetId.h:17
Photon.h
ReducedEGProducer::relinkGsfElectronSel_
const StringCutObjectSelector< reco::GsfElectron > relinkGsfElectronSel_
Definition: ReducedEGProducer.h:216
ReducedEGProducer::linkConversionsByTrackRef
void linkConversionsByTrackRef(const edm::Handle< reco::ConversionCollection > &conversionHandle, const reco::GsfElectron &gsfElectron, reco::ConversionCollection &conversions, std::map< reco::ConversionRef, unsigned int > &conversionMap)
Definition: ReducedEGProducer.cc:857
ReducedEGProducer::linkConversion
void linkConversion(const reco::ConversionRef &convref, reco::ConversionCollection &conversions, std::map< reco::ConversionRef, unsigned int > &conversionMap)
Definition: ReducedEGProducer.cc:889
edm::RefVector::empty
bool empty() const
Is the RefVector empty.
Definition: RefVector.h:99
l1t::PFCandidateRef
edm::Ref< l1t::PFCandidateCollection > PFCandidateRef
Definition: PFCandidate.h:58
edm::PtrVector< CaloCluster >
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
reco::CaloClusterCollection
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
Definition: CaloClusterFwd.h:19
reco::PhotonCore
Definition: PhotonCore.h:24
ReducedEGProducer::preshowerEcalHits_
const edm::EDGetTokenT< EcalRecHitCollection > preshowerEcalHits_
Definition: ReducedEGProducer.h:152
metsig::electron
Definition: SignAlgoResolutions.h:48
ReducedEGProducer::applyPhotonCalibOnMC_
const bool applyPhotonCalibOnMC_
Definition: ReducedEGProducer.h:169
edm::ESHandle< CaloTopology >
ReducedEGProducer::applyGsfElectronCalibOnData_
const bool applyGsfElectronCalibOnData_
Definition: ReducedEGProducer.h:170
StringToEnumValue.h
ReducedEGProducer::photonCalibEnergyErrT_
edm::EDGetTokenT< edm::ValueMap< float > > photonCalibEnergyErrT_
Definition: ReducedEGProducer.h:173
reco::GsfElectron
Definition: GsfElectron.h:35
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
EgammaTowerIsolation.h
ecalDrivenGsfElectronCoresFromMultiCl_cff.gsfTracks
gsfTracks
Definition: ecalDrivenGsfElectronCoresFromMultiCl_cff.py:4
ReducedEGProducer::ootPhotonT_
edm::EDGetTokenT< reco::PhotonCollection > ootPhotonT_
Definition: ReducedEGProducer.h:143
ReducedEGProducer::relinkSuperCluster
void relinkSuperCluster(T &core, const std::map< reco::SuperClusterRef, unsigned int > &superClusterMap, const edm::OrphanHandle< reco::SuperClusterCollection > &outSuperClusterHandle)
Definition: ReducedEGProducer.cc:999
ReducedEGProducer::outSingleConversions_
const std::string outSingleConversions_
Definition: ReducedEGProducer.h:189
EcalSeverityLevelAlgo.h
ReducedEGProducer::gsfElectronPfCandMapT_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > gsfElectronPfCandMapT_
Definition: ReducedEGProducer.h:156
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
ReducedEGProducer::keepOOTPhotonSel_
const StringCutObjectSelector< reco::Photon > keepOOTPhotonSel_
Definition: ReducedEGProducer.h:211
ReducedEGProducer::relinkPhotonCore
void relinkPhotonCore(reco::Photon &photon, const std::map< reco::PhotonCoreRef, unsigned int > &photonCoreMap, const edm::OrphanHandle< reco::PhotonCoreCollection > &outPhotonCoreHandle)
Definition: ReducedEGProducer.cc:1042
EcalEndcap
Definition: EcalSubdetector.h:10
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
ReducedEGProducer::outOOTESClusters_
const std::string outOOTESClusters_
Definition: ReducedEGProducer.h:195
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
edm::PtrVector::push_back
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
ClusterShape.h
ReducedEGProducer::linkConversions
void linkConversions(const reco::ConversionRefVector &convrefs, reco::ConversionCollection &conversions, std::map< reco::ConversionRef, unsigned int > &conversionMap)
Definition: ReducedEGProducer.cc:849
ReducedEGProducer::hbheHits_
const edm::EDGetTokenT< HBHERecHitCollection > hbheHits_
Definition: ReducedEGProducer.h:153
CaloSubdetectorGeometry.h
core
Definition: __init__.py:1
edm::ParameterSet
Definition: ParameterSet.h:47
ReducedEGProducer::relinkCaloClusters
void relinkCaloClusters(reco::SuperCluster &superCluster, const std::map< reco::CaloClusterPtr, unsigned int > &ebeeClusterMap, const std::map< reco::CaloClusterPtr, unsigned int > &esClusterMap, const edm::OrphanHandle< reco::CaloClusterCollection > &outEBEEClusterHandle, const edm::OrphanHandle< reco::CaloClusterCollection > &outESClusterHandle)
Definition: ReducedEGProducer.cc:948
ReducedEGProducer::outGsfElectronIds_
const std::vector< std::string > outGsfElectronIds_
Definition: ReducedEGProducer.h:203
reco::SuperCluster::seed
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
reco::SuperCluster::setClusters
void setClusters(const CaloClusterPtrVector &clusters)
Definition: SuperCluster.h:110
ReducedEGProducer::ootPhotonFloatValueMapTs_
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > ootPhotonFloatValueMapTs_
Definition: ReducedEGProducer.h:162
ReducedEGProducer::gsfElectronFloatValueMapTs_
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > gsfElectronFloatValueMapTs_
Definition: ReducedEGProducer.h:163
ReducedEGProducer::outGsfElectronPfCandMap_
const std::string outGsfElectronPfCandMap_
Definition: ReducedEGProducer.h:201
edm::PtrVectorBase::empty
bool empty() const
Is the RefVector empty.
Definition: PtrVectorBase.h:70
edm::EventBase::isRealData
bool isRealData() const
Definition: EventBase.h:62
ReducedEGProducer::outGsfElectrons_
const std::string outGsfElectrons_
Definition: ReducedEGProducer.h:185
ConversionTools::matchesConversion
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
Definition: ConversionTools.cc:53
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
ReducedEGProducer::outESClusters_
const std::string outESClusters_
Definition: ReducedEGProducer.h:192
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
ReducedEGProducer::outOOTSuperClusters_
const std::string outOOTSuperClusters_
Definition: ReducedEGProducer.h:193
ReducedEGProducer::linkSuperCluster
void linkSuperCluster(const reco::SuperClusterRef &superCluster, std::map< reco::SuperClusterRef, unsigned int > &superClusterMap, reco::SuperClusterCollection &superClusters, const bool relink, std::unordered_set< unsigned int > &superClusterFullRelinkMap)
Definition: ReducedEGProducer.cc:827
reco::GsfElectronCore
Definition: GsfElectronCore.h:32
ReducedEGProducer::gsfElectronIdTs_
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > gsfElectronIdTs_
Definition: ReducedEGProducer.h:159
ReducedEGProducer::gsfElectronCalibEnergyErrT_
edm::EDGetTokenT< edm::ValueMap< float > > gsfElectronCalibEnergyErrT_
Definition: ReducedEGProducer.h:175
photonCore_cfi.photonCore
photonCore
Definition: photonCore_cfi.py:7
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
ReducedEGProducer::gsfElectronCalibEcalEnergyErrT_
edm::EDGetTokenT< edm::ValueMap< float > > gsfElectronCalibEcalEnergyErrT_
Definition: ReducedEGProducer.h:177
ReducedEGProducer::calibrateElectron
static void calibrateElectron(reco::GsfElectron &gsfElectron, const reco::GsfElectronRef &oldEleRef, const edm::ValueMap< float > &energyMap, const edm::ValueMap< float > &energyErrMap, const edm::ValueMap< float > &ecalEnergyMap, const edm::ValueMap< float > &ecalEnergyErrMap)
Definition: ReducedEGProducer.cc:1074
ReducedEGProducer::outPhotons_
const std::string outPhotons_
Definition: ReducedEGProducer.h:181
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
edm::EventSetup
Definition: EventSetup.h:57
ReducedEGProducer::relinkGsfElectronCore
void relinkGsfElectronCore(reco::GsfElectron &gsfElectron, const std::map< reco::GsfElectronCoreRef, unsigned int > &gsfElectronCoreMap, const edm::OrphanHandle< reco::GsfElectronCoreCollection > &outGsfElectronCoreHandle)
Definition: ReducedEGProducer.cc:1053
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::PtrVectorBase::clear
void clear()
Clear the PtrVector.
Definition: PtrVectorBase.h:79
DetId::Ecal
Definition: DetId.h:27
ReducedEGProducer::outGsfElectronCores_
const std::string outGsfElectronCores_
Definition: ReducedEGProducer.h:186
ReducedEGProducer::outOOTEBEEClusters_
const std::string outOOTEBEEClusters_
Definition: ReducedEGProducer.h:194
ReducedEGProducer::slimRelinkGsfElectronSel_
const StringCutObjectSelector< reco::GsfElectron > slimRelinkGsfElectronSel_
Definition: ReducedEGProducer.h:215
PFCandidateEGammaExtraFwd.h
ReducedEGProducer::photonFloatValueMapTs_
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > photonFloatValueMapTs_
Definition: ReducedEGProducer.h:161
ReducedEGProducer::linkCore
void linkCore(const T &core, U &cores, std::map< T, unsigned int > &coreMap)
Definition: ReducedEGProducer.cc:820
reducedEgamma_cfi.singleConversions
singleConversions
Definition: reducedEgamma_cfi.py:20
edm::Ptr< CaloCluster >
ReducedEGProducer::relinkPhotonSel_
const StringCutObjectSelector< reco::Photon > relinkPhotonSel_
Definition: ReducedEGProducer.h:210
CaloTopology.h
ValueMap.h
CaloSubdetectorTopology::getWindow
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: CaloSubdetectorTopology.cc:4
VertexFwd.h
reco::Photon
Definition: Photon.h:21
ReducedEGProducer.h
ReducedEGProducer::outConversions_
const std::string outConversions_
Definition: ReducedEGProducer.h:188
ReducedEGProducer::photonIdTs_
std::vector< edm::EDGetTokenT< edm::ValueMap< bool > > > photonIdTs_
Definition: ReducedEGProducer.h:158
PA_ZEESkim_cff.decay
decay
Definition: PA_ZEESkim_cff.py:26
reco::GsfTrackCollection
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
ReducedEGProducer::outOOTPhotonCores_
const std::string outOOTPhotonCores_
Definition: ReducedEGProducer.h:184
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
ReducedEGProducer::outEERecHits_
const std::string outEERecHits_
Definition: ReducedEGProducer.h:197
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::OrphanHandle
Definition: EDProductfwd.h:39
ReducedEGProducer::slimRelinkOOTPhotonSel_
const StringCutObjectSelector< reco::Photon > slimRelinkOOTPhotonSel_
Definition: ReducedEGProducer.h:212
ReducedEGProducer::produce
void produce(edm::Event &evt, const edm::EventSetup &es) final
Definition: ReducedEGProducer.cc:194
T
long double T
Definition: Basic3DVectorLD.h:48
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
ReducedEGProducer::barrelEcalHits_
const edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
Definition: ReducedEGProducer.h:149
PFCandidateEGammaExtra.h
edm::ValueMap
Definition: ValueMap.h:107
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:246
reco::GsfElectronCore::gsfTrack
const GsfTrackRef & gsfTrack() const
Definition: GsfElectronCore.h:48
ReducedEGProducer::photonT_
const edm::EDGetTokenT< reco::PhotonCollection > photonT_
Definition: ReducedEGProducer.h:142
HLT_FULL_cff.cores
cores
Definition: HLT_FULL_cff.py:104305
ReducedEGProducer::outSuperClusters_
const std::string outSuperClusters_
Definition: ReducedEGProducer.h:190
HcalRecHitCollections.h
ReducedEGProducer::caloTopology_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopology_
Definition: ReducedEGProducer.h:179
Exception.h
ReducedEGProducer::linkCaloCluster
void linkCaloCluster(const reco::CaloClusterPtr &caloCluster, reco::CaloClusterCollection &caloClusters, std::map< reco::CaloClusterPtr, unsigned int > &caloClusterMap)
Definition: ReducedEGProducer.cc:898
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
ReducedEGProducer::gsfElectronCalibEcalEnergyT_
edm::EDGetTokenT< edm::ValueMap< float > > gsfElectronCalibEcalEnergyT_
Definition: ReducedEGProducer.h:176
reco::SuperCluster::preshowerClusters
const CaloClusterPtrVector & preshowerClusters() const
const access to the preshower cluster list itself
Definition: SuperCluster.h:83
ReducedEGProducer::outGsfElectronFloatValueMaps_
const std::vector< std::string > outGsfElectronFloatValueMaps_
Definition: ReducedEGProducer.h:206
ReducedEGProducer::gsfElectronT_
const edm::EDGetTokenT< reco::GsfElectronCollection > gsfElectronT_
Definition: ReducedEGProducer.h:144
pwdgSkimBPark_cfi.conversions
conversions
Definition: pwdgSkimBPark_cfi.py:10
edm::Event
Definition: Event.h:73
ReducedEGProducer::outPhotonCores_
const std::string outPhotonCores_
Definition: ReducedEGProducer.h:182
ReducedEGProducer::applyPhotonCalibOnData_
const bool applyPhotonCalibOnData_
Definition: ReducedEGProducer.h:168
ReducedEGProducer::gsfTrackT_
const edm::EDGetTokenT< reco::GsfTrackCollection > gsfTrackT_
Definition: ReducedEGProducer.h:145
ReducedEGProducer::recoHIPhotonIsolationMapOutputName_
const std::string recoHIPhotonIsolationMapOutputName_
Definition: ReducedEGProducer.h:166
keep
const int keep
Definition: GenParticlePruner.cc:48
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:338
reco::GsfElectron::setCore
void setCore(const reco::GsfElectronCoreRef &core)
Definition: GsfElectron.h:160
reco::GsfElectronCore::setGsfTrack
void setGsfTrack(const GsfTrackRef &gsfTrack)
Definition: GsfElectronCore.h:67
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
ReducedEGProducer::outPhotonIds_
const std::vector< std::string > outPhotonIds_
Definition: ReducedEGProducer.h:202
ElectronSeed.h
ConversionTools.h
ReducedEGProducer::recoHIPhotonIsolationMapInputToken_
const edm::EDGetTokenT< reco::HIPhotonIsolationMap > recoHIPhotonIsolationMapInputToken_
Definition: ReducedEGProducer.h:165
Conversion.h