diff --git a/Configuration/Eras/python/Modifier_run2_miniAOD_94XFall17_cff.py b/Configuration/Eras/python/Modifier_run2_miniAOD_94XFall17_cff.py new file mode 100644 index 0000000000000..36d35fbecdad6 --- /dev/null +++ b/Configuration/Eras/python/Modifier_run2_miniAOD_94XFall17_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +run2_miniAOD_94XFall17 = cms.Modifier() diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 9630244d05a98..737e112b43a89 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -43,7 +43,7 @@ def __init__(self): 'phase2_hgcal', 'phase2_muon', 'phase2_timing', 'phase2_timing_layer','phase2_hcal', 'trackingLowPU', 'trackingPhase1', 'ctpps_2016', 'trackingPhase2PU140', - 'tracker_apv_vfp30_2016', 'run2_miniAOD_80XLegacy', 'run2_nanoAOD_92X', + 'tracker_apv_vfp30_2016', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X', 'hcalHardcodeConditions', 'hcalSkipPacker'] internalUseModChains = ['run2_2017_noTrackingModifier'] diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index 7a0a091a62360..9cd1140d5cee9 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -630,10 +630,13 @@ class GsfElectron : public RecoCandidate float sumNeutralHadronEtHighThreshold; //!< sum pt of neutral hadrons with a higher threshold float sumPhotonEtHighThreshold; //!< sum pt of PF photons with a higher threshold float sumPUPt; //!< sum pt of charged Particles not from PV (for Pu corrections) - + //new pf cluster based isolation values + float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of electron + float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of electron PflowIsolationVariables() : sumChargedHadronPt(0),sumNeutralHadronEt(0),sumPhotonEt(0),sumChargedParticlePt(0), - sumNeutralHadronEtHighThreshold(0),sumPhotonEtHighThreshold(0),sumPUPt(0) {}; + sumNeutralHadronEtHighThreshold(0),sumPhotonEtHighThreshold(0),sumPUPt(0), + sumEcalClusterEt(0),sumHcalClusterEt(0){}; } ; struct MvaInput @@ -668,6 +671,10 @@ class GsfElectron : public RecoCandidate // accessors const PflowIsolationVariables & pfIsolationVariables() const { return pfIso_ ; } + //backwards compat functions for pat::Electron + float ecalPFClusterIso() const { return pfIso_.sumEcalClusterEt; }; + float hcalPFClusterIso() const { return pfIso_.sumHcalClusterEt; }; + const MvaInput & mvaInput() const { return mvaInput_ ; } const MvaOutput & mvaOutput() const { return mvaOutput_ ; } diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 1d5f7b8ae4ac9..5e915eee8c10c 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -463,7 +463,8 @@ namespace reco { float sumNeutralHadronEtHighThreshold; //!< sum pt of neutral hadrons with a higher threshold float sumPhotonEtHighThreshold; //!< sum pt of PF photons with a higher threshold float sumPUPt; //!< sum pt of charged Particles not from PV (for Pu corrections) - + float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of photon + float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of photon PflowIsolationVariables(): chargedHadronIso(0), @@ -474,7 +475,9 @@ namespace reco { sumChargedParticlePt(0), sumNeutralHadronEtHighThreshold(0), sumPhotonEtHighThreshold(0), - sumPUPt(0) + sumPUPt(0), + sumEcalClusterEt(0), + sumHcalClusterEt(0) {} @@ -488,7 +491,11 @@ namespace reco { float sumChargedParticlePt() const {return pfIsolation_.sumChargedParticlePt;} float sumNeutralHadronEtHighThreshold() const {return pfIsolation_.sumNeutralHadronEtHighThreshold;} float sumPhotonEtHighThreshold() const {return pfIsolation_.sumPhotonEtHighThreshold;} - float sumPUPt() const {return pfIsolation_.sumPUPt;} + float sumPUPt() const {return pfIsolation_.sumPUPt;} + + //backwards compat functions for pat::Photon + float ecalPFClusterIso() const { return pfIsolation_.sumEcalClusterEt; }; + float hcalPFClusterIso() const { return pfIsolation_.sumHcalClusterEt; }; /// Get Particle Flow Isolation variables block const PflowIsolationVariables& getPflowIsolationVariables() const { return pfIsolation_; } diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 6d269852bdc73..a1f16258f969a 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -52,9 +52,10 @@ - + + @@ -179,7 +180,8 @@ - + + diff --git a/DataFormats/PatCandidates/interface/Electron.h b/DataFormats/PatCandidates/interface/Electron.h index fae566272aeed..2797b9d396c26 100644 --- a/DataFormats/PatCandidates/interface/Electron.h +++ b/DataFormats/PatCandidates/interface/Electron.h @@ -154,11 +154,6 @@ namespace pat { float hcalIso() const { return dr04HcalTowerSumEt(); } /// Overload of pat::Lepton::caloIso(); returns the sum of ecalIso() and hcalIso float caloIso() const { return ecalIso()+hcalIso(); } - /// get and set PFCluster Isolation - float ecalPFClusterIso() const { return ecalPFClusIso_; }; - float hcalPFClusterIso() const { return hcalPFClusIso_; }; - void setEcalPFClusterIso(float ecalPFClus) { ecalPFClusIso_ = ecalPFClus; }; - void setHcalPFClusterIso(float hcalPFClus) { hcalPFClusIso_ = hcalPFClus; }; /// returns PUPPI isolations float puppiChargedHadronIso() const {return puppiChargedHadronIso_; } float puppiNeutralHadronIso() const {return puppiNeutralHadronIso_; } @@ -363,10 +358,6 @@ namespace pat { double ecalTrackRegressionScale_; double ecalTrackRegressionSmear_; - /// PFCluster Isolation (a la HLT) - float ecalPFClusIso_; - float hcalPFClusIso_; - /// PUPPI isolations float puppiChargedHadronIso_; float puppiNeutralHadronIso_; diff --git a/DataFormats/PatCandidates/interface/Photon.h b/DataFormats/PatCandidates/interface/Photon.h index 6777230f03a65..5e47c3c69404d 100644 --- a/DataFormats/PatCandidates/interface/Photon.h +++ b/DataFormats/PatCandidates/interface/Photon.h @@ -124,12 +124,6 @@ namespace pat { /// and hcal float caloIso() const { return ecalIso()+hcalIso(); } - /// get and set PFCluster isolation - float ecalPFClusterIso() const { return ecalPFClusIso_;} - float hcalPFClusterIso() const { return hcalPFClusIso_;} - void setEcalPFClusterIso(float ecalPFClus) { ecalPFClusIso_=ecalPFClus;} - void setHcalPFClusterIso(float hcalPFClus) { hcalPFClusIso_=hcalPFClus;} - /// PARTICLE FLOW ISOLATION /// Returns the isolation calculated with all the PFCandidates float patParticleIso() const { return userIsolation(pat::PfAllParticleIso); } @@ -402,9 +396,6 @@ namespace pat { float iEta_; float iPhi_; - float ecalPFClusIso_; - float hcalPFClusIso_; - //PUPPI isolations float puppiChargedHadronIso_; float puppiNeutralHadronIso_; diff --git a/DataFormats/PatCandidates/src/classes_def_objects.xml b/DataFormats/PatCandidates/src/classes_def_objects.xml index 81aa08d7cbc1e..681ade3af22ca 100644 --- a/DataFormats/PatCandidates/src/classes_def_objects.xml +++ b/DataFormats/PatCandidates/src/classes_def_objects.xml @@ -16,7 +16,8 @@ - + + @@ -213,7 +214,8 @@ - + + diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc index 6ebe74aaa637d..98ead7940937e 100755 --- a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc @@ -446,14 +446,12 @@ void PATElectronProducer::produce(edm::Event & iEvent, const edm::EventSetup & i iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH); edm::Handle > hcalPFClusterIsoMapH; iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH); - - anElectron.setEcalPFClusterIso((*ecalPFClusterIsoMapH)[elecsRef]); - anElectron.setHcalPFClusterIso((*hcalPFClusterIsoMapH)[elecsRef]); - } else { - anElectron.setEcalPFClusterIso(-999.); - anElectron.setHcalPFClusterIso(-999.); + reco::GsfElectron::PflowIsolationVariables newPFIsol = anElectron.pfIsolationVariables(); + newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[elecsRef]; + newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[elecsRef]; + anElectron.setPfIsolationVariables(newPFIsol); } - + std::vector selectedCells; bool barrel = itElectron->isEB(); //loop over sub clusters @@ -675,6 +673,7 @@ void PATElectronProducer::produce(edm::Event & iEvent, const edm::EventSetup & i std::vector vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed())); anElectron.setMvaVariables(vCov[1], ip3d); } + // PFCluster Isolation if (addPFClusterIso_) { // Get PFCluster Isolation @@ -682,13 +681,12 @@ void PATElectronProducer::produce(edm::Event & iEvent, const edm::EventSetup & i iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH); edm::Handle > hcalPFClusterIsoMapH; iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH); - - anElectron.setEcalPFClusterIso((*ecalPFClusterIsoMapH)[elecsRef]); - anElectron.setHcalPFClusterIso((*hcalPFClusterIsoMapH)[elecsRef]); - } else { - anElectron.setEcalPFClusterIso(-999.); - anElectron.setHcalPFClusterIso(-999.); + reco::GsfElectron::PflowIsolationVariables newPFIsol = anElectron.pfIsolationVariables(); + newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[elecsRef]; + newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[elecsRef]; + anElectron.setPfIsolationVariables(newPFIsol); } + if (addPuppiIsolation_) { anElectron.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[elePtr], (*PUPPIIsolation_neutral_hadrons)[elePtr], (*PUPPIIsolation_photons)[elePtr]); anElectron.setIsolationPUPPINoLeptons((*PUPPINoLeptonsIsolation_charged_hadrons)[elePtr], (*PUPPINoLeptonsIsolation_neutral_hadrons)[elePtr], (*PUPPINoLeptonsIsolation_photons)[elePtr]); diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc index 96ff51e4d0a27..aa0bb8e35b111 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc @@ -131,7 +131,7 @@ pat::PATElectronSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iS if (dropSeedCluster_(electron)) { electron.seedCluster_.clear(); electron.embeddedSeedCluster_ = false; } if (dropRecHits_(electron)) { electron.recHits_ = EcalRecHitCollection(); electron.embeddedRecHits_ = false; } if (dropCorrections_(electron)) { electron.setCorrections(reco::GsfElectron::Corrections()); } - if (dropIsolations_(electron)) { electron.setDr03Isolation(reco::GsfElectron::IsolationVariables()); electron.setDr04Isolation(reco::GsfElectron::IsolationVariables()); electron.setPfIsolationVariables(reco::GsfElectron::PflowIsolationVariables()); electron.setEcalPFClusterIso(0); electron.setHcalPFClusterIso(0); } + if (dropIsolations_(electron)) { electron.setDr03Isolation(reco::GsfElectron::IsolationVariables()); electron.setDr04Isolation(reco::GsfElectron::IsolationVariables()); electron.setPfIsolationVariables(reco::GsfElectron::PflowIsolationVariables()); } if (dropShapes_(electron)) { electron.setShowerShape(reco::GsfElectron::ShowerShape()); } if (dropSaturation_(electron)) { electron.setSaturationInfo(reco::GsfElectron::SaturationInfo()); } if (dropExtrapolations_(electron)) { electron.setTrackExtrapolations(reco::GsfElectron::TrackExtrapolations()); } diff --git a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc index ed897f389ebc7..cd9491836eee5 100755 --- a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc @@ -414,21 +414,19 @@ void PATPhotonProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSe // Get PFCluster Isolation if (addPFClusterIso_) { + reco::Photon::PflowIsolationVariables newPFIsol = aPhoton.getPflowIsolationVariables(); edm::Handle > ecalPFClusterIsoMapH; iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH); - aPhoton.setEcalPFClusterIso((*ecalPFClusterIsoMapH)[photonRef]); + newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[photonRef]; edm::Handle > hcalPFClusterIsoMapH; if (not hcalPFClusterIsoT_.isUninitialized()){ iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH); - aPhoton.setHcalPFClusterIso((*hcalPFClusterIsoMapH)[photonRef]); + newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[photonRef]; } - else - { - aPhoton.setHcalPFClusterIso(-999.); + else{ + newPFIsol.sumHcalClusterEt = -999.; } - } else { - aPhoton.setEcalPFClusterIso(-999.); - aPhoton.setHcalPFClusterIso(-999.); + aPhoton.setPflowIsolationVariables(newPFIsol); } // add the Photon to the vector of Photons diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/ootPhotonProducer_cff.py b/PhysicsTools/PatAlgos/python/producersLayer1/ootPhotonProducer_cff.py index b151ee8a40b40..127d2c46a8296 100644 --- a/PhysicsTools/PatAlgos/python/producersLayer1/ootPhotonProducer_cff.py +++ b/PhysicsTools/PatAlgos/python/producersLayer1/ootPhotonProducer_cff.py @@ -34,9 +34,7 @@ patOOTPhotons.addPuppiIsolation = cms.bool(False) # PFClusterIso -patOOTPhotons.addPFClusterIso = cms.bool(True) -patOOTPhotons.ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoEcalPFClusIso") -patOOTPhotons.hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoHcalPFClusIso") +patOOTPhotons.addPFClusterIso = cms.bool(False) # MC Match patOOTPhotons.genParticleMatch = cms.InputTag("ootPhotonMatch") ## particles source to be used for the matching @@ -60,5 +58,12 @@ ootPhotonEcalPFClusterIsolationProducer, makePatOOTPhotonsTask.copy() )) +#the OOT are made from scratch in re-miniAOD +#we could put the PFCluster isolation in there when we initially make them +#but decided to emulate what is done in 80X where the the isolation is only put +#into the pat object and value maps are saved +#hence we need to have the source to be ootPhotons not ootPhotonsTmp +run2_miniAOD_80XLegacy.toModify(ootPhotonEcalPFClusterIsolationProducer,candidateProducer = cms.InputTag('ootPhotons') ) + +run2_miniAOD_80XLegacy.toModify(patOOTPhotons, addPFClusterIso = cms.bool(True),ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoEcalPFClusIso"),hcalPFClusterIsoMap = cms.InputTag("") ) -run2_miniAOD_80XLegacy.toModify(patOOTPhotons, hcalPFClusterIsoMap = "") diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 447bd2114b8fe..d86e989fcd9f6 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -51,7 +51,16 @@ def miniAOD_customizeCommon(process): eidTight = cms.InputTag("reducedEgamma","eidTight"), eidRobustHighEnergy = cms.InputTag("reducedEgamma","eidRobustHighEnergy"), ) - process.patElectrons.addPFClusterIso = cms.bool(True) + from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy + run2_miniAOD_80XLegacy.toModify(process.patElectrons, + addPFClusterIso = cms.bool(True), + ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso"), + hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso")) + from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17 + run2_miniAOD_94XFall17.toModify(process.patElectrons, + addPFClusterIso = cms.bool(True), + ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso"), + hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso")) #add puppi isolation in miniAOD process.patElectrons.addPuppiIsolation = cms.bool(True) process.patElectrons.puppiIsolationChargedHadrons = cms.InputTag("egmElectronPUPPIIsolation","h+-DR030-BarVeto000-EndVeto001") @@ -63,9 +72,6 @@ def miniAOD_customizeCommon(process): process.patElectrons.computeMiniIso = cms.bool(True) - process.patElectrons.ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso") - process.patElectrons.hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso") - process.elPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons") process.elPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons") process.elPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons") @@ -77,7 +83,6 @@ def miniAOD_customizeCommon(process): process.patPhotons.embedBasicClusters = False ## process.patPhotons.embed in AOD externally stored the photon's basic clusters process.patPhotons.embedPreshowerClusters = False ## process.patPhotons.embed in AOD externally stored the photon's preshower clusters process.patPhotons.embedRecHits = False ## process.patPhotons.embed in AOD externally stored the RecHits - can be called from the PATPhotonProducer - process.patPhotons.addPFClusterIso = cms.bool(True) #add puppi isolation in miniAOD process.patPhotons.addPuppiIsolation = cms.bool(True) @@ -85,8 +90,23 @@ def miniAOD_customizeCommon(process): process.patPhotons.puppiIsolationNeutralHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h0-DR030-") process.patPhotons.puppiIsolationPhotons = cms.InputTag("egmPhotonPUPPIIsolation","gamma-DR030-") - process.patPhotons.ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso") - process.patPhotons.hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso") + from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy + run2_miniAOD_80XLegacy.toModify(process.patPhotons, + addPFClusterIso = cms.bool(True), + ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso"), + hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso")) + from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17 + run2_miniAOD_94XFall17.toModify(process.patPhotons, + addPFClusterIso = cms.bool(True), + ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso"), + hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso")) + #the 80X legacy customsations are done in ootPhotonProducer for OOT photons + run2_miniAOD_94XFall17.toModify(process.patOOTPhotons, + addPFClusterIso = cms.bool(True), + ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoEcalPFClusIso"), + hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoHcalPFClusIso")) + + process.patPhotons.photonSource = cms.InputTag("reducedEgamma","reducedGedPhotons") process.patPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons") process.patPhotons.photonIDSources = cms.PSet( diff --git a/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py b/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py index a29a31dd5e5c2..7e02713d80560 100644 --- a/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py +++ b/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py @@ -15,12 +15,6 @@ 'keep *_egmGedGsfElectronPF*Isolation_*_*', 'keep *_egmGsfElectronIDs_*_*', 'keep *_egmPhotonIDs_*_*', - 'keep *_photonEcalPFClusterIsolationProducer_*_*', - 'keep *_ootPhotonEcalPFClusterIsolationProducer_*_*', - 'keep *_electronEcalPFClusterIsolationProducer_*_*', - 'keep *_photonHcalPFClusterIsolationProducer_*_*', - 'keep *_ootPhotonHcalPFClusterIsolationProducer_*_*', - 'keep *_electronHcalPFClusterIsolationProducer_*_*', 'keep *_conversions_*_*', 'keep *_mustacheConversions_*_*', 'drop *_conversions_uncleanedConversions_*', @@ -65,12 +59,6 @@ 'keep floatedmValueMap_eidLoose_*_*', 'keep floatedmValueMap_eidTight_*_*', 'keep *_egmGedGsfElectronPFIsolation_*_*', - 'keep *_photonEcalPFClusterIsolationProducer_*_*', - 'keep *_ootPhotonEcalPFClusterIsolationProducer_*_*', - 'keep *_electronEcalPFClusterIsolationProducer_*_*', - 'keep *_photonHcalPFClusterIsolationProducer_*_*', - 'keep *_ootPhotonHcalPFClusterIsolationProducer_*_*', - 'keep *_electronHcalPFClusterIsolationProducer_*_*', 'drop *_egmGsfElectronIDs_*_*', 'drop *_egmPhotonIDs_*_*', 'keep *_gedPhotonCore_*_*', @@ -127,12 +115,6 @@ 'keep floatedmValueMap_eidLoose_*_*', 'keep floatedmValueMap_eidTight_*_*', 'keep *_egmGedGsfElectronPFIsolation_*_*', - 'keep *_photonEcalPFClusterIsolationProducer_*_*', - 'keep *_ootPhotonEcalPFClusterIsolationProducer_*_*', - 'keep *_electronEcalPFClusterIsolationProducer_*_*', - 'keep *_photonHcalPFClusterIsolationProducer_*_*', - 'keep *_ootPhotonHcalPFClusterIsolationProducer_*_*', - 'keep *_electronHcalPFClusterIsolationProducer_*_*', 'drop *_egmGsfElectronIDs_*_*', 'drop *_egmPhotonIDs_*_*', 'keep recoPhotonCores_gedPhotonCore_*_*', diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GEDGsfElectronFinalizer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GEDGsfElectronFinalizer.cc index 5bf4563d58d8d..e346de9720f32 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GEDGsfElectronFinalizer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GEDGsfElectronFinalizer.cc @@ -25,12 +25,8 @@ GEDGsfElectronFinalizer::GEDGsfElectronFinalizer( const edm::ParameterSet & cfg tokenElectronIsoVals_.push_back(consumes >(pfIsoVals.getParameter("pfSumPhotonEt"))); tokenElectronIsoVals_.push_back(consumes >(pfIsoVals.getParameter("pfSumNeutralHadronEt"))); tokenElectronIsoVals_.push_back(consumes >(pfIsoVals.getParameter("pfSumPUPt"))); -// std::vector isoNames = pfIsoVals.getParameterNamesForType(); -// for(const std::string& name : isoNames) { -// edm::InputTag tag = -// pfIsoVals.getParameter(name); -// tokenElectronIsoVals_.push_back(consumes >(tag)); -// } + tokenElectronIsoVals_.push_back(consumes >(pfIsoVals.getParameter("pfSumEcalClusterEt"))); + tokenElectronIsoVals_.push_back(consumes >(pfIsoVals.getParameter("pfSumHcalClusterEt"))); nDeps_ = tokenElectronIsoVals_.size(); @@ -103,6 +99,9 @@ void GEDGsfElectronFinalizer::produce( edm::Event & event, const edm::EventSetup isoVariables.sumPhotonEt = (*(isolationValueMaps)[1])[myElectronRef]; isoVariables.sumNeutralHadronEt = (*(isolationValueMaps)[2])[myElectronRef]; isoVariables.sumPUPt = (*(isolationValueMaps)[3])[myElectronRef]; + isoVariables.sumEcalClusterEt = (*(isolationValueMaps)[4])[myElectronRef]; + isoVariables.sumHcalClusterEt = (*(isolationValueMaps)[5])[myElectronRef]; + newElectron.setPfIsolationVariables(isoVariables); // now set a status if not already done (in GEDGsfElectronProducer.cc) diff --git a/RecoEgamma/EgammaElectronProducers/python/gedGsfElectronFinalizer_cfi.py b/RecoEgamma/EgammaElectronProducers/python/gedGsfElectronFinalizer_cfi.py index 8ed1e5ef18ff8..6fb257f18e152 100644 --- a/RecoEgamma/EgammaElectronProducers/python/gedGsfElectronFinalizer_cfi.py +++ b/RecoEgamma/EgammaElectronProducers/python/gedGsfElectronFinalizer_cfi.py @@ -10,6 +10,8 @@ pfSumChargedHadronPt = cms.InputTag('egmElectronIsolationCITK:h+-DR030-'), pfSumPhotonEt = cms.InputTag('egmElectronIsolationCITK:gamma-DR030-'), pfSumNeutralHadronEt= cms.InputTag('egmElectronIsolationCITK:h0-DR030-'), - pfSumPUPt = cms.InputTag('egmElectronIsolationPileUpCITK:h+-DR030-')), + pfSumPUPt = cms.InputTag('egmElectronIsolationPileUpCITK:h+-DR030-'), + pfSumEcalClusterEt = cms.InputTag("electronEcalPFClusterIsolationProducer"), + pfSumHcalClusterEt = cms.InputTag("electronHcalPFClusterIsolationProducer")), outputCollectionLabel = cms.string("") ) diff --git a/RecoEgamma/EgammaIsolationAlgos/python/pfClusterIsolation_cfi.py b/RecoEgamma/EgammaIsolationAlgos/python/pfClusterIsolation_cfi.py index 3d435554595e1..f86acfcb6829f 100644 --- a/RecoEgamma/EgammaIsolationAlgos/python/pfClusterIsolation_cfi.py +++ b/RecoEgamma/EgammaIsolationAlgos/python/pfClusterIsolation_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms electronEcalPFClusterIsolationProducer = cms.EDProducer('ElectronEcalPFClusterIsolationProducer', - candidateProducer = cms.InputTag('gedGsfElectrons'), + candidateProducer = cms.InputTag('gedGsfElectronsTmp'), pfClusterProducer = cms.InputTag('particleFlowClusterECAL'), drMax = cms.double(0.3), drVetoBarrel = cms.double(0), @@ -13,7 +13,7 @@ ) photonEcalPFClusterIsolationProducer = cms.EDProducer('PhotonEcalPFClusterIsolationProducer', - candidateProducer = cms.InputTag('gedPhotons'), + candidateProducer = cms.InputTag('gedPhotonsTmp'), pfClusterProducer = cms.InputTag('particleFlowClusterECAL'), drMax = cms.double(0.3), drVetoBarrel = cms.double(0), @@ -25,11 +25,11 @@ ) ootPhotonEcalPFClusterIsolationProducer = photonEcalPFClusterIsolationProducer.clone() -ootPhotonEcalPFClusterIsolationProducer.candidateProducer = cms.InputTag('ootPhotons') +ootPhotonEcalPFClusterIsolationProducer.candidateProducer = cms.InputTag('ootPhotonsTmp') ootPhotonEcalPFClusterIsolationProducer.pfClusterProducer = cms.InputTag('particleFlowClusterOOTECAL') electronHcalPFClusterIsolationProducer = cms.EDProducer('ElectronHcalPFClusterIsolationProducer', - candidateProducer = cms.InputTag('gedGsfElectrons'), + candidateProducer = cms.InputTag('gedGsfElectronsTmp'), pfClusterProducerHCAL = cms.InputTag('particleFlowClusterHCAL'), useHF = cms.bool(False), drMax = cms.double(0.3), @@ -42,7 +42,7 @@ ) photonHcalPFClusterIsolationProducer = cms.EDProducer('PhotonHcalPFClusterIsolationProducer', - candidateProducer = cms.InputTag('gedPhotons'), + candidateProducer = cms.InputTag('gedPhotonsTmp'), pfClusterProducerHCAL = cms.InputTag('particleFlowClusterHCAL'), useHF = cms.bool(False), drMax = cms.double(0.3), @@ -55,7 +55,7 @@ ) ootPhotonHcalPFClusterIsolationProducer = photonHcalPFClusterIsolationProducer.clone() -ootPhotonHcalPFClusterIsolationProducer.candidateProducer = cms.InputTag('ootPhotons') +ootPhotonHcalPFClusterIsolationProducer.candidateProducer = cms.InputTag('ootPhotonsTmp') pfClusterIsolationTask = cms.Task( electronEcalPFClusterIsolationProducer , diff --git a/RecoEgamma/EgammaPhotonProducers/interface/GEDPhotonProducer.h b/RecoEgamma/EgammaPhotonProducers/interface/GEDPhotonProducer.h index 8bc012240a266..7bd9ddc1c7ae6 100644 --- a/RecoEgamma/EgammaPhotonProducers/interface/GEDPhotonProducer.h +++ b/RecoEgamma/EgammaPhotonProducers/interface/GEDPhotonProducer.h @@ -51,6 +51,17 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { void produce(edm::Event& evt, const edm::EventSetup& es) override; private: + class RecoStepInfo { + public: + enum FlagBits{kOOT=0x1,kFinal=0x2}; + explicit RecoStepInfo(const std::string& recoStep); + + bool isOOT()const{return flags_&kOOT;} + bool isFinal()const{return flags_&kFinal;} + private: + unsigned int flags_; + }; + void fillPhotonCollection(edm::Event& evt, edm::EventSetup const & es, @@ -73,7 +84,13 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { edm::ValueMap pfEGCandToPhotonMap, edm::Handle< reco::VertexCollection >& pvVertices, reco::PhotonCollection & outputCollection, - int& iSC, const edm::Handle>& chargedHadrons_, const edm::Handle>& neutralHadrons_, const edm::Handle>& photons_); + int& iSC, const edm::Handle>& chargedHadrons, + const edm::Handle>& neutralHadrons, + const edm::Handle>& photons, + const edm::Handle>& pfEcalClusters, + const edm::Handle>& pfHcalClusters); + + // std::string PhotonCoreCollection_; @@ -92,9 +109,11 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { //for isolation with map-based veto edm::EDGetTokenT > > particleBasedIsolationToken; //photon isolation sums - edm::EDGetTokenT > phoChargedIsolationToken_CITK; - edm::EDGetTokenT > phoNeutralHadronIsolationToken_CITK; - edm::EDGetTokenT > phoPhotonIsolationToken_CITK; + edm::EDGetTokenT > phoChargedIsolationTokenCITK_; + edm::EDGetTokenT > phoNeutralHadronIsolationTokenCITK_; + edm::EDGetTokenT > phoPhotonIsolationTokenCITK_; + edm::EDGetTokenT > phoPFECALClusIsolationToken_; + edm::EDGetTokenT > phoPFHCALClusIsolationToken_; std::string conversionProducer_; std::string conversionCollection_; @@ -120,7 +139,7 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { bool runMIPTagger_; bool validConversions_; - std::string reconstructionStep_; + RecoStepInfo recoStep_; bool usePrimaryVertex_; edm::ParameterSet conf_; diff --git a/RecoEgamma/EgammaPhotonProducers/python/gedPhotonSequence_cff.py b/RecoEgamma/EgammaPhotonProducers/python/gedPhotonSequence_cff.py index af51ef4e36160..7bd6f62a4281f 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/gedPhotonSequence_cff.py +++ b/RecoEgamma/EgammaPhotonProducers/python/gedPhotonSequence_cff.py @@ -25,6 +25,8 @@ gedPhotons.chargedHadronIsolation = cms.InputTag("egmPhotonIsolationCITK:h+-DR030-") gedPhotons.neutralHadronIsolation = cms.InputTag("egmPhotonIsolationCITK:h0-DR030-") gedPhotons.photonIsolation = cms.InputTag("egmPhotonIsolationCITK:gamma-DR030-") +gedPhotons.pfECALClusIsolation = cms.InputTag("photonEcalPFClusterIsolationProducer") +gedPhotons.pfHCALClusIsolation = cms.InputTag("photonHcalPFClusterIsolationProducer") gedPhotonSequence = cms.Sequence(gedPhotons) diff --git a/RecoEgamma/EgammaPhotonProducers/python/ootPhotonSequence_cff.py b/RecoEgamma/EgammaPhotonProducers/python/ootPhotonSequence_cff.py index 98a49b7ae8dc6..d5ad2335ade17 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/ootPhotonSequence_cff.py +++ b/RecoEgamma/EgammaPhotonProducers/python/ootPhotonSequence_cff.py @@ -14,6 +14,7 @@ particleFlowClusterOOTECAL, particleFlowSuperClusterOOTECAL, ootPhotonCore, + ootPhotonsTmp, ootPhotons ) diff --git a/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py b/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py index d95c2116ce8b2..c30429dde5453 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py +++ b/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py @@ -1,32 +1,57 @@ import FWCore.ParameterSet.Config as cms from RecoEgamma.EgammaPhotonProducers.gedPhotons_cfi import gedPhotons as _gedPhotons -ootPhotons = _gedPhotons.clone( +ootPhotonsTmp = _gedPhotons.clone( photonProducer = 'ootPhotonCore', candidateP4type = "fromEcalEnergy", reconstructionStep = "oot", pfEgammaCandidates = "", valueMapPhotons = "" ) +del ootPhotonsTmp.regressionConfig + +ootPhotons = _gedPhotons.clone( + photonProducer = 'ootPhotonsTmp', + candidateP4type = "fromEcalEnergy", + reconstructionStep = "ootfinal", + pfEgammaCandidates = "", + chargedHadronIsolation = cms.InputTag(""), + neutralHadronIsolation = cms.InputTag(""), + photonIsolation = cms.InputTag(""), + pfECALClusIsolation = cms.InputTag("ootPhotonEcalPFClusterIsolationProducer"), + pfHCALClusIsolation = cms.InputTag("ootPhotonHcalPFClusterIsolationProducer"), + valueMapPhotons = "" + ) del ootPhotons.regressionConfig + + from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy run2_miniAOD_80XLegacy.toModify( - ootPhotons, + ootPhotonsTmp, barrelEcalHits = "reducedEcalRecHitsEB", endcapEcalHits = "reducedEcalRecHitsEE", preshowerHits = "reducedEcalRecHitsES", hcalTowers = "" ) run2_miniAOD_80XLegacy.toModify( - ootPhotons.isolationSumsCalculatorSet, + ootPhotons, + barrelEcalHits = "reducedEcalRecHitsEB", + endcapEcalHits = "reducedEcalRecHitsEE", + preshowerHits = "reducedEcalRecHitsES", + hcalTowers = "", + pfECALClusIsolation = None, + pfHCALClusIsolation = None +) +run2_miniAOD_80XLegacy.toModify( + ootPhotonsTmp.isolationSumsCalculatorSet, barrelEcalRecHitCollection = "reducedEcalRecHitsEB", endcapEcalRecHitCollection = "reducedEcalRecHitsEE", HcalRecHitCollection = "" ) run2_miniAOD_80XLegacy.toModify( - ootPhotons.mipVariableSet, + ootPhotonsTmp.mipVariableSet, barrelEcalRecHitCollection = "reducedEcalRecHitsEB", endcapEcalRecHitCollection = "reducedEcalRecHitsEE", ) diff --git a/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py index 2ff629d762a75..d7a9babadad5a 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py @@ -45,40 +45,71 @@ "eidRobustTight", "eidTight", ), - photonPFClusterIsoSources = cms.VInputTag( + photonPFClusterIsoSources = cms.VInputTag(), + photonPFClusterIsoOutput = cms.vstring(), + ootPhotonPFClusterIsoSources = cms.VInputTag(), + ootPhotonPFClusterIsoOutput = cms.vstring(), + gsfElectronPFClusterIsoSources = cms.VInputTag(), + gsfElectronPFClusterIsoOutput = cms.vstring(), +) + +from Configuration.Eras.Modifier_phase2_common_cff import phase2_common +phase2_common.toModify(reducedEgamma, + preshowerEcalHits = cms.InputTag(""), +) + +from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy +run2_miniAOD_80XLegacy.toModify( + reducedEgamma, + photonPFClusterIsoSources = cms.VInputTag( cms.InputTag("photonEcalPFClusterIsolationProducer"), cms.InputTag("photonHcalPFClusterIsolationProducer"), - ), - photonPFClusterIsoOutput = cms.vstring( + ), + photonPFClusterIsoOutput = cms.vstring( "phoEcalPFClusIso", "phoHcalPFClusIso", - ), - ootPhotonPFClusterIsoSources = cms.VInputTag( + ), + ootPhotonPFClusterIsoSources = cms.VInputTag( cms.InputTag("ootPhotonEcalPFClusterIsolationProducer"), - cms.InputTag("ootPhotonHcalPFClusterIsolationProducer"), - ), - ootPhotonPFClusterIsoOutput = cms.vstring( + ), + ootPhotonPFClusterIsoOutput = cms.vstring( "ootPhoEcalPFClusIso", - "ootPhoHcalPFClusIso", - ), - gsfElectronPFClusterIsoSources = cms.VInputTag( + ), + gsfElectronPFClusterIsoSources = cms.VInputTag( cms.InputTag("electronEcalPFClusterIsolationProducer"), cms.InputTag("electronHcalPFClusterIsolationProducer"), - ), - gsfElectronPFClusterIsoOutput = cms.vstring( + ), + gsfElectronPFClusterIsoOutput = cms.vstring( "eleEcalPFClusIso", "eleHcalPFClusIso", - ), -) + ) + ) -from Configuration.Eras.Modifier_phase2_common_cff import phase2_common -phase2_common.toModify(reducedEgamma, - preshowerEcalHits = cms.InputTag(""), -) - -from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy -run2_miniAOD_80XLegacy.toModify( +from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17 +run2_miniAOD_94XFall17.toModify( reducedEgamma, - ootPhotonPFClusterIsoSources = [ "ootPhotonEcalPFClusterIsolationProducer" ], - ootPhotonPFClusterIsoOutput = [ "ootPhoEcalPFClusIso" ] -) + photonPFClusterIsoSources = cms.VInputTag( + cms.InputTag("photonEcalPFClusterIsolationProducer"), + cms.InputTag("photonHcalPFClusterIsolationProducer"), + ), + photonPFClusterIsoOutput = cms.vstring( + "phoEcalPFClusIso", + "phoHcalPFClusIso", + ), + ootPhotonPFClusterIsoSources = cms.VInputTag( + cms.InputTag("ootPhotonEcalPFClusterIsolationProducer"), + cms.InputTag("ootPhotonHcalPFClusterIsolationProducer"), + ), + ootPhotonPFClusterIsoOutput = cms.vstring( + "ootPhoEcalPFClusIso", + "ootPhoHcalPFClusIso", + ), + gsfElectronPFClusterIsoSources = cms.VInputTag( + cms.InputTag("electronEcalPFClusterIsolationProducer"), + cms.InputTag("electronHcalPFClusterIsolationProducer"), + ), + gsfElectronPFClusterIsoOutput = cms.vstring( + "eleEcalPFClusIso", + "eleHcalPFClusIso", + ) + ) diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 47977d5b1d8c1..0fdc26ab7e93c 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -52,29 +52,49 @@ namespace { } } -GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) : +GEDPhotonProducer::RecoStepInfo::RecoStepInfo(const std::string& step): + flags_(0) +{ + if(step=="final") flags_ = kFinal; + else if(step=="oot") flags_ = kOOT; + else if(step=="ootfinal") flags_ = (kOOT|kFinal); + else if(step=="tmp") flags_ = 0; + else{ + throw cms::Exception("InvalidConfig") <<" reconstructStep "<("reconstructionStep")), conf_(config) { // use configuration file to setup input/output collection names // photonProducer_ = conf_.getParameter("photonProducer"); - reconstructionStep_ = conf_.getParameter("reconstructionStep"); - - if ( reconstructionStep_ == "final" ) { + + if ( recoStep_.isFinal() ) { photonProducerT_ = consumes(photonProducer_); pfCandidates_ = consumes(conf_.getParameter("pfCandidates")); - phoChargedIsolationToken_CITK = + phoChargedIsolationTokenCITK_ = consumes>(conf_.getParameter("chargedHadronIsolation")); - phoNeutralHadronIsolationToken_CITK = + phoNeutralHadronIsolationTokenCITK_ = consumes>(conf_.getParameter("neutralHadronIsolation")); - phoPhotonIsolationToken_CITK = + phoPhotonIsolationTokenCITK_ = consumes>(conf_.getParameter("photonIsolation")); - + //OOT photons in legacy 80X re-miniAOD do not have PF cluster embeded into the reco object + //to preserve 80X behaviour + if(conf_.exists("pfECALClusIsolation")){ + phoPFECALClusIsolationToken_ = + consumes>(conf_.getParameter("pfECALClusIsolation")); + } + if(conf_.exists("pfHCALClusIsolation")){ + phoPFHCALClusIsolationToken_ = + consumes>(conf_.getParameter("pfHCALClusIsolation")); + } } else { photonCoreProducerT_ = @@ -191,7 +211,7 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) : // //moved from beginRun to here, I dont see how this could cause harm as its just reading in the exactly same parameters each run - if ( reconstructionStep_ != "final"){ + if ( !recoStep_.isFinal()){ thePhotonIsolationCalculator_ = new PhotonIsolationCalculator(); edm::ParameterSet isolationSumsCalculatorSet = conf_.getParameter("isolationSumsCalculatorSet"); thePhotonIsolationCalculator_->setup(isolationSumsCalculatorSet, flagsexclEB_, flagsexclEE_, severitiesexclEB_, severitiesexclEE_,consumesCollector()); @@ -223,7 +243,7 @@ GEDPhotonProducer::~GEDPhotonProducer() void GEDPhotonProducer::beginRun (edm::Run const& r, edm::EventSetup const & theEventSetup) { - if ( reconstructionStep_ != "final" ) { + if ( !recoStep_.isFinal() ) { thePhotonEnergyCorrector_ -> init(theEventSetup); } @@ -249,16 +269,26 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& the bool validPhotonHandle= false; Handle photonHandle; //value maps for isolation - edm::Handle > phoChargedIsolationMap_CITK; - edm::Handle > phoNeutralHadronIsolationMap_CITK; - edm::Handle > phoPhotonIsolationMap_CITK; + edm::Handle > phoChargedIsolationMapCITK; + edm::Handle > phoNeutralHadronIsolationMapCITK; + edm::Handle > phoPhotonIsolationMapCITK; + edm::Handle > phoPFECALClusIsolationMap; + edm::Handle > phoPFHCALClusIsolationMap; - if ( reconstructionStep_ == "final" ) { + if ( recoStep_.isFinal() ) { theEvent.getByToken(photonProducerT_,photonHandle); //get isolation objects - theEvent.getByToken(phoChargedIsolationToken_CITK,phoChargedIsolationMap_CITK); - theEvent.getByToken(phoNeutralHadronIsolationToken_CITK,phoNeutralHadronIsolationMap_CITK); - theEvent.getByToken(phoPhotonIsolationToken_CITK,phoPhotonIsolationMap_CITK); + theEvent.getByToken(phoChargedIsolationTokenCITK_,phoChargedIsolationMapCITK); + theEvent.getByToken(phoNeutralHadronIsolationTokenCITK_,phoNeutralHadronIsolationMapCITK); + theEvent.getByToken(phoPhotonIsolationTokenCITK_,phoPhotonIsolationMapCITK); + //OOT photons in legacy 80X re-miniAOD workflow dont have cluster isolation embed in them + if(!phoPFECALClusIsolationToken_.isUninitialized()) { + theEvent.getByToken(phoPFECALClusIsolationToken_,phoPFECALClusIsolationMap); + } + if(!phoPFHCALClusIsolationToken_.isUninitialized()){ + theEvent.getByToken(phoPFHCALClusIsolationToken_,phoPFHCALClusIsolationMap); + } + if ( photonHandle.isValid()) { validPhotonHandle=true; } else { @@ -271,7 +301,7 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& the validPhotonCoreHandle=true; } else { throw cms::Exception("GEDPhotonProducer") - << "Error! Can't get the photonCoreProducer" << photonProducer_.label() << "\n"; + << "Error! Can't get the photonCoreProducer " << photonProducer_.label() << "\n"; } } @@ -319,10 +349,11 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& the Handle pfCandidateHandle; - if ( reconstructionStep_ == "final" ) { + if ( recoStep_.isFinal() ) { // Get the PF candidates collection theEvent.getByToken(pfCandidates_,pfCandidateHandle); - if (!pfCandidateHandle.isValid()) { + //OOT photons have no PF candidates so its not an error in this case + if (!pfCandidateHandle.isValid() && !recoStep_.isOOT()) { throw cms::Exception("GEDPhotonProducer") << "Error! Can't get the pfCandidates"; } @@ -393,7 +424,7 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& the iSC); iSC=0; - if ( validPhotonHandle && reconstructionStep_ == "final" ) + if ( validPhotonHandle && recoStep_.isFinal() ) fillPhotonCollection(theEvent, theEventSetup, photonHandle, @@ -403,9 +434,11 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& the vertexHandle, outputPhotonCollection, iSC, - phoChargedIsolationMap_CITK, - phoNeutralHadronIsolationMap_CITK, - phoPhotonIsolationMap_CITK); + phoChargedIsolationMapCITK, + phoNeutralHadronIsolationMapCITK, + phoPhotonIsolationMapCITK, + phoPFECALClusIsolationMap, + phoPFHCALClusIsolationMap); @@ -415,7 +448,7 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& the const edm::OrphanHandle photonOrphHandle = theEvent.put(std::move(outputPhotonCollection_p), photonCollection_); - if ( reconstructionStep_ != "final" && not pfEgammaCandidates_.isUninitialized()) { + if ( !recoStep_.isFinal() && not pfEgammaCandidates_.isUninitialized()) { //// Define the value map which associate to each Egamma-unbiassaed candidate (key-ref) the corresponding PhotonRef auto pfEGCandToPhotonMap_p = std::make_unique>(); edm::ValueMap::Filler filler(*pfEGCandToPhotonMap_p); @@ -759,7 +792,12 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, const edm::Handle pfEGCandidateHandle, edm::ValueMap pfEGCandToPhotonMap, edm::Handle< reco::VertexCollection > & vertexHandle, - reco::PhotonCollection & outputPhotonCollection, int& iSC, const edm::Handle>& chargedHadrons_, const edm::Handle>& neutralHadrons_, const edm::Handle>& photons_) { + reco::PhotonCollection & outputPhotonCollection, int& iSC, + const edm::Handle>& chargedHadrons, + const edm::Handle>& neutralHadrons, + const edm::Handle>& photons, + const edm::Handle>& pfEcalClusters, + const edm::Handle>& pfHcalClusters){ @@ -798,13 +836,24 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, //get the pointer for the photon object edm::Ptr photonPtr(photonHandle, lSC); - pfIso.chargedHadronIso = (*chargedHadrons_)[photonPtr] ; - pfIso.neutralHadronIso = (*neutralHadrons_)[photonPtr]; - pfIso.photonIso = (*photons_)[photonPtr]; + if(!recoStep_.isOOT()){ //out of time photons do not have PF info so skip in this case + pfIso.chargedHadronIso = (*chargedHadrons)[photonPtr] ; + pfIso.neutralHadronIso = (*neutralHadrons)[photonPtr]; + pfIso.photonIso = (*photons)[photonPtr]; + } + + //OOT photons in legacy 80X reminiAOD workflow dont have pf cluster isolation embeded into them at this stage + if(!phoPFECALClusIsolationToken_.isUninitialized()){ + pfIso.sumEcalClusterEt = (*pfEcalClusters)[photonPtr]; + }else pfIso.sumEcalClusterEt = 0.; + + if(!phoPFHCALClusIsolationToken_.isUninitialized()){ + pfIso.sumHcalClusterEt = (*pfHcalClusters)[photonPtr]; + }else pfIso.sumHcalClusterEt = 0.; + newCandidate.setPflowIsolationVariables(pfIso); newCandidate.setPflowIDVariables(pfID); - // do the regression thePhotonEnergyCorrector_->calculate(evt, newCandidate, subdet, *vertexHandle, es); if ( candidateP4type_ == "fromEcalEnergy") { diff --git a/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py b/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py index 06265eb97bf23..67c02d24db7f4 100644 --- a/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py +++ b/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py @@ -25,6 +25,8 @@ gedGsfElectronsTmp.maxEOverPBarrel = cms.double(2.) gedGsfElectronsTmp.maxEOverPEndcaps = cms.double(2.) +ootPhotonsTmp.primaryVertexProducer = cms.InputTag("hiSelectedVertex") +ootPhotonsTmp.isolationSumsCalculatorSet.trackProducer = cms.InputTag("hiGeneralTracks") ootPhotons.primaryVertexProducer = cms.InputTag("hiSelectedVertex") ootPhotons.isolationSumsCalculatorSet.trackProducer = cms.InputTag("hiGeneralTracks")