From 4527fac59e1f7da9fcef65703360b1d4816f03e7 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 29 May 2018 16:25:01 +0200 Subject: [PATCH 1/9] Remove OOT photons from 2018 heavy-ion (AA) era --- .../python/reducedRecHitsSequence_cff.py | 54 ++++- .../interestingEgammaIsoDetIdsSequence_cff.py | 9 + .../interface/ReducedEGProducer.h | 1 + .../src/ReducedEGProducer.cc | 187 ++++++++++-------- .../python/HcalHitSelection_cfi.py | 8 + .../python/particleFlowEGamma_cff.py | 4 + 6 files changed, 173 insertions(+), 90 deletions(-) diff --git a/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py b/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py index 32a726dc90e19..5e84c2273f2a0 100644 --- a/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py +++ b/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py @@ -141,11 +141,11 @@ cms.InputTag("interestingEcalDetIdPFES"), cms.InputTag("interestingEcalDetIdRefinedES"), cms.InputTag("interestingEcalDetIdOOTPFES"), - ), + ), interestingDetIdsNotToClean = cms.VInputTag( - cms.InputTag("interestingGedEgammaIsoESDetId"), - cms.InputTag("interestingOotEgammaIsoESDetId"), - ) + cms.InputTag("interestingGedEgammaIsoESDetId"), + cms.InputTag("interestingOotEgammaIsoESDetId"), + ) ) #selected digis @@ -180,3 +180,49 @@ _fastSim_reducedEcalRecHitsTask = reducedEcalRecHitsTask.copyAndExclude(seldigisTask) from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toReplaceWith( reducedEcalRecHitsTask, _fastSim_reducedEcalRecHitsTask) + +_pp_on_AA_reducedEcalRecHitsTask = reducedEcalRecHitsTask.copy() +_pp_on_AA_reducedEcalRecHitsTask.remove(interestingEcalDetIdOOTPFEB) +_pp_on_AA_reducedEcalRecHitsTask.remove(interestingEcalDetIdOOTPFEE) +_pp_on_AA_reducedEcalRecHitsTask.remove(interestingEcalDetIdOOTPFES) + +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +pp_on_AA_2018.toReplaceWith(reducedEcalRecHitsTask, _pp_on_AA_reducedEcalRecHitsTask) + +_pp_on_AA_interestingDetIdsEB = cms.VInputTag( + cms.InputTag("interestingEcalDetIdEB"), + cms.InputTag("interestingEcalDetIdEBU"), + cms.InputTag("interestingEcalDetIdPFEB"), + cms.InputTag("interestingEcalDetIdRefinedEB"), + cms.InputTag("interestingGedEleIsoDetIdEB"), + cms.InputTag("interestingGedGamIsoDetIdEB"), + cms.InputTag("interestingGamIsoDetIdEB"), + cms.InputTag("muonEcalDetIds"), + cms.InputTag("interestingTrackEcalDetIds") + ) +_pp_on_AA_interestingDetIdsEE = cms.VInputTag( + cms.InputTag("interestingEcalDetIdEE"), + cms.InputTag("interestingEcalDetIdPFEE"), + cms.InputTag("interestingEcalDetIdRefinedEE"), + cms.InputTag("interestingGedEleIsoDetIdEE"), + cms.InputTag("interestingGedGamIsoDetIdEE"), + cms.InputTag("interestingGamIsoDetIdEE"), + cms.InputTag("muonEcalDetIds"), + cms.InputTag("interestingTrackEcalDetIds") + ) +_pp_on_AA_interestingDetIdsES = cms.VInputTag(cms.InputTag("interestingEcalDetIdPFES"),cms.InputTag("interestingEcalDetIdRefinedES")) +_pp_on_AA_interestingDetIdsNotToClean = cms.VInputTag(cms.InputTag("interestingGedEgammaIsoESDetId")) + +pp_on_AA_2018.toModify( + reducedEcalRecHitsEB, + interestingDetIdCollections = _pp_on_AA_interestingDetIdsEB, + ) +pp_on_AA_2018.toModify( + reducedEcalRecHitsEE, + interestingDetIdCollections = _pp_on_AA_interestingDetIdsEE, + ) +pp_on_AA_2018.toModify( + reducedEcalRecHitsES, + interestingDetIds = _pp_on_AA_interestingDetIdsES, + interestingDetIdsNotToClean = _pp_on_AA_interestingDetIdsNotToClean + ) diff --git a/RecoEgamma/EgammaIsolationAlgos/python/interestingEgammaIsoDetIdsSequence_cff.py b/RecoEgamma/EgammaIsolationAlgos/python/interestingEgammaIsoDetIdsSequence_cff.py index fff8e1f14a498..11ed6dd9e6cda 100644 --- a/RecoEgamma/EgammaIsolationAlgos/python/interestingEgammaIsoDetIdsSequence_cff.py +++ b/RecoEgamma/EgammaIsolationAlgos/python/interestingEgammaIsoDetIdsSequence_cff.py @@ -122,3 +122,12 @@ interestingOotEgammaIsoESDetId ) interestingEgammaIsoDetIds = cms.Sequence(interestingEgammaIsoDetIdsTask) + +_pp_on_AA_interestingEgammaIsoDetIdsTask = interestingEgammaIsoDetIdsTask.copy() +_pp_on_AA_interestingEgammaIsoDetIdsTask.remove(interestingOotGamIsoDetIdEB) +_pp_on_AA_interestingEgammaIsoDetIdsTask.remove(interestingOotGamIsoDetIdEE) +_pp_on_AA_interestingEgammaIsoDetIdsTask.remove(interestingOotEgammaIsoHCALDetId) +_pp_on_AA_interestingEgammaIsoDetIdsTask.remove(interestingOotEgammaIsoESDetId) + +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +pp_on_AA_2018.toReplaceWith(interestingEgammaIsoDetIdsTask, _pp_on_AA_interestingEgammaIsoDetIdsTask) diff --git a/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h b/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h index e0fb20bad6240..11248b76cdb3a 100644 --- a/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h +++ b/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h @@ -145,6 +145,7 @@ class ReducedEGProducer : public edm::stream::EDProducer<> { //tokens for input collections const edm::EDGetTokenT photonT_; + const bool doOotPhotons_; const edm::EDGetTokenT ootPhotonT_; const edm::EDGetTokenT gsfElectronT_; const edm::EDGetTokenT gsfTrackT_; diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index ced16c9dfbc1d..20082723ea9c4 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -46,7 +46,10 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : photonT_(consumes(config.getParameter("photons"))), - ootPhotonT_(consumes(config.getParameter("ootPhotons"))), + doOotPhotons_(!config.getParameter("ootPhotons").label().empty()), + //doOotPhotons_(config.getParameter("doOotPhotons")), + ootPhotonT_(doOotPhotons_ ? consumes(config.getParameter("ootPhotons")) : edm::EDGetTokenT()), + //if(doOotPhotons_) ootPhotonT_(consumes(config.getParameter("ootPhotons"))), gsfElectronT_(consumes(config.getParameter("gsfElectrons"))), gsfTrackT_(consumes(config.getParameter("gsfTracks"))), conversionT_(consumes(config.getParameter("conversions"))), @@ -115,7 +118,7 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : for (const edm::InputTag &tag : photonpfclusterisoinputs) { photonFloatValueMapTs_.emplace_back(consumes >(tag)); } - + std::cout<<" 1 "<& ootphotonpfclusterisoinputs = config.getParameter >("ootPhotonFloatValueMapSources"); for (const edm::InputTag &tag : ootphotonpfclusterisoinputs) { @@ -187,10 +190,10 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the edm::Handle photonHandle; theEvent.getByToken(photonT_, photonHandle); - + std::cout<<" 2 "< ootPhotonHandle; - theEvent.getByToken(ootPhotonT_, ootPhotonHandle); - + if(doOotPhotons_)theEvent.getByToken(ootPhotonT_, ootPhotonHandle); + std::cout<<" 3 "< gsfElectronHandle; theEvent.getByToken(gsfElectronT_, gsfElectronHandle); @@ -235,13 +238,15 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the for (const auto& photonFloatValueMapT : photonFloatValueMapTs_) { theEvent.getByToken(photonFloatValueMapT,photonFloatValueMapHandles[index++]); } - + std::cout<<" 4 "< > > ootPhotonFloatValueMapHandles(ootPhotonFloatValueMapTs_.size()); - index = 0; - for (const auto& ootPhotonFloatValueMapT : ootPhotonFloatValueMapTs_) { - theEvent.getByToken(ootPhotonFloatValueMapT,ootPhotonFloatValueMapHandles[index++]); - } - + if (doOotPhotons_){ + index = 0; + for (const auto& ootPhotonFloatValueMapT : ootPhotonFloatValueMapTs_) { + theEvent.getByToken(ootPhotonFloatValueMapT,ootPhotonFloatValueMapHandles[index++]); + } + } + std::cout<<" 5 "< > > gsfElectronFloatValueMapHandles(gsfElectronFloatValueMapTs_.size()); index = 0; for (const auto& gsfElectronFloatValueMapT : gsfElectronFloatValueMapTs_) { @@ -381,42 +386,44 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the const reco::ConversionRefVector &singleconvrefs = photon.conversionsOneLeg(); linkConversions(singleconvrefs, *singleConversions, singleConversionMap); } - + std::cout<<" 7, doOotPhotons_ "< no PF isolation, IDs (but we do have FloatValueMap!) //special note2: conversion sequence not run over bcs from oot phos, so skip relinking of oot phos //special note3: clusters and superclusters in own collections! - index = -1; - for (const auto& ootPhoton : *ootPhotonHandle) { - index++; - - bool keep = keepOOTPhotonSel_(ootPhoton); - if (!keep) continue; - - reco::PhotonRef ootPhotonref(ootPhotonHandle,index); - - ootPhotons->push_back(ootPhoton); - - //fill photon pfclusteriso valuemap vectors - int subindex = 0; - for (const auto& ootPhotonFloatValueMapHandle : ootPhotonFloatValueMapHandles) { - ootPhotonFloatValueMapVals[subindex++].push_back((*ootPhotonFloatValueMapHandle)[ootPhotonref]); - } - - //link photon core - const reco::PhotonCoreRef &ootPhotonCore = ootPhoton.photonCore(); - linkCore(ootPhotonCore, *ootPhotonCores, ootPhotonCoreMap); - - bool slimRelink = slimRelinkOOTPhotonSel_(ootPhoton); - //no supercluster relinking unless slimRelink selection is satisfied - if (!slimRelink) continue; - - bool relink = relinkOOTPhotonSel_(ootPhoton); - - const reco::SuperClusterRef &ootSuperCluster = ootPhoton.superCluster(); - linkSuperCluster(ootSuperCluster, ootSuperClusterMap, *ootSuperClusters, relink, ootSuperClusterFullRelinkMap); + if(doOotPhotons_) { + index = -1; + for (const auto& ootPhoton : *ootPhotonHandle) { + index++; + std::cout<<" 8 "<push_back(ootPhoton); + + //fill photon pfclusteriso valuemap vectors + int subindex = 0; + for (const auto& ootPhotonFloatValueMapHandle : ootPhotonFloatValueMapHandles) { + ootPhotonFloatValueMapVals[subindex++].push_back((*ootPhotonFloatValueMapHandle)[ootPhotonref]); + } + + //link photon core + const reco::PhotonCoreRef &ootPhotonCore = ootPhoton.photonCore(); + linkCore(ootPhotonCore, *ootPhotonCores, ootPhotonCoreMap); + + bool slimRelink = slimRelinkOOTPhotonSel_(ootPhoton); + //no supercluster relinking unless slimRelink selection is satisfied + if (!slimRelink) continue; + + bool relink = relinkOOTPhotonSel_(ootPhoton); + + const reco::SuperClusterRef &ootSuperCluster = ootPhoton.superCluster(); + linkSuperCluster(ootSuperCluster, ootSuperClusterMap, *ootSuperClusters, relink, ootSuperClusterFullRelinkMap); + } } - + std::cout<<" 10 "<push_back(rechit); } } - - theEvent.put(std::move(ebRecHits),outEBRecHits_); - theEvent.put(std::move(eeRecHits),outEERecHits_); + + if(doOotPhotons_) { + theEvent.put(std::move(ebRecHits),outEBRecHits_); + theEvent.put(std::move(eeRecHits),outEERecHits_); + } if (doPreshowerEcalHits_) { for (const EcalRecHit &rechit : *preshowerHitHandle) { @@ -580,17 +590,17 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the for (reco::SuperCluster &superCluster : *superClusters) { relinkCaloClusters(superCluster, ebeeClusterMap, esClusterMap, outEBEEClusterHandle, outESClusterHandle); } - - //OOTCaloClusters - //put ootcalocluster output collections in event and get orphan handles to create ptrs - const edm::OrphanHandle &outOOTEBEEClusterHandle = theEvent.put(std::move(ootEbeeClusters),outOOTEBEEClusters_); - const edm::OrphanHandle &outOOTESClusterHandle = theEvent.put(std::move(ootEsClusters),outOOTESClusters_);; - - //Loop over OOTSuperClusters and relink OOTPhoton CaloClusters - for (reco::SuperCluster &ootSuperCluster : *ootSuperClusters) { - relinkCaloClusters(ootSuperCluster, ootEbeeClusterMap, ootEsClusterMap, outOOTEBEEClusterHandle, outOOTESClusterHandle); + if(doOotPhotons_) { + //OOTCaloClusters + //put ootcalocluster output collections in event and get orphan handles to create ptrs + const edm::OrphanHandle &outOOTEBEEClusterHandle = theEvent.put(std::move(ootEbeeClusters),outOOTEBEEClusters_); + const edm::OrphanHandle &outOOTESClusterHandle = theEvent.put(std::move(ootEsClusters),outOOTESClusters_);; + + //Loop over OOTSuperClusters and relink OOTPhoton CaloClusters + for (reco::SuperCluster &ootSuperCluster : *ootSuperClusters) { + relinkCaloClusters(ootSuperCluster, ootEbeeClusterMap, ootEsClusterMap, outOOTEBEEClusterHandle, outOOTESClusterHandle); + } } - //put superclusters and conversions in the event const edm::OrphanHandle &outSuperClusterHandle = theEvent.put(std::move(superClusters),outSuperClusters_); const edm::OrphanHandle &outConversionHandle = theEvent.put(std::move(conversions),outConversions_); @@ -617,14 +627,15 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the relinkGsfTrack(gsfElectronCore, gsfTrackMap, outGsfTrackHandle); } - //put ootsuperclusters in the event - const edm::OrphanHandle &outOOTSuperClusterHandle = theEvent.put(std::move(ootSuperClusters),outOOTSuperClusters_); - - //Relink OOTPhoton SuperClusters - for (reco::PhotonCore &ootPhotonCore : *ootPhotonCores) { - relinkSuperCluster(ootPhotonCore, ootSuperClusterMap, outOOTSuperClusterHandle); + if(doOotPhotons_) { + //put ootsuperclusters in the event + const edm::OrphanHandle &outOOTSuperClusterHandle = theEvent.put(std::move(ootSuperClusters),outOOTSuperClusters_); + + //Relink OOTPhoton SuperClusters + for (reco::PhotonCore &ootPhotonCore : *ootPhotonCores) { + relinkSuperCluster(ootPhotonCore, ootSuperClusterMap, outOOTSuperClusterHandle); + } } - //put photoncores and gsfelectroncores into the event const edm::OrphanHandle &outPhotonCoreHandle = theEvent.put(std::move(photonCores),outPhotonCores_); const edm::OrphanHandle &outOOTPhotonCoreHandle = theEvent.put(std::move(ootPhotonCores),outOOTPhotonCores_); @@ -635,10 +646,12 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the relinkPhotonCore(photon, photonCoreMap, outPhotonCoreHandle); } - for (reco::Photon &ootPhoton : *ootPhotons) { - relinkPhotonCore(ootPhoton, ootPhotonCoreMap, outOOTPhotonCoreHandle); + if(doOotPhotons_) { + for (reco::Photon &ootPhoton : *ootPhotons) { + relinkPhotonCore(ootPhoton, ootPhotonCoreMap, outOOTPhotonCoreHandle); + } } - + for (reco::GsfElectron &gsfElectron : *gsfElectrons) { relinkGsfElectronCore(gsfElectron, gsfElectronCoreMap, outgsfElectronCoreHandle); @@ -721,10 +734,12 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the fillMap(outPhotonHandle, vals, theEvent, outPhotonFloatValueMaps_[index++]); } - //oot photon iso value maps - index = 0; - for (auto const& vals : ootPhotonFloatValueMapVals){ - fillMap(outOOTPhotonHandle, vals, theEvent, outOOTPhotonFloatValueMaps_[index++]); + if(doOotPhotons_) { + //oot photon iso value maps + index = 0; + for (auto const& vals : ootPhotonFloatValueMapVals){ + fillMap(outOOTPhotonHandle, vals, theEvent, outOOTPhotonFloatValueMaps_[index++]); + } } //electron iso value maps diff --git a/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py index b867132f261f4..10fd379896755 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py @@ -10,3 +10,11 @@ cms.InputTag("interestingOotEgammaIsoHCALDetId"), ) ) + +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +_pp_on_AA_interestingDetIds = cms.VInputTag([cms.InputTag("interestingGedEgammaIsoHCALDetId")]) + +pp_on_AA_2018.toModify( + reducedHcalRecHits, + interestingDetIds = _pp_on_AA_interestingDetIds + ) diff --git a/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py b/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py index f41f32ba71889..8cac9b40b2807 100644 --- a/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py +++ b/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py @@ -56,3 +56,7 @@ particleFlowEGammaFull = cms.Sequence(particleFlowEGamma*gedGsfElectronSequenceTmp*gedPhotonSequenceTmp*ootPhotonSequence) particleFlowEGammaFinal = cms.Sequence(particleBasedIsolationTmp*pfNoPileUpIsoSequence*pfNoPileUpCandidates*pfPileUpAllChargedParticles*\ egmPhotonIsolationCITK*egmElectronIsolationCITK*egmElectronIsolationPileUpCITK*gedPhotonSequence*gedElectronPFIsoSequence) + +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +for e in [pp_on_AA_2018]: + e.toReplaceWith(particleFlowEGammaFull, particleFlowEGammaFull.copyAndExclude([ootPhotonSequence])) From c186f546c56a902b259a5362360195dd4040563e Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 29 May 2018 16:33:26 +0200 Subject: [PATCH 2/9] had forgotten some couts --- .../src/ReducedEGProducer.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index 20082723ea9c4..a2e611de2b778 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -118,7 +118,7 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : for (const edm::InputTag &tag : photonpfclusterisoinputs) { photonFloatValueMapTs_.emplace_back(consumes >(tag)); } - std::cout<<" 1 "<& ootphotonpfclusterisoinputs = config.getParameter >("ootPhotonFloatValueMapSources"); for (const edm::InputTag &tag : ootphotonpfclusterisoinputs) { @@ -190,10 +190,10 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the edm::Handle photonHandle; theEvent.getByToken(photonT_, photonHandle); - std::cout<<" 2 "< ootPhotonHandle; if(doOotPhotons_)theEvent.getByToken(ootPhotonT_, ootPhotonHandle); - std::cout<<" 3 "< gsfElectronHandle; theEvent.getByToken(gsfElectronT_, gsfElectronHandle); @@ -238,7 +238,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the for (const auto& photonFloatValueMapT : photonFloatValueMapTs_) { theEvent.getByToken(photonFloatValueMapT,photonFloatValueMapHandles[index++]); } - std::cout<<" 4 "< > > ootPhotonFloatValueMapHandles(ootPhotonFloatValueMapTs_.size()); if (doOotPhotons_){ index = 0; @@ -246,7 +246,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the theEvent.getByToken(ootPhotonFloatValueMapT,ootPhotonFloatValueMapHandles[index++]); } } - std::cout<<" 5 "< > > gsfElectronFloatValueMapHandles(gsfElectronFloatValueMapTs_.size()); index = 0; for (const auto& gsfElectronFloatValueMapT : gsfElectronFloatValueMapTs_) { @@ -386,7 +386,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the const reco::ConversionRefVector &singleconvrefs = photon.conversionsOneLeg(); linkConversions(singleconvrefs, *singleConversions, singleConversionMap); } - std::cout<<" 7, doOotPhotons_ "< no PF isolation, IDs (but we do have FloatValueMap!) //special note2: conversion sequence not run over bcs from oot phos, so skip relinking of oot phos @@ -395,10 +395,10 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the index = -1; for (const auto& ootPhoton : *ootPhotonHandle) { index++; - std::cout<<" 8 "<push_back(ootPhoton); @@ -423,7 +423,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the linkSuperCluster(ootSuperCluster, ootSuperClusterMap, *ootSuperClusters, relink, ootSuperClusterFullRelinkMap); } } - std::cout<<" 10 "< Date: Tue, 29 May 2018 16:36:59 +0200 Subject: [PATCH 3/9] more comment cleanups --- RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index a2e611de2b778..1a44afbe40aca 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -47,9 +47,7 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : photonT_(consumes(config.getParameter("photons"))), doOotPhotons_(!config.getParameter("ootPhotons").label().empty()), - //doOotPhotons_(config.getParameter("doOotPhotons")), ootPhotonT_(doOotPhotons_ ? consumes(config.getParameter("ootPhotons")) : edm::EDGetTokenT()), - //if(doOotPhotons_) ootPhotonT_(consumes(config.getParameter("ootPhotons"))), gsfElectronT_(consumes(config.getParameter("gsfElectrons"))), gsfTrackT_(consumes(config.getParameter("gsfTracks"))), conversionT_(consumes(config.getParameter("conversions"))), From 414283daf7dd2ddcd22c03e66c6702fcdd475317 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 29 May 2018 16:44:26 +0200 Subject: [PATCH 4/9] remove unnecessary for loop --- RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py b/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py index 8cac9b40b2807..321a27893af3e 100644 --- a/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py +++ b/RecoParticleFlow/PFProducer/python/particleFlowEGamma_cff.py @@ -58,5 +58,4 @@ egmPhotonIsolationCITK*egmElectronIsolationCITK*egmElectronIsolationPileUpCITK*gedPhotonSequence*gedElectronPFIsoSequence) from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 -for e in [pp_on_AA_2018]: - e.toReplaceWith(particleFlowEGammaFull, particleFlowEGammaFull.copyAndExclude([ootPhotonSequence])) +pp_on_AA_2018.toReplaceWith(particleFlowEGammaFull, particleFlowEGammaFull.copyAndExclude([ootPhotonSequence])) From 86838b91d4848cc7a279a11e520aacd8066ae4ce Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 29 May 2018 23:33:53 +0200 Subject: [PATCH 5/9] addressed Slava's comments --- .../python/reducedRecHitsSequence_cff.py | 47 +++----------- .../interface/ReducedEGProducer.h | 1 - .../src/ReducedEGProducer.cc | 63 ++++++++++--------- .../python/HcalHitSelection_cfi.py | 7 +-- 4 files changed, 42 insertions(+), 76 deletions(-) diff --git a/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py b/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py index 5e84c2273f2a0..949ee4e8588e8 100644 --- a/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py +++ b/RecoEcal/EgammaClusterProducers/python/reducedRecHitsSequence_cff.py @@ -141,11 +141,11 @@ cms.InputTag("interestingEcalDetIdPFES"), cms.InputTag("interestingEcalDetIdRefinedES"), cms.InputTag("interestingEcalDetIdOOTPFES"), - ), + ), interestingDetIdsNotToClean = cms.VInputTag( cms.InputTag("interestingGedEgammaIsoESDetId"), cms.InputTag("interestingOotEgammaIsoESDetId"), - ) + ) ) #selected digis @@ -189,40 +189,9 @@ from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 pp_on_AA_2018.toReplaceWith(reducedEcalRecHitsTask, _pp_on_AA_reducedEcalRecHitsTask) -_pp_on_AA_interestingDetIdsEB = cms.VInputTag( - cms.InputTag("interestingEcalDetIdEB"), - cms.InputTag("interestingEcalDetIdEBU"), - cms.InputTag("interestingEcalDetIdPFEB"), - cms.InputTag("interestingEcalDetIdRefinedEB"), - cms.InputTag("interestingGedEleIsoDetIdEB"), - cms.InputTag("interestingGedGamIsoDetIdEB"), - cms.InputTag("interestingGamIsoDetIdEB"), - cms.InputTag("muonEcalDetIds"), - cms.InputTag("interestingTrackEcalDetIds") - ) -_pp_on_AA_interestingDetIdsEE = cms.VInputTag( - cms.InputTag("interestingEcalDetIdEE"), - cms.InputTag("interestingEcalDetIdPFEE"), - cms.InputTag("interestingEcalDetIdRefinedEE"), - cms.InputTag("interestingGedEleIsoDetIdEE"), - cms.InputTag("interestingGedGamIsoDetIdEE"), - cms.InputTag("interestingGamIsoDetIdEE"), - cms.InputTag("muonEcalDetIds"), - cms.InputTag("interestingTrackEcalDetIds") - ) -_pp_on_AA_interestingDetIdsES = cms.VInputTag(cms.InputTag("interestingEcalDetIdPFES"),cms.InputTag("interestingEcalDetIdRefinedES")) -_pp_on_AA_interestingDetIdsNotToClean = cms.VInputTag(cms.InputTag("interestingGedEgammaIsoESDetId")) - -pp_on_AA_2018.toModify( - reducedEcalRecHitsEB, - interestingDetIdCollections = _pp_on_AA_interestingDetIdsEB, - ) -pp_on_AA_2018.toModify( - reducedEcalRecHitsEE, - interestingDetIdCollections = _pp_on_AA_interestingDetIdsEE, - ) -pp_on_AA_2018.toModify( - reducedEcalRecHitsES, - interestingDetIds = _pp_on_AA_interestingDetIdsES, - interestingDetIdsNotToClean = _pp_on_AA_interestingDetIdsNotToClean - ) +pp_on_AA_2018.toModify(reducedEcalRecHitsEB.interestingDetIdCollections, func = lambda list: list.remove(cms.InputTag("interestingEcalDetIdOOTPFEB")) ) +pp_on_AA_2018.toModify(reducedEcalRecHitsEB.interestingDetIdCollections, func = lambda list: list.remove(cms.InputTag("interestingOotGamIsoDetIdEB")) ) +pp_on_AA_2018.toModify(reducedEcalRecHitsEE.interestingDetIdCollections, func = lambda list: list.remove(cms.InputTag("interestingEcalDetIdOOTPFEE")) ) +pp_on_AA_2018.toModify(reducedEcalRecHitsEE.interestingDetIdCollections, func = lambda list: list.remove(cms.InputTag("interestingOotGamIsoDetIdEE")) ) +pp_on_AA_2018.toModify(reducedEcalRecHitsES.interestingDetIds, func = lambda list: list.remove(cms.InputTag("interestingEcalDetIdOOTPFES")) ) +pp_on_AA_2018.toModify(reducedEcalRecHitsES.interestingDetIdsNotToClean, func = lambda list: list.remove(cms.InputTag("interestingOotEgammaIsoESDetId")) ) diff --git a/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h b/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h index 11248b76cdb3a..e0fb20bad6240 100644 --- a/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h +++ b/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h @@ -145,7 +145,6 @@ class ReducedEGProducer : public edm::stream::EDProducer<> { //tokens for input collections const edm::EDGetTokenT photonT_; - const bool doOotPhotons_; const edm::EDGetTokenT ootPhotonT_; const edm::EDGetTokenT gsfElectronT_; const edm::EDGetTokenT gsfTrackT_; diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index 1a44afbe40aca..541efa6625ce4 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -46,8 +46,7 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : photonT_(consumes(config.getParameter("photons"))), - doOotPhotons_(!config.getParameter("ootPhotons").label().empty()), - ootPhotonT_(doOotPhotons_ ? consumes(config.getParameter("ootPhotons")) : edm::EDGetTokenT()), + ootPhotonT_(!ootPhotonT_.isUninitialized() ? consumes(config.getParameter("ootPhotons")) : edm::EDGetTokenT()), gsfElectronT_(consumes(config.getParameter("gsfElectrons"))), gsfTrackT_(consumes(config.getParameter("gsfTracks"))), conversionT_(consumes(config.getParameter("conversions"))), @@ -142,8 +141,10 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : produces< reco::PhotonCollection >(outPhotons_); produces< reco::PhotonCoreCollection >(outPhotonCores_); - produces< reco::PhotonCollection >(outOOTPhotons_); - produces< reco::PhotonCoreCollection >(outOOTPhotonCores_); + if(!ootPhotonT_.isUninitialized()){ + produces< reco::PhotonCollection >(outOOTPhotons_); + produces< reco::PhotonCoreCollection >(outOOTPhotonCores_); + } produces< reco::GsfElectronCollection >(outGsfElectrons_); produces< reco::GsfElectronCoreCollection >(outGsfElectronCores_); produces< reco::GsfTrackCollection >(outGsfTracks_); @@ -152,9 +153,11 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : produces< reco::SuperClusterCollection >(outSuperClusters_); produces< reco::CaloClusterCollection >(outEBEEClusters_); produces< reco::CaloClusterCollection >(outESClusters_); - produces< reco::SuperClusterCollection >(outOOTSuperClusters_); - produces< reco::CaloClusterCollection >(outOOTEBEEClusters_); - produces< reco::CaloClusterCollection >(outOOTESClusters_); + if(!ootPhotonT_.isUninitialized()){ + produces< reco::SuperClusterCollection >(outOOTSuperClusters_); + produces< reco::CaloClusterCollection >(outOOTEBEEClusters_); + produces< reco::CaloClusterCollection >(outOOTESClusters_); + } produces< EcalRecHitCollection >(outEBRecHits_); produces< EcalRecHitCollection >(outEERecHits_); if (doPreshowerEcalHits_) produces< EcalRecHitCollection >(outESRecHits_); @@ -169,8 +172,10 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : for (const std::string &outid : outPhotonFloatValueMaps_) { produces< edm::ValueMap >(outid); } - for (const std::string &outid : outOOTPhotonFloatValueMaps_) { - produces< edm::ValueMap >(outid); + if(!ootPhotonT_.isUninitialized()){ + for (const std::string &outid : outOOTPhotonFloatValueMaps_) { + produces< edm::ValueMap >(outid); + } } for (const std::string &outid : outGsfElectronFloatValueMaps_) { produces< edm::ValueMap >(outid); @@ -185,12 +190,11 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the //get input collections - edm::Handle photonHandle; theEvent.getByToken(photonT_, photonHandle); edm::Handle ootPhotonHandle; - if(doOotPhotons_)theEvent.getByToken(ootPhotonT_, ootPhotonHandle); + if(!ootPhotonT_.isUninitialized())theEvent.getByToken(ootPhotonT_, ootPhotonHandle); edm::Handle gsfElectronHandle; theEvent.getByToken(gsfElectronT_, gsfElectronHandle); @@ -238,7 +242,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the } std::vector > > ootPhotonFloatValueMapHandles(ootPhotonFloatValueMapTs_.size()); - if (doOotPhotons_){ + if (!ootPhotonT_.isUninitialized()){ index = 0; for (const auto& ootPhotonFloatValueMapT : ootPhotonFloatValueMapTs_) { theEvent.getByToken(ootPhotonFloatValueMapT,ootPhotonFloatValueMapHandles[index++]); @@ -272,7 +276,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the edm::ESHandle theCaloTopology; theEventSetup.get().get(theCaloTopology); const CaloTopology *caloTopology = & (*theCaloTopology); - + //initialize output collections auto photons = std::make_unique(); auto photonCores = std::make_unique(); @@ -389,7 +393,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the //special note1: since not PFCand --> no PF isolation, IDs (but we do have FloatValueMap!) //special note2: conversion sequence not run over bcs from oot phos, so skip relinking of oot phos //special note3: clusters and superclusters in own collections! - if(doOotPhotons_) { + if(!ootPhotonT_.isUninitialized()) { index = -1; for (const auto& ootPhoton : *ootPhotonHandle) { index++; @@ -530,7 +534,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the } //loop over output OOTSuperClusters and fill maps - if(doOotPhotons_) { + if(!ootPhotonT_.isUninitialized()) { index = 0; for (auto& ootSuperCluster : *ootSuperClusters) { @@ -565,7 +569,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the } } - if(doOotPhotons_) { + if(!ootPhotonT_.isUninitialized()) { theEvent.put(std::move(ebRecHits),outEBRecHits_); theEvent.put(std::move(eeRecHits),outEERecHits_); } @@ -588,7 +592,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the for (reco::SuperCluster &superCluster : *superClusters) { relinkCaloClusters(superCluster, ebeeClusterMap, esClusterMap, outEBEEClusterHandle, outESClusterHandle); } - if(doOotPhotons_) { + if(!ootPhotonT_.isUninitialized()) { //OOTCaloClusters //put ootcalocluster output collections in event and get orphan handles to create ptrs const edm::OrphanHandle &outOOTEBEEClusterHandle = theEvent.put(std::move(ootEbeeClusters),outOOTEBEEClusters_); @@ -624,32 +628,31 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the relinkSuperCluster(gsfElectronCore, superClusterMap, outSuperClusterHandle); relinkGsfTrack(gsfElectronCore, gsfTrackMap, outGsfTrackHandle); } + + //put ootsuperclusters in the event + const edm::OrphanHandle &outOOTSuperClusterHandle = theEvent.put(std::move(ootSuperClusters),outOOTSuperClusters_); - if(doOotPhotons_) { - //put ootsuperclusters in the event - const edm::OrphanHandle &outOOTSuperClusterHandle = theEvent.put(std::move(ootSuperClusters),outOOTSuperClusters_); - - //Relink OOTPhoton SuperClusters - for (reco::PhotonCore &ootPhotonCore : *ootPhotonCores) { - relinkSuperCluster(ootPhotonCore, ootSuperClusterMap, outOOTSuperClusterHandle); - } + //Relink OOTPhoton SuperClusters + for (reco::PhotonCore &ootPhotonCore : *ootPhotonCores) { + relinkSuperCluster(ootPhotonCore, ootSuperClusterMap, outOOTSuperClusterHandle); } + //put photoncores and gsfelectroncores into the event const edm::OrphanHandle &outPhotonCoreHandle = theEvent.put(std::move(photonCores),outPhotonCores_); const edm::OrphanHandle &outOOTPhotonCoreHandle = theEvent.put(std::move(ootPhotonCores),outOOTPhotonCores_); const edm::OrphanHandle &outgsfElectronCoreHandle = theEvent.put(std::move(gsfElectronCores),outGsfElectronCores_); - + //loop over photons, oot photons, and electrons and relink the cores for (reco::Photon &photon : *photons) { relinkPhotonCore(photon, photonCoreMap, outPhotonCoreHandle); } - if(doOotPhotons_) { + if(!ootPhotonT_.isUninitialized()) { for (reco::Photon &ootPhoton : *ootPhotons) { relinkPhotonCore(ootPhoton, ootPhotonCoreMap, outOOTPhotonCoreHandle); } } - + for (reco::GsfElectron &gsfElectron : *gsfElectrons) { relinkGsfElectronCore(gsfElectron, gsfElectronCoreMap, outgsfElectronCoreHandle); @@ -682,7 +685,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the ambigTracksInThisElectron.clear(); } - + //(finally) store the output photon and electron collections const edm::OrphanHandle &outPhotonHandle = theEvent.put(std::move(photons),outPhotons_); const edm::OrphanHandle &outOOTPhotonHandle = theEvent.put(std::move(ootPhotons),outOOTPhotons_); @@ -732,7 +735,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the fillMap(outPhotonHandle, vals, theEvent, outPhotonFloatValueMaps_[index++]); } - if(doOotPhotons_) { + if(!ootPhotonT_.isUninitialized()) { //oot photon iso value maps index = 0; for (auto const& vals : ootPhotonFloatValueMapVals){ diff --git a/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py index 10fd379896755..d3a9e55d6d286 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HcalHitSelection_cfi.py @@ -12,9 +12,4 @@ ) from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 -_pp_on_AA_interestingDetIds = cms.VInputTag([cms.InputTag("interestingGedEgammaIsoHCALDetId")]) - -pp_on_AA_2018.toModify( - reducedHcalRecHits, - interestingDetIds = _pp_on_AA_interestingDetIds - ) +pp_on_AA_2018.toModify(reducedHcalRecHits.interestingDetIds, func = lambda list: list.remove(cms.InputTag("interestingOotEgammaIsoHCALDetId")) ) From 1241d04472e619d85961d67d59542f29fcb9ad02 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 30 May 2018 16:57:42 +0200 Subject: [PATCH 6/9] Cleaning of oot photons from mini-AOD --- .../producersLayer1/patCandidates_cff.py | 4 +++ .../selectedPatCandidates_cff.py | 4 +++ .../PatAlgos/python/slimming/slimming_cff.py | 3 +++ .../src/ReducedEGProducer.cc | 25 +++++++++++-------- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py b/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py index 97ebc6f0fbc76..cc5bc204f112b 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py @@ -32,3 +32,7 @@ makePatMETsTask ) patCandidates = cms.Sequence(patCandidateSummary, patCandidatesTask) + +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +pp_on_AA_2018.toReplaceWith(patCandidatesTask, patCandidatesTask.copyAndExclude([makePatOOTPhotonsTask])) +pp_on_AA_2018.toModify(patCandidateSummary.candidates, func = lambda list: list.remove(cms.InputTag("patOOTPhotons")) ) diff --git a/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py b/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py index 96b8bab9a0115..3f55a156f50fc 100644 --- a/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py +++ b/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py @@ -31,3 +31,7 @@ ) selectedPatCandidates = cms.Sequence(selectedPatCandidateSummary, selectedPatCandidatesTask) + +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +pp_on_AA_2018.toReplaceWith(selectedPatCandidatesTask, selectedPatCandidatesTask.copyAndExclude([selectedPatOOTPhotons])) +pp_on_AA_2018.toModify(selectedPatCandidateSummary.candidates, func = lambda list: list.remove(cms.InputTag("selectedPatOOTPhotons")) ) diff --git a/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py b/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py index 59f8e4b994bc8..0f680094bad8d 100644 --- a/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py +++ b/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py @@ -53,3 +53,6 @@ bunchSpacingProducer, oniaPhotonCandidates ) + +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +pp_on_AA_2018.toReplaceWith(slimmingTask, slimmingTask.copyAndExclude([slimmedOOTPhotons])) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index 541efa6625ce4..f53d4495609f3 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -397,7 +397,7 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the index = -1; for (const auto& ootPhoton : *ootPhotonHandle) { index++; - + bool keep = keepOOTPhotonSel_(ootPhoton); if (!keep) continue; @@ -592,13 +592,15 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the for (reco::SuperCluster &superCluster : *superClusters) { relinkCaloClusters(superCluster, ebeeClusterMap, esClusterMap, outEBEEClusterHandle, outESClusterHandle); } - if(!ootPhotonT_.isUninitialized()) { - //OOTCaloClusters - //put ootcalocluster output collections in event and get orphan handles to create ptrs - const edm::OrphanHandle &outOOTEBEEClusterHandle = theEvent.put(std::move(ootEbeeClusters),outOOTEBEEClusters_); - const edm::OrphanHandle &outOOTESClusterHandle = theEvent.put(std::move(ootEsClusters),outOOTESClusters_);; - //Loop over OOTSuperClusters and relink OOTPhoton CaloClusters + //OOTCaloClusters + //put ootcalocluster output collections in event and get orphan handles to create ptrs + edm::OrphanHandle outOOTEBEEClusterHandle; + edm::OrphanHandle outOOTESClusterHandle; + //Loop over OOTSuperClusters and relink OOTPhoton CaloClusters + if(!ootPhotonT_.isUninitialized()) { + outOOTEBEEClusterHandle = theEvent.put(std::move(ootEbeeClusters),outOOTEBEEClusters_); + outOOTESClusterHandle = theEvent.put(std::move(ootEsClusters),outOOTESClusters_); for (reco::SuperCluster &ootSuperCluster : *ootSuperClusters) { relinkCaloClusters(ootSuperCluster, ootEbeeClusterMap, ootEsClusterMap, outOOTEBEEClusterHandle, outOOTESClusterHandle); } @@ -630,7 +632,8 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the } //put ootsuperclusters in the event - const edm::OrphanHandle &outOOTSuperClusterHandle = theEvent.put(std::move(ootSuperClusters),outOOTSuperClusters_); + edm::OrphanHandle outOOTSuperClusterHandle; + if(!ootPhotonT_.isUninitialized()) outOOTSuperClusterHandle = theEvent.put(std::move(ootSuperClusters),outOOTSuperClusters_); //Relink OOTPhoton SuperClusters for (reco::PhotonCore &ootPhotonCore : *ootPhotonCores) { @@ -639,7 +642,8 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the //put photoncores and gsfelectroncores into the event const edm::OrphanHandle &outPhotonCoreHandle = theEvent.put(std::move(photonCores),outPhotonCores_); - const edm::OrphanHandle &outOOTPhotonCoreHandle = theEvent.put(std::move(ootPhotonCores),outOOTPhotonCores_); + edm::OrphanHandle outOOTPhotonCoreHandle; + if(!ootPhotonT_.isUninitialized()) outOOTPhotonCoreHandle = theEvent.put(std::move(ootPhotonCores),outOOTPhotonCores_); const edm::OrphanHandle &outgsfElectronCoreHandle = theEvent.put(std::move(gsfElectronCores),outGsfElectronCores_); //loop over photons, oot photons, and electrons and relink the cores @@ -688,7 +692,8 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the //(finally) store the output photon and electron collections const edm::OrphanHandle &outPhotonHandle = theEvent.put(std::move(photons),outPhotons_); - const edm::OrphanHandle &outOOTPhotonHandle = theEvent.put(std::move(ootPhotons),outOOTPhotons_); + edm::OrphanHandle outOOTPhotonHandle; + if(!ootPhotonT_.isUninitialized()) outOOTPhotonHandle = theEvent.put(std::move(ootPhotons),outOOTPhotons_); const edm::OrphanHandle &outGsfElectronHandle = theEvent.put(std::move(gsfElectrons),outGsfElectrons_); //still need to output relinked valuemaps From 16a1cceea2a4c2abf5fcc09e67db88d961179b66 Mon Sep 17 00:00:00 2001 From: Matthew Nguyen Date: Wed, 30 May 2018 23:08:24 +0200 Subject: [PATCH 7/9] Fix clang error in ReducedEGProducer.cc --- RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index f53d4495609f3..e6589c75e725e 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -46,7 +46,7 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : photonT_(consumes(config.getParameter("photons"))), - ootPhotonT_(!ootPhotonT_.isUninitialized() ? consumes(config.getParameter("ootPhotons")) : edm::EDGetTokenT()), + ootPhotonT_(consumes(config.getParameter("ootPhotons"))), gsfElectronT_(consumes(config.getParameter("gsfElectrons"))), gsfTrackT_(consumes(config.getParameter("gsfTracks"))), conversionT_(consumes(config.getParameter("conversions"))), From 11b1ea6081fb35ffaee09fa6df3735f76ac654fb Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 4 Jun 2018 21:56:33 +0200 Subject: [PATCH 8/9] added ootphotons flag to reducedRecHits_cfi --- .../EgammaPhotonProducers/interface/ReducedEGProducer.h | 2 +- RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py | 2 ++ RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h b/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h index e0fb20bad6240..df24f8960c312 100644 --- a/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h +++ b/RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h @@ -145,7 +145,7 @@ class ReducedEGProducer : public edm::stream::EDProducer<> { //tokens for input collections const edm::EDGetTokenT photonT_; - const edm::EDGetTokenT ootPhotonT_; + edm::EDGetTokenT ootPhotonT_; const edm::EDGetTokenT gsfElectronT_; const edm::EDGetTokenT gsfTrackT_; const edm::EDGetTokenT conversionT_; diff --git a/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py index 4fa3aafc9171a..6d5d720b07b94 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py @@ -109,3 +109,5 @@ modifyReducedEGammaRun2MiniAOD9XFall17_ = run2_miniAOD_94XFall17.makeProcessModifier(calibrateReducedEgamma) from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy modifyReducedEGammaRun2MiniAOD8XLegacy_ = run2_miniAOD_80XLegacy.makeProcessModifier(calibrateReducedEgamma) +from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +pp_on_AA_2018.toModify( reducedEgamma, ootPhotons = cms.InputTag("") ) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index e6589c75e725e..ddee64680d9ed 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -46,7 +46,6 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : photonT_(consumes(config.getParameter("photons"))), - ootPhotonT_(consumes(config.getParameter("ootPhotons"))), gsfElectronT_(consumes(config.getParameter("gsfElectrons"))), gsfTrackT_(consumes(config.getParameter("gsfTracks"))), conversionT_(consumes(config.getParameter("conversions"))), @@ -98,6 +97,10 @@ ReducedEGProducer::ReducedEGProducer(const edm::ParameterSet& config) : slimRelinkGsfElectronSel_(config.getParameter("slimRelinkGsfElectrons")), relinkGsfElectronSel_(config.getParameter("relinkGsfElectrons")) { + + const edm::InputTag& aTag = config.getParameter("ootPhotons"); + if (not aTag.label().empty()) ootPhotonT_ = consumes(aTag); + const std::vector& photonidinputs = config.getParameter >("photonIDSources"); for (const edm::InputTag &tag : photonidinputs) { From 56a39ea71e5413874c962714dca727780185c097 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 5 Jun 2018 14:57:57 +0200 Subject: [PATCH 9/9] Reversed mistakenly hidden puts --- RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc index ddee64680d9ed..d8ead6c028fd2 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ReducedEGProducer.cc @@ -572,10 +572,8 @@ void ReducedEGProducer::produce(edm::Event& theEvent, const edm::EventSetup& the } } - if(!ootPhotonT_.isUninitialized()) { - theEvent.put(std::move(ebRecHits),outEBRecHits_); - theEvent.put(std::move(eeRecHits),outEERecHits_); - } + theEvent.put(std::move(ebRecHits),outEBRecHits_); + theEvent.put(std::move(eeRecHits),outEERecHits_); if (doPreshowerEcalHits_) { for (const EcalRecHit &rechit : *preshowerHitHandle) {