Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding PFClusterIsolation to reco Egamma objects #21811

Merged
merged 3 commits into from Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions Configuration/Eras/python/Modifier_run2_miniAOD_9X_cff.py
@@ -0,0 +1,3 @@
import FWCore.ParameterSet.Config as cms

run2_miniAOD_9X = cms.Modifier()
2 changes: 1 addition & 1 deletion Configuration/StandardSequences/python/Eras.py
Expand Up @@ -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_9X', 'run2_nanoAOD_92X',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have requested in a slightly different context for #21977 to make a run2_miniAOD_94XFall17

So far we did not commit to making miniAOD support for the 92X RECO campaign.

So, perhaps this should change also to run2_miniAOD_94XFall17
instead of the visually much more inclusive run2_miniAOD_9X.

@Sam-Harper is there a particular need to maintain miniAOD workflows on top of 92X production for your needs?
@arizzi @gpetruc do you know of any plans for this (running miniAOD campaings on 92X reco campaing)?

'hcalHardcodeConditions', 'hcalSkipPacker']
internalUseModChains = ['run2_2017_noTrackingModifier']

Expand Down
11 changes: 9 additions & 2 deletions DataFormats/EgammaCandidates/interface/GsfElectron.h
Expand Up @@ -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
Expand Down Expand Up @@ -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_ ; }

Expand Down
13 changes: 10 additions & 3 deletions DataFormats/EgammaCandidates/interface/Photon.h
Expand Up @@ -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),
Expand All @@ -474,7 +475,9 @@ namespace reco {
sumChargedParticlePt(0),
sumNeutralHadronEtHighThreshold(0),
sumPhotonEtHighThreshold(0),
sumPUPt(0)
sumPUPt(0),
sumEcalClusterEt(0),
sumHcalClusterEt(0)
{}


Expand All @@ -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_; }
Expand Down
6 changes: 4 additions & 2 deletions DataFormats/EgammaCandidates/src/classes_def.xml
Expand Up @@ -52,9 +52,10 @@
<version ClassVersion="10" checksum="3308689624"/>
<version ClassVersion="11" checksum="3649971983"/>
</class>
<class name="reco::Photon::PflowIsolationVariables" ClassVersion="12">
<class name="reco::Photon::PflowIsolationVariables" ClassVersion="13">
<version ClassVersion="11" checksum="3200292660"/>
<version ClassVersion="12" checksum="114160170"/>
<version ClassVersion="13" checksum="3959509359"/>
</class>
<class name="reco::Photon::PflowIDVariables" ClassVersion="3">
<version ClassVersion="3" checksum="2819734289"/>
Expand Down Expand Up @@ -179,7 +180,8 @@
<class name="reco::GsfElectron::ChargeInfo" ClassVersion="10">
<version ClassVersion="10" checksum="1415326811"/>
</class>
<class name="reco::GsfElectron::PflowIsolationVariables" ClassVersion="11">
<class name="reco::GsfElectron::PflowIsolationVariables" ClassVersion="12">
<version ClassVersion="12" checksum="2416379203"/>
<version ClassVersion="11" checksum="2389048798"/>
<version ClassVersion="10" checksum="4270399196"/>
<ioread sourceClass="reco::GsfElectron::PflowIsolationVariables" version="[1-10]" source="float chargedHadronIso" targetClass="reco::GsfElectron::PflowIsolationVariables" target="sumChargedHadronPt">
Expand Down
9 changes: 0 additions & 9 deletions DataFormats/PatCandidates/interface/Electron.h
Expand Up @@ -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_; }
Expand Down Expand Up @@ -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_;
Expand Down
9 changes: 0 additions & 9 deletions DataFormats/PatCandidates/interface/Photon.h
Expand Up @@ -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); }
Expand Down Expand Up @@ -402,9 +396,6 @@ namespace pat {
float iEta_;
float iPhi_;

float ecalPFClusIso_;
float hcalPFClusIso_;

//PUPPI isolations
float puppiChargedHadronIso_;
float puppiNeutralHadronIso_;
Expand Down
6 changes: 4 additions & 2 deletions DataFormats/PatCandidates/src/classes_def_objects.xml
Expand Up @@ -16,7 +16,8 @@
<class name="pat::Lepton<reco::BaseTau>" />

<!-- PAT Objects, and embedded data -->
<class name="pat::Electron" ClassVersion="37">
<class name="pat::Electron" ClassVersion="38">
<version ClassVersion="38" checksum="1251314096"/>
<version ClassVersion="37" checksum="4284869321"/>
<version ClassVersion="36" checksum="199321903"/>
<version ClassVersion="35" checksum="482655666"/>
Expand Down Expand Up @@ -213,7 +214,8 @@
</ioread>

<class name="std::vector<pat::tau::TauPFEssential>" />
<class name="pat::Photon" ClassVersion="20">
<class name="pat::Photon" ClassVersion="21">
<version ClassVersion="21" checksum="3263223164"/>
<version ClassVersion="20" checksum="1579185367"/>
<version ClassVersion="19" checksum="4285818507"/>
<version ClassVersion="18" checksum="1413598928"/>
Expand Down
24 changes: 11 additions & 13 deletions PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc
Expand Up @@ -446,14 +446,12 @@ void PATElectronProducer::produce(edm::Event & iEvent, const edm::EventSetup & i
iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
edm::Handle<edm::ValueMap<float> > 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<DetId> selectedCells;
bool barrel = itElectron->isEB();
//loop over sub clusters
Expand Down Expand Up @@ -675,20 +673,20 @@ void PATElectronProducer::produce(edm::Event & iEvent, const edm::EventSetup & i
std::vector<float> vCov = lazyTools.localCovariances(*( itElectron->superCluster()->seed()));
anElectron.setMvaVariables(vCov[1], ip3d);
}

// PFCluster Isolation
if (addPFClusterIso_) {
// Get PFCluster Isolation
edm::Handle<edm::ValueMap<float> > ecalPFClusterIsoMapH;
iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
edm::Handle<edm::ValueMap<float> > 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]);
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc
Expand Up @@ -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()); }
Expand Down
14 changes: 6 additions & 8 deletions PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc
Expand Up @@ -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<edm::ValueMap<float> > ecalPFClusterIsoMapH;
iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
aPhoton.setEcalPFClusterIso((*ecalPFClusterIsoMapH)[photonRef]);
newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[photonRef];
edm::Handle<edm::ValueMap<float> > 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
Expand Down
Expand Up @@ -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
Expand All @@ -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 = "")
34 changes: 27 additions & 7 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Expand Up @@ -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_9X_cff import run2_miniAOD_9X
run2_miniAOD_9X.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")
Expand All @@ -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")
Expand All @@ -77,16 +83,30 @@ 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)
process.patPhotons.puppiIsolationChargedHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h+-DR030-")
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_9X_cff import run2_miniAOD_9X
run2_miniAOD_9X.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_9X.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(
Expand Down