Skip to content
1 change: 1 addition & 0 deletions DataFormats/EgammaCandidates/interface/GsfElectron.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class GsfElectron : public RecoCandidate

// accessors
virtual GsfElectronCoreRef core() const ;
void setCore(const reco::GsfElectronCoreRef &core) { core_ = core; }

// forward core methods
virtual SuperClusterRef superCluster() const { return core()->superCluster() ; }
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/EgammaCandidates/interface/Photon.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ namespace reco {

/// returns a reference to the core photon object
reco::PhotonCoreRef photonCore() const { return photonCore_;}
void setPhotonCore(const reco::PhotonCoreRef &photonCore) { photonCore_ = photonCore; }

//
/// Retrieve photonCore attributes
//
Expand Down
3 changes: 3 additions & 0 deletions DataFormats/EgammaCandidates/interface/PhotonCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ namespace reco {
/// get vector of references to one leg Conversion's
reco::ConversionRefVector conversionsOneLeg() const {return conversionsOneLeg_;}

void setConversions(const reco::ConversionRefVector &conversions) { conversions_ = conversions; }
void setConversionsOneLeg(const reco::ConversionRefVector &conversions) { conversionsOneLeg_ = conversions; }

/// get reference to electron seed if existing
reco::ElectronSeedRefVector electronPixelSeeds() const {return electronSeed_;}
bool isPFlowPhoton() const {return isPFlowPhoton_;}
Expand Down
3 changes: 3 additions & 0 deletions DataFormats/EgammaReco/interface/SuperCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ namespace reco {
//(re)-set preshower clusters
void setPreshowerClusters(const CaloClusterPtrVector &clusters) { preshowerClusters_ = clusters; }

//clear hits and fractions vector (for slimming)
void clearHitsAndFractions() { hitsAndFractions_.clear(); }

/// add reference to constituent BasicCluster
void addCluster( const CaloClusterPtr & r ) {
clusters_.push_back( r );
Expand Down
51 changes: 47 additions & 4 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,56 @@ def miniAOD_customizeCommon(process):
process.patMuons.embedTpfmsMuon = False # no, use best track
process.patMuons.embedDytMuon = False # no, use best track
#
process.patElectrons.embedPflowSuperCluster = False
process.patElectrons.embedPflowBasicClusters = False
process.patElectrons.embedPflowPreshowerClusters = False
# disable embedding of electron and photon associated objects already stored by the ReducedEGProducer
process.patElectrons.embedGsfElectronCore = False ## process.patElectrons.embed in AOD externally stored gsf electron core
process.patElectrons.embedSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
process.patElectrons.embedPflowSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
process.patElectrons.embedSeedCluster = False ## process.patElectrons.embed in AOD externally stored the electron's seedcluster
process.patElectrons.embedBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's basic clusters
process.patElectrons.embedPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's preshower clusters
process.patElectrons.embedPflowBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow basic clusters
process.patElectrons.embedPflowPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow preshower clusters
Copy link
Owner

Choose a reason for hiding this comment

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

we still had this selection!? looks like a bug no?

Copy link
Owner

Choose a reason for hiding this comment

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

ah no it was the final suggestion from susy

process.patElectrons.embedRecHits = False ## process.patElectrons.embed in AOD externally stored the RecHits - can be called from the PATElectronProducer
process.patElectrons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
process.patElectrons.electronIDSources = cms.PSet(
# configure many IDs as InputTag <someName> = <someTag> you
# can comment out those you don't want to save some disk space
eidRobustLoose = cms.InputTag("reducedEgamma","eidRobustLoose"),
eidRobustTight = cms.InputTag("reducedEgamma","eidRobustTight"),
eidLoose = cms.InputTag("reducedEgamma","eidLoose"),
eidTight = cms.InputTag("reducedEgamma","eidTight"),
eidRobustHighEnergy = cms.InputTag("reducedEgamma","eidRobustHighEnergy"),
)
process.elPFIsoDepositCharged.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
process.elPFIsoDepositChargedAll.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
process.elPFIsoDepositNeutral.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
process.elPFIsoDepositGamma.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
process.elPFIsoDepositPU.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
#
process.patPhotons.embedSuperCluster = False ## whether to process.patPhotons.embed in AOD externally stored supercluster
process.patPhotons.embedSeedCluster = False ## process.patPhotons.embed in AOD externally stored the photon's seedcluster
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.photonSource = cms.InputTag("reducedEgamma","reducedGedPhotons")
process.patPhotons.photonIDSources = cms.PSet(
PhotonCutBasedIDLoose = cms.InputTag('reducedEgamma',
'PhotonCutBasedIDLoose'),
PhotonCutBasedIDTight = cms.InputTag('reducedEgamma',
'PhotonCutBasedIDTight')
)

process.phPFIsoDepositCharged.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
process.phPFIsoDepositChargedAll.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
process.phPFIsoDepositNeutral.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
process.phPFIsoDepositGamma.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
process.phPFIsoDepositPU.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
#
process.selectedPatJets.cut = cms.string("pt > 10")
process.selectedPatMuons.cut = cms.string("pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose')))")
process.selectedPatElectrons.cut = cms.string("")
process.selectedPatTaus.cut = cms.string("pt > 20 && tauID('decayModeFinding')> 0.5")
process.selectedPatPhotons.cut = cms.string("pt > 15 && hadTowOverEm()<0.15 ")
process.selectedPatPhotons.cut = cms.string("")
#
from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
#
Expand Down Expand Up @@ -59,7 +100,9 @@ def miniAOD_customizeCommon(process):
def miniAOD_customizeMC(process):
process.muonMatch.matched = "prunedGenParticles"
process.electronMatch.matched = "prunedGenParticles"
process.electronMatch.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
process.photonMatch.matched = "prunedGenParticles"
process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
process.tauMatch.matched = "prunedGenParticles"
process.patJetPartonMatch.matched = "prunedGenParticles"
process.patJetGenJetMatch.matched = "slimmedGenJets"
Expand Down
12 changes: 6 additions & 6 deletions PhysicsTools/PatAlgos/python/slimming/slimmedElectrons_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
slimmedElectrons = cms.EDProducer("PATElectronSlimmer",
src = cms.InputTag("selectedPatElectrons"),
dropSuperCluster = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropBasicClusters = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropPFlowClusters = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropPreshowerClusters = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropSeedCluster = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropRecHits = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropBasicClusters = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropPFlowClusters = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropPreshowerClusters = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropSeedCluster = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropRecHits = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropCorrections = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropIsolations = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropShapes = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropExtrapolations = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
dropClassifications = cms.string("pt < 5"), # you can put a cut to slim selectively, e.g. pt < 10
linkToPackedPFCandidates = cms.bool(True),
recoToPFMap = cms.InputTag("particleBasedIsolation","gedGsfElectrons"),
recoToPFMap = cms.InputTag("reducedEgamma","reducedGsfElectronPfCandMap"),
packedPFCandidates = cms.InputTag("packedPFCandidates"),
saveNonZSClusterShapes = cms.string("pt > 5"), # save additional user floats: (sigmaIetaIeta,sigmaIphiIphi,sigmaIetaIphi,r9,e1x5_over_e5x5)_NoZS
)
Expand Down
8 changes: 4 additions & 4 deletions PhysicsTools/PatAlgos/python/slimming/slimmedPhotons_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
slimmedPhotons = cms.EDProducer("PATPhotonSlimmer",
src = cms.InputTag("selectedPatPhotons"),
dropSuperCluster = cms.string("0"), # always keep SC? # ! (r9()>0.8 || chargedHadronIso()<20 || chargedHadronIso()<0.3*pt())"), # you can put a cut to slim selectively, e.g. pt < 10
dropBasicClusters = cms.string("! (r9()>0.8 || chargedHadronIso()<20 || chargedHadronIso()<0.3*pt())"), # you can put a cut to slim selectively, e.g. pt < 10
dropPreshowerClusters = cms.string("! (r9()>0.8 || chargedHadronIso()<20 || chargedHadronIso()<0.3*pt())"), # you can put a cut to slim selectively, e.g. pt < 10
dropBasicClusters = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropPreshowerClusters = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropSeedCluster = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
dropRecHits = cms.string("! (r9()>0.8 || chargedHadronIso()<20 || chargedHadronIso()<0.3*pt())"), # you can put a cut to slim selectively, e.g. pt < 10
dropRecHits = cms.string("0"), # you can put a cut to slim selectively, e.g. pt < 10
linkToPackedPFCandidates = cms.bool(True),
recoToPFMap = cms.InputTag("particleBasedIsolation","gedPhotons"),
recoToPFMap = cms.InputTag("reducedEgamma","reducedPhotonPfCandMap"),
packedPFCandidates = cms.InputTag("packedPFCandidates"),
saveNonZSClusterShapes = cms.string("(r9()>0.8 || chargedHadronIso()<20 || chargedHadronIso()<0.3*pt())"), # save additional user floats: (sigmaIetaIeta,sigmaIphiIphi,sigmaIetaIphi,r9,e1x5_over_e5x5)_NoZS
)
8 changes: 8 additions & 0 deletions PhysicsTools/PatAlgos/python/slimming/slimming_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
'keep *_slimmedSecondaryVertices*_*_*',
## add extra METs

'keep recoPhotonCores_reducedEgamma_*_*',
'keep recoGsfElectronCores_reducedEgamma_*_*',
'keep recoConversions_reducedEgamma_*_*',
'keep recoSuperClusters_reducedEgamma_*_*',
'keep recoCaloClusters_reducedEgamma_*_*',
'keep EcalRecHitsSorted_reducedEgamma_*_*',


'drop *_*_caloTowers_*',
'drop *_*_pfCandidates_*',
'drop *_*_genJets_*',
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/PatAlgos/test/miniAOD/patTuple_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
process.options.allowUnscheduled = cms.untracked.bool(True)
#process.Tracer = cms.Service("Tracer")

process.load("RecoEgamma.EgammaPhotonProducers.reducedEgamma_cfi")
process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff")
process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff")

Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/PatAlgos/test/miniAOD/patTuple_mini_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
process.options.allowUnscheduled = cms.untracked.bool(True)
#process.Tracer = cms.Service("Tracer")

process.load("RecoEgamma.EgammaPhotonProducers.reducedEgamma_cfi")
process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff")
process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff")

Expand Down
106 changes: 106 additions & 0 deletions RecoEgamma/EgammaPhotonProducers/interface/ReducedEGProducer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#ifndef RecoEgamma_EgammaPhotonProducers_ReducedEGProducer_h
#define RecoEgamma_EgammaPhotonProducers_ReducedEGProducer_h
/** \class ReducedEGProducer
**
** Select subset of electrons and photons from input collections and
** produced consistently relinked output collections including
** associated SuperClusters, CaloClusters and ecal RecHits
**
** \author J.Bendavid (CERN)
**
***/

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloTopology/interface/CaloTopology.h"
#include "DataFormats/EgammaCandidates/interface/Conversion.h"
#include "DataFormats/EgammaReco/interface/BasicCluster.h"
#include "DataFormats/EgammaReco/interface/SuperCluster.h"
#include "DataFormats/EgammaCandidates/interface/Photon.h"
#include "DataFormats/EgammaCandidates/interface/PhotonCore.h"
#include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
#include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/PfBlockBasedIsolation.h"
#include "RecoCaloTools/MetaCollections/interface/CaloRecHitMetaCollections.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
#include "RecoEgamma/PhotonIdentification/interface/PFPhotonIsolationCalculator.h"
#include "RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
#include "RecoEgamma/PhotonIdentification/interface/PhotonMIPHaloTagger.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h"
#include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h"
#include "RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h"

#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"

#include "CommonTools/UtilAlgos/interface/StringCutObjectSelector.h"


// ReducedEGProducer inherits from EDProducer, so it can be a module:
class ReducedEGProducer : public edm::EDProducer {

public:

ReducedEGProducer (const edm::ParameterSet& ps);
~ReducedEGProducer();

virtual void produce(edm::Event& evt, const edm::EventSetup& es);

private:

//tokens for input collections
edm::EDGetTokenT<reco::PhotonCollection> photonT_;
edm::EDGetTokenT<reco::GsfElectronCollection> gsfElectronT_;
edm::EDGetTokenT<reco::ConversionCollection> conversionT_;
edm::EDGetTokenT<reco::ConversionCollection> singleConversionT_;

edm::EDGetTokenT<EcalRecHitCollection> barrelEcalHits_;
edm::EDGetTokenT<EcalRecHitCollection> endcapEcalHits_;
edm::EDGetTokenT<EcalRecHitCollection> preshowerEcalHits_;

edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef> > > photonPfCandMapT_;
edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef> > > gsfElectronPfCandMapT_;

std::vector<edm::EDGetTokenT<edm::ValueMap<bool> > > photonIdTs_;
std::vector<edm::EDGetTokenT<edm::ValueMap<float> > > gsfElectronIdTs_;

//names for output collections
std::string outPhotons_;
std::string outPhotonCores_;
std::string outGsfElectrons_;
std::string outGsfElectronCores_;
std::string outConversions_;
std::string outSingleConversions_;
std::string outSuperClusters_;
std::string outEBEEClusters_;
std::string outESClusters_;
std::string outEBRecHits_;
std::string outEERecHits_;
std::string outESRecHits_;
std::string outPhotonPfCandMap_;
std::string outGsfElectronPfCandMap_;
std::vector<std::string> outPhotonIds_;
std::vector<std::string> outGsfElectronIds_;

StringCutObjectSelector<reco::Photon> keepPhotonSel_;
StringCutObjectSelector<reco::Photon> slimRelinkPhotonSel_;
StringCutObjectSelector<reco::Photon> relinkPhotonSel_;
StringCutObjectSelector<reco::GsfElectron> keepGsfElectronSel_;
StringCutObjectSelector<reco::GsfElectron> slimRelinkGsfElectronSel_;
StringCutObjectSelector<reco::GsfElectron> relinkGsfElectronSel_;



};
#endif


45 changes: 45 additions & 0 deletions RecoEgamma/EgammaPhotonProducers/python/reducedEgamma_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import FWCore.ParameterSet.Config as cms

reducedEgamma = cms.EDProducer("ReducedEGProducer",
keepPhotons = cms.string("pt > 14 && hadTowOverEm()<0.15"), #keep in output
slimRelinkPhotons = cms.string("pt > 14 && hadTowOverEm()<0.15"), #keep only slimmed SuperCluster plus seed cluster
relinkPhotons = cms.string("(r9()>0.8 || chargedHadronIso()<20 || chargedHadronIso()<0.3*pt())"), #keep all associated clusters/rechits/conversions
keepGsfElectrons = cms.string(""), #keep in output
slimRelinkGsfElectrons = cms.string(""), #keep only slimmed SuperCluster plus seed cluster
relinkGsfElectrons = cms.string("pt>5"), #keep all associated clusters/rechits/conversions
photons = cms.InputTag("gedPhotons"),
gsfElectrons = cms.InputTag("gedGsfElectrons"),
conversions = cms.InputTag("allConversions"),
singleConversions = cms.InputTag("gedPhotonCore"),
barrelEcalHits = cms.InputTag("reducedEcalRecHitsEB"),
endcapEcalHits = cms.InputTag("reducedEcalRecHitsEE"),
preshowerEcalHits = cms.InputTag("reducedEcalRecHitsES"),
photonsPFValMap = cms.InputTag("particleBasedIsolation","gedPhotons"),
gsfElectronsPFValMap = cms.InputTag("particleBasedIsolation","gedGsfElectrons"),
photonIDSources = cms.VInputTag(
cms.InputTag("PhotonIDProdGED","PhotonCutBasedIDLoose"),
cms.InputTag("PhotonIDProdGED","PhotonCutBasedIDLooseEM"),
cms.InputTag("PhotonIDProdGED","PhotonCutBasedIDTight")
),
photonIDOutput = cms.vstring(
"PhotonCutBasedIDLoose",
"PhotonCutBasedIDLooseEM",
"PhotonCutBasedIDTight",
),
gsfElectronIDSources = cms.VInputTag(
cms.InputTag("eidLoose"),
cms.InputTag("eidRobustHighEnergy"),
cms.InputTag("eidRobustLoose"),
cms.InputTag("eidRobustTight"),
cms.InputTag("eidTight"),
),
gsfElectronIDOutput = cms.vstring(
"eidLoose",
"eidRobustHighEnergy",
"eidRobustLoose",
"eidRobustTight",
"eidTight",
),
)


Loading