diff --git a/CommonTools/MVAUtils/BuildFile.xml b/CommonTools/MVAUtils/BuildFile.xml
index 26b7b5c239e4e..f0798188522fc 100644
--- a/CommonTools/MVAUtils/BuildFile.xml
+++ b/CommonTools/MVAUtils/BuildFile.xml
@@ -1,10 +1,10 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/CommonTools/MVAUtils/bin/BuildFile.xml b/CommonTools/MVAUtils/bin/BuildFile.xml
new file mode 100644
index 0000000000000..147f2d969912d
--- /dev/null
+++ b/CommonTools/MVAUtils/bin/BuildFile.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/CommonTools/MVAUtils/bin/convertXMLToGBRForestROOT.cc b/CommonTools/MVAUtils/bin/convertXMLToGBRForestROOT.cc
new file mode 100644
index 0000000000000..9dcda320d01c2
--- /dev/null
+++ b/CommonTools/MVAUtils/bin/convertXMLToGBRForestROOT.cc
@@ -0,0 +1,34 @@
+#include "CommonTools/MVAUtils/interface/GBRForestTools.h"
+
+#include "TFile.h"
+
+#include
+#include
+
+int main(int argc, char **argv) {
+ if (argc != 3) {
+ std::cout << "Please pass a (gzipped) BDT weight file and a name for the output ROOT file." << std::endl;
+ return 1;
+ }
+
+ char *inputFileName = argv[1];
+ char *outputFileName = argv[2];
+
+ if (!boost::filesystem::exists(inputFileName)) {
+ std::cout << "Input file " << inputFileName << " does not exists." << std::endl;
+ return 1;
+ }
+
+ if (boost::filesystem::exists(outputFileName)) {
+ std::cout << "Output file " << outputFileName << " already exists." << std::endl;
+ return 1;
+ }
+
+ auto gbrForest = createGBRForest(inputFileName);
+ std::cout << "Read GBRForest " << inputFileName << " successfully." << std::endl;
+
+ TFile{outputFileName, "RECREATE"}.WriteObject(gbrForest.get(), "gbrForest");
+ std::cout << "GBRForest written to " << outputFileName << " successfully." << std::endl;
+
+ return 0;
+}
diff --git a/CommonTools/MVAUtils/src/GBRForestTools.cc b/CommonTools/MVAUtils/src/GBRForestTools.cc
index 6f40fd3059cd5..988f9f80a9b42 100644
--- a/CommonTools/MVAUtils/src/GBRForestTools.cc
+++ b/CommonTools/MVAUtils/src/GBRForestTools.cc
@@ -3,6 +3,8 @@
#include "FWCore/ParameterSet/interface/FileInPath.h"
#include "FWCore/Utilities/interface/Exception.h"
+#include "TFile.h"
+
#include
#include
#include
@@ -117,6 +119,16 @@ namespace {
}
std::unique_ptr init(const std::string& weightsFileFullPath, std::vector& varNames) {
+ //
+ // Load weights file, for ROOT file
+ //
+ if (reco::details::hasEnding(weightsFileFullPath, ".root")) {
+ TFile gbrForestFile(weightsFileFullPath.c_str());
+ std::unique_ptr up(reinterpret_cast(gbrForestFile.Get("gbrForest")));
+ gbrForestFile.Close("nodelete");
+ return up;
+ }
+
//
// Load weights file, for gzipped or raw xml file
//
diff --git a/DataFormats/PatCandidates/src/classes_def_objects.xml b/DataFormats/PatCandidates/src/classes_def_objects.xml
index 9a2cd10b18b6c..56defc2734792 100644
--- a/DataFormats/PatCandidates/src/classes_def_objects.xml
+++ b/DataFormats/PatCandidates/src/classes_def_objects.xml
@@ -486,6 +486,8 @@
+
+
diff --git a/PhysicsTools/PatAlgos/plugins/BuildFile.xml b/PhysicsTools/PatAlgos/plugins/BuildFile.xml
index e7d2c6386a13a..29d6b64440915 100644
--- a/PhysicsTools/PatAlgos/plugins/BuildFile.xml
+++ b/PhysicsTools/PatAlgos/plugins/BuildFile.xml
@@ -11,6 +11,7 @@
+
diff --git a/PhysicsTools/PatAlgos/plugins/LowPtGSFToPackedCandidateLinker.cc b/PhysicsTools/PatAlgos/plugins/LowPtGSFToPackedCandidateLinker.cc
index 9c992daaa0966..a82b2fd3ac561 100644
--- a/PhysicsTools/PatAlgos/plugins/LowPtGSFToPackedCandidateLinker.cc
+++ b/PhysicsTools/PatAlgos/plugins/LowPtGSFToPackedCandidateLinker.cc
@@ -1,10 +1,11 @@
#include
#include "DataFormats/Candidate/interface/Candidate.h"
+#include "DataFormats/Common/interface/RefToPtr.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
-#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
+#include "DataFormats/PatCandidates/interface/Electron.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
#include "DataFormats/Common/interface/Association.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
@@ -19,144 +20,174 @@
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
+typedef edm::Ptr PackedCandidatePtr;
+typedef std::vector PackedCandidatePtrCollection;
+
class LowPtGSFToPackedCandidateLinker : public edm::global::EDProducer<> {
public:
- explicit LowPtGSFToPackedCandidateLinker(const edm::ParameterSet&);
- ~LowPtGSFToPackedCandidateLinker() override;
-
- void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
- static void fillDescriptions(edm::ConfigurationDescriptions&);
-
+ explicit LowPtGSFToPackedCandidateLinker(const edm::ParameterSet&);
+ ~LowPtGSFToPackedCandidateLinker() override;
+
+ void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
+ static void fillDescriptions(edm::ConfigurationDescriptions&);
+
private:
- const edm::EDGetTokenT pfcands_;
- const edm::EDGetTokenT packed_;
- const edm::EDGetTokenT lost_tracks_;
- const edm::EDGetTokenT tracks_;
- const edm::EDGetTokenT > pf2packed_;
- const edm::EDGetTokenT > lost2trk_;
- const edm::EDGetTokenT< edm::Association > gsf2trk_;
- const edm::EDGetTokenT< std::vector > gsftracks_;
+ const edm::EDGetTokenT pfcands_;
+ const edm::EDGetTokenT packed_;
+ const edm::EDGetTokenT lost_tracks_;
+ const edm::EDGetTokenT tracks_;
+ const edm::EDGetTokenT > pf2packed_;
+ const edm::EDGetTokenT > lost2trk_;
+ const edm::EDGetTokenT > gsf2trk_;
+ const edm::EDGetTokenT > gsftracks_;
+ const edm::EDGetTokenT > electrons_;
};
-LowPtGSFToPackedCandidateLinker::LowPtGSFToPackedCandidateLinker(const edm::ParameterSet& iConfig) :
- pfcands_{consumes(iConfig.getParameter("PFCandidates"))},
- packed_{consumes(iConfig.getParameter("packedCandidates"))},
- lost_tracks_{consumes(iConfig.getParameter("lostTracks"))},
- tracks_{consumes(iConfig.getParameter("tracks"))},
- pf2packed_{consumes >(iConfig.getParameter("packedCandidates"))},
- lost2trk_{consumes >(iConfig.getParameter("lostTracks"))},
- gsf2trk_{consumes >(iConfig.getParameter("gsfToTrack"))},
- gsftracks_{consumes >(iConfig.getParameter("gsfTracks"))} {
- produces< edm::Association > ("packedCandidates");
- produces< edm::Association > ("lostTracks");
- }
+LowPtGSFToPackedCandidateLinker::LowPtGSFToPackedCandidateLinker(const edm::ParameterSet& iConfig)
+ : pfcands_{consumes(iConfig.getParameter("PFCandidates"))},
+ packed_{consumes(iConfig.getParameter("packedCandidates"))},
+ lost_tracks_{consumes(iConfig.getParameter("lostTracks"))},
+ tracks_{consumes(iConfig.getParameter("tracks"))},
+ pf2packed_{consumes >(
+ iConfig.getParameter("packedCandidates"))},
+ lost2trk_{consumes >(
+ iConfig.getParameter("lostTracks"))},
+ gsf2trk_{consumes >(iConfig.getParameter("gsfToTrack"))},
+ gsftracks_{consumes >(iConfig.getParameter("gsfTracks"))},
+ electrons_{consumes >(iConfig.getParameter("electrons"))} {
+ produces >("gsf2packed");
+ produces >("gsf2lost");
+ produces >("ele2packed");
+ produces >("ele2lost");
+}
LowPtGSFToPackedCandidateLinker::~LowPtGSFToPackedCandidateLinker() {}
void LowPtGSFToPackedCandidateLinker::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
- edm::Handle pfcands;
- iEvent.getByToken(pfcands_, pfcands);
-
- edm::Handle packed;
- iEvent.getByToken(packed_, packed);
-
- edm::Handle lost_tracks;
- iEvent.getByToken(lost_tracks_, lost_tracks);
-
- edm::Handle > pf2packed;
- iEvent.getByToken(pf2packed_, pf2packed);
-
- edm::Handle > lost2trk_assoc;
- iEvent.getByToken(lost2trk_, lost2trk_assoc);
-
- edm::Handle > gsftracks;
- iEvent.getByToken(gsftracks_, gsftracks);
-
- edm::Handle tracks;
- iEvent.getByToken(tracks_, tracks);
-
- edm::Handle > gsf2trk;
- iEvent.getByToken(gsf2trk_, gsf2trk);
-
- // collection sizes, for reference
- const size_t npf = pfcands->size();
- const size_t npacked = packed->size();
- const size_t nlost = lost_tracks->size();
- const size_t ntracks = tracks->size();
- const size_t ngsf = gsftracks->size();
-
- //store index mapping in vectors for easy and fast access
- std::vector trk2packed(ntracks, npacked);
- std::vector trk2lost(ntracks, nlost);
-
- //store auxiliary mappings for association
- std::vector gsf2pack(ngsf, -1);
- std::vector gsf2lost(ngsf, -1);
-
- //electrons will never store their track (they store the Gsf track)
- //map PackedPF <--> Track
- for(unsigned int icand=0; icand < npf; ++icand) {
- edm::Ref pf_ref(pfcands,icand);
- const reco::PFCandidate &cand = pfcands->at(icand);
- auto packed_ref = (*pf2packed)[pf_ref];
- if(cand.charge() && packed_ref.isNonnull() && cand.trackRef().isNonnull()
- && cand.trackRef().id() == tracks.id() ) {
- size_t trkid = cand.trackRef().index();
- size_t packid = packed_ref.index();
- trk2packed[trkid] = packid;
- }
- }
-
- //map LostTrack <--> Track
- for(unsigned int itrk=0; itrk < ntracks; ++itrk) {
- reco::TrackRef key(tracks, itrk);
- pat::PackedCandidateRef lostTrack = (*lost2trk_assoc)[key];
- if(lostTrack.isNonnull()) {
- size_t ilost = lostTrack.index(); //assumes that LostTracks are all made from the same track collection
- trk2lost[itrk] = ilost;
- }
- }
-
- //map Track --> GSF and fill GSF --> PackedCandidates and GSF --> Lost associations
- for(unsigned int igsf=0; igsf < ngsf; ++igsf) {
- reco::GsfTrackRef gref(gsftracks, igsf);
- reco::TrackRef trk = (*gsf2trk)[gref];
- if(trk.id() != tracks.id()) {
- throw cms::Exception("WrongCollection", "The reco::Track collection used to match against the GSF Tracks was not used to produce such tracks");
- }
- size_t trkid = trk.index();
-
- if(trk2packed[trkid] != npacked) {
- gsf2pack[igsf] = trk2packed[trkid];
- }
- if(trk2lost[trkid] != nlost) {
- gsf2lost[igsf] = trk2lost[trkid];
- }
- }
-
- // create output collections from the mappings
- auto assoc_gsf2pack = std::make_unique< edm::Association >(packed);
- edm::Association::Filler gsf2pack_filler(*assoc_gsf2pack);
- gsf2pack_filler.insert(gsftracks, gsf2pack.begin(), gsf2pack.end());
- gsf2pack_filler.fill();
- iEvent.put(std::move(assoc_gsf2pack), "packedCandidates");
-
- auto assoc_gsf2lost = std::make_unique< edm::Association >(lost_tracks);
- edm::Association::Filler gsf2lost_filler(*assoc_gsf2lost);
- gsf2lost_filler.insert(gsftracks, gsf2lost.begin(), gsf2lost.end());
- gsf2lost_filler.fill();
- iEvent.put(std::move(assoc_gsf2lost), "lostTracks");
+ auto pfcands = iEvent.getHandle(pfcands_);
+ auto packed = iEvent.getHandle(packed_);
+ auto lost_tracks = iEvent.getHandle(lost_tracks_);
+ auto pf2packed = iEvent.getHandle(pf2packed_);
+ auto lost2trk_assoc = iEvent.getHandle(lost2trk_);
+ auto gsftracks = iEvent.getHandle(gsftracks_);
+ auto tracks = iEvent.getHandle(tracks_);
+ auto gsf2trk = iEvent.getHandle(gsf2trk_);
+ auto electrons = iEvent.getHandle(electrons_);
+
+ // collection sizes, for reference
+ const size_t npf = pfcands->size();
+ const size_t npacked = packed->size();
+ const size_t nlost = lost_tracks->size();
+ const size_t ntracks = tracks->size();
+ const size_t ngsf = gsftracks->size();
+ const size_t nele = electrons->size();
+
+ //store index mapping in vectors for easy and fast access
+ std::vector trk2packed(ntracks, npacked);
+ std::vector trk2lost(ntracks, nlost);
+
+ //store auxiliary mappings for association
+ std::vector gsf2pack(ngsf, -1);
+ std::vector gsf2lost(ngsf, -1);
+ PackedCandidatePtrCollection ele2packedptr(nele, PackedCandidatePtr(packed, -1));
+ PackedCandidatePtrCollection ele2lostptr(nele, PackedCandidatePtr(lost_tracks, -1));
+
+ //electrons will never store their track (they store the Gsf track)
+ //map PackedPF <--> Track
+ for (unsigned int icand = 0; icand < npf; ++icand) {
+ edm::Ref pf_ref(pfcands, icand);
+ const reco::PFCandidate& cand = pfcands->at(icand);
+ auto packed_ref = (*pf2packed)[pf_ref];
+ if (cand.charge() && packed_ref.isNonnull() && cand.trackRef().isNonnull() && cand.trackRef().id() == tracks.id()) {
+ size_t trkid = cand.trackRef().index();
+ trk2packed[trkid] = packed_ref.index();
+ }
+ }
+
+ //map LostTrack <--> Track
+ for (unsigned int itrk = 0; itrk < ntracks; ++itrk) {
+ reco::TrackRef key(tracks, itrk);
+ pat::PackedCandidateRef lostTrack = (*lost2trk_assoc)[key];
+ if (lostTrack.isNonnull()) {
+ trk2lost[itrk] = lostTrack.index(); // assumes that LostTracks are all made from the same track collection
+ }
+ }
+
+ //map Track --> GSF and fill GSF --> PackedCandidates and GSF --> Lost associations
+ for (unsigned int igsf = 0; igsf < ngsf; ++igsf) {
+ reco::GsfTrackRef gsf_ref(gsftracks, igsf);
+ reco::TrackRef trk_ref = (*gsf2trk)[gsf_ref];
+ if (trk_ref.id() != tracks.id()) {
+ throw cms::Exception(
+ "WrongCollection",
+ "The reco::Track collection used to match against the GSF Tracks was not used to produce such tracks");
+ }
+ size_t trkid = trk_ref.index();
+ if (trk2packed[trkid] != npacked) {
+ gsf2pack[igsf] = trk2packed[trkid];
+ }
+ if (trk2lost[trkid] != nlost) {
+ gsf2lost[igsf] = trk2lost[trkid];
+ }
+ }
+
+ //map Electron-->pat::PFCandidatePtr via Electron-->GsfTrack-->Track and Track-->pat::PFCandidatePtr
+ for (unsigned int iele = 0; iele < nele; ++iele) {
+ auto const& ele = (*electrons)[iele];
+ reco::GsfTrackRef gsf_ref = ele.core()->gsfTrack();
+ reco::TrackRef trk_ref = (*gsf2trk)[gsf_ref];
+ if (trk_ref.id() != tracks.id()) {
+ throw cms::Exception(
+ "WrongCollection",
+ "The reco::Track collection used to match against the GSF Tracks was not used to produce such tracks");
+ }
+ size_t trkid = trk_ref.index();
+ auto packedIdx = trk2packed[trkid];
+ if (packedIdx != npacked) {
+ ele2packedptr[iele] = PackedCandidatePtr(packed, packedIdx);
+ }
+ auto lostIdx = trk2lost[trkid];
+ if (lostIdx != nlost) {
+ ele2lostptr[iele] = PackedCandidatePtr(lost_tracks, lostIdx);
+ }
+ }
+
+ // create output collections from the mappings
+ auto assoc_gsf2pack = std::make_unique >(packed);
+ edm::Association::Filler gsf2pack_filler(*assoc_gsf2pack);
+ gsf2pack_filler.insert(gsftracks, gsf2pack.begin(), gsf2pack.end());
+ gsf2pack_filler.fill();
+ iEvent.put(std::move(assoc_gsf2pack), "gsf2packed");
+
+ auto assoc_gsf2lost = std::make_unique >(lost_tracks);
+ edm::Association::Filler gsf2lost_filler(*assoc_gsf2lost);
+ gsf2lost_filler.insert(gsftracks, gsf2lost.begin(), gsf2lost.end());
+ gsf2lost_filler.fill();
+ iEvent.put(std::move(assoc_gsf2lost), "gsf2lost");
+
+ auto map_ele2packedptr = std::make_unique >();
+ edm::ValueMap::Filler ele2packedptr_filler(*map_ele2packedptr);
+ ele2packedptr_filler.insert(electrons, ele2packedptr.begin(), ele2packedptr.end());
+ ele2packedptr_filler.fill();
+ iEvent.put(std::move(map_ele2packedptr), "ele2packed");
+
+ auto map_ele2lostptr = std::make_unique >();
+ edm::ValueMap::Filler ele2lostptr_filler(*map_ele2lostptr);
+ ele2lostptr_filler.insert(electrons, ele2lostptr.begin(), ele2lostptr.end());
+ ele2lostptr_filler.fill();
+ iEvent.put(std::move(map_ele2lostptr), "ele2lost");
}
void LowPtGSFToPackedCandidateLinker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
- edm::ParameterSetDescription desc;
- desc.add("PFCandidates", edm::InputTag("particleFlow"));
- desc.add("packedCandidates", edm::InputTag("packedPFCandidates"));
- desc.add("lostTracks", edm::InputTag("lostTracks"));
- desc.add("tracks", edm::InputTag("generalTracks"));
- desc.add("gsfToTrack", edm::InputTag("lowPtGsfToTrackLinks"));
- desc.add("gsfTracks", edm::InputTag("lowPtGsfEleGsfTracks"));
- descriptions.add("lowPtGsfLinksDefault", desc);
+ edm::ParameterSetDescription desc;
+ desc.add("PFCandidates", edm::InputTag("particleFlow"));
+ desc.add("packedCandidates", edm::InputTag("packedPFCandidates"));
+ desc.add("lostTracks", edm::InputTag("lostTracks"));
+ desc.add("tracks", edm::InputTag("generalTracks"));
+ desc.add("gsfToTrack", edm::InputTag("lowPtGsfToTrackLinks"));
+ desc.add("gsfTracks", edm::InputTag("lowPtGsfEleGsfTracks"));
+ desc.add("electrons", edm::InputTag("selectedPatLowPtElectrons"));
+ descriptions.add("lowPtGsfLinksDefault", desc);
}
DEFINE_FWK_MODULE(LowPtGSFToPackedCandidateLinker);
diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/lowPtElectronProducer_cff.py b/PhysicsTools/PatAlgos/python/producersLayer1/lowPtElectronProducer_cff.py
index b64a33f7a3e3f..4a95b97d76edd 100644
--- a/PhysicsTools/PatAlgos/python/producersLayer1/lowPtElectronProducer_cff.py
+++ b/PhysicsTools/PatAlgos/python/producersLayer1/lowPtElectronProducer_cff.py
@@ -11,42 +11,49 @@
)
patLowPtElectrons = patElectrons.clone(
- # input collections
+
+ # Input collection
electronSource = sourceElectrons,
- genParticleMatch = cms.InputTag("lowPtElectronMatch"),
- # overrides
- addElectronID = cms.bool(False),
- addGenMatch = cms.bool(True),
- addMVAVariables = cms.bool(False),
- addPFClusterIso = cms.bool(False),
- electronIDSources = cms.PSet(),
- computeMiniIso = cms.bool(False),
- isoDeposits = cms.PSet(),
- isolationValues = cms.PSet(),
- isolationValuesNoPFId = cms.PSet(),
- miniIsoParamsB = cms.vdouble(),
- miniIsoParamsE = cms.vdouble(),
- usePfCandidateMultiMap = cms.bool(False),
- # embedding
- embedBasicClusters = cms.bool(False),
- embedGenMatch = cms.bool(False),
- embedGsfElectronCore = cms.bool(False),
- embedGsfTrack = cms.bool(False),
- embedHighLevelSelection = cms.bool(False),
- embedPFCandidate = cms.bool(False),
- embedPflowBasicClusters = cms.bool(False),
- embedPflowPreshowerClusters = cms.bool(False),
- embedPflowSuperCluster = cms.bool(False),
- embedPreshowerClusters = cms.bool(False),
- embedRecHits = cms.bool(False),
- embedSeedCluster = cms.bool(False),
- embedSuperCluster = cms.bool(False),
- embedTrack = cms.bool(True),
- )
+
+ # MC matching
+ genParticleMatch = "lowPtElectronMatch",
+
+ # Electron ID
+ addElectronID = True,
+ electronIDSources = dict(
+ unbiased = cms.InputTag("rekeyLowPtGsfElectronSeedValueMaps:unbiased"),
+ ptbiased = cms.InputTag("rekeyLowPtGsfElectronSeedValueMaps:ptbiased"),
+ ID = cms.InputTag("lowPtGsfElectronID"),
+ ),
+
+ # Embedding of RECO/AOD items
+
+ # Embedding of RECO/AOD items
+ embedTrack = True,
+ embedGsfElectronCore = True,
+ embedGsfTrack = True,
+ embedSuperCluster = True,
+ embedSeedCluster = True,
+ embedBasicClusters = True,
+ embedPreshowerClusters = False,
+ embedRecHits = False,
+ embedPflowSuperCluster = False,
+ embedPflowBasicClusters = False,
+ embedPflowPreshowerClusters = False,
+ embedPFCandidate = False,
+
+ # Miscellaneous flags
+ addMVAVariables = False,
+ embedHighLevelSelection = False,
+ isoDeposits = cms.PSet(),
+ isolationValues = cms.PSet(),
+ isolationValuesNoPFId = cms.PSet(),
+
+)
makePatLowPtElectronsTask = cms.Task(
lowPtElectronMatch,
- patLowPtElectrons
+ patLowPtElectrons,
)
makePatLowPtElectrons = cms.Sequence(makePatLowPtElectronsTask)
@@ -61,3 +68,13 @@
electronSource = "gedGsfElectrons",
genParticleMatch = "electronMatch"
)
+
+# Schedule rekeying of seed BDT ValueMaps by reco::GsfElectron for run2_miniAOD_UL and bParking
+from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
+from Configuration.Eras.Modifier_bParking_cff import bParking
+from RecoEgamma.EgammaElectronProducers.lowPtGsfElectronSeedValueMaps_cff import rekeyLowPtGsfElectronSeedValueMaps
+from RecoEgamma.EgammaElectronProducers.lowPtGsfElectronID_cff import lowPtGsfElectronID
+_makePatLowPtElectronsTask = makePatLowPtElectronsTask.copy()
+_makePatLowPtElectronsTask.add(rekeyLowPtGsfElectronSeedValueMaps)
+_makePatLowPtElectronsTask.add(lowPtGsfElectronID)
+(bParking | run2_miniAOD_UL).toReplaceWith(makePatLowPtElectronsTask,_makePatLowPtElectronsTask)
diff --git a/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py b/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py
index 436e4504b1c58..d5f030c665c64 100644
--- a/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py
+++ b/PhysicsTools/PatAlgos/python/producersLayer1/patCandidates_cff.py
@@ -34,8 +34,17 @@
makePatJetsTask,
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")) )
+
+from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
+from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
+_mAOD = (run2_miniAOD_94XFall17 | run2_miniAOD_80XLegacy)
+(pp_on_AA_2018 | _mAOD).toReplaceWith(patCandidatesTask,
+ patCandidatesTask.copyAndExclude([makePatLowPtElectronsTask]))
+(pp_on_AA_2018 | _mAOD).toModify(patCandidateSummary.candidates,
+ func = lambda list: list.remove(cms.InputTag("patLowPtElectrons")) )
diff --git a/PhysicsTools/PatAlgos/python/selectionLayer1/lowPtElectronSelector_cfi.py b/PhysicsTools/PatAlgos/python/selectionLayer1/lowPtElectronSelector_cfi.py
index 17b510bf0b51b..7ea6b50afd8b8 100644
--- a/PhysicsTools/PatAlgos/python/selectionLayer1/lowPtElectronSelector_cfi.py
+++ b/PhysicsTools/PatAlgos/python/selectionLayer1/lowPtElectronSelector_cfi.py
@@ -6,9 +6,13 @@
#
selectedPatLowPtElectrons = cms.EDFilter("PATElectronSelector",
src = cms.InputTag("patLowPtElectrons"),
- cut = cms.string("")
+ cut = cms.string("pt>1. && electronID('ID')>1.5"),
)
+# Modifier for bParking (fully open selection)
+from Configuration.Eras.Modifier_bParking_cff import bParking
+bParking.toModify(selectedPatLowPtElectrons,cut = "")
+
# Modifiers for legacy AOD
from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
diff --git a/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py b/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py
index 8521d05a34ada..674fcc7af1aec 100644
--- a/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py
+++ b/PhysicsTools/PatAlgos/python/selectionLayer1/selectedPatCandidates_cff.py
@@ -38,3 +38,11 @@
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")) )
+
+from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
+from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
+_mAOD = (run2_miniAOD_94XFall17 | run2_miniAOD_80XLegacy)
+(pp_on_AA_2018 | _mAOD).toReplaceWith(selectedPatCandidatesTask,
+ selectedPatCandidatesTask.copyAndExclude([selectedPatLowPtElectrons]))
+(pp_on_AA_2018 | _mAOD).toModify(selectedPatCandidateSummary.candidates,
+ func = lambda list: list.remove(cms.InputTag("selectedPatLowPtElectrons")) )
diff --git a/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py b/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py
index ae3ca344121b1..cf6fe37f71cc2 100644
--- a/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py
+++ b/PhysicsTools/PatAlgos/python/slimming/MicroEventContent_cff.py
@@ -116,19 +116,13 @@
)
)
-# Only add low pT electrons for bParking era
+# Only add low pT electrons for run2_miniAOD_UL or bParking era
+from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
from Configuration.Eras.Modifier_bParking_cff import bParking
-_bParking_extraCommands = ['keep *_slimmedLowPtElectrons_*_*',
- 'keep recoGsfElectronCores_lowPtGsfElectronCores_*_*',
- 'keep recoSuperClusters_lowPtGsfElectronSuperClusters_*_*',
- 'keep recoCaloClusters_lowPtGsfElectronSuperClusters_*_*',
- 'keep recoGsfTracks_lowPtGsfEleGsfTracks_*_*',
- 'keep floatedmValueMap_lowPtGsfElectronSeedValueMaps_*_*',
- 'keep floatedmValueMap_lowPtGsfElectronID_*_*',
- 'keep *_lowPtGsfLinks_*_*',
- 'keep *_gsfTracksOpenConversions_*_*',
- ]
-bParking.toModify(MicroEventContent, outputCommands = MicroEventContent.outputCommands + _bParking_extraCommands)
+_lowPt_extraCommands = ['keep *_slimmedLowPtElectrons_*_*',
+ 'keep *_gsfTracksOpenConversions_*_*',]
+(bParking | run2_miniAOD_UL).toModify(MicroEventContent,
+ outputCommands = MicroEventContent.outputCommands + _lowPt_extraCommands)
# --- Only for 2018 data & MC
_run2_HCAL_2018_extraCommands = ["keep *_packedPFCandidates_hcalDepthEnergyFractions_*"]
diff --git a/PhysicsTools/PatAlgos/python/slimming/slimmedLowPtElectrons_cff.py b/PhysicsTools/PatAlgos/python/slimming/slimmedLowPtElectrons_cff.py
new file mode 100644
index 0000000000000..ab4d571e45864
--- /dev/null
+++ b/PhysicsTools/PatAlgos/python/slimming/slimmedLowPtElectrons_cff.py
@@ -0,0 +1,10 @@
+import FWCore.ParameterSet.Config as cms
+
+from PhysicsTools.PatAlgos.slimming.slimmedLowPtElectrons_cfi import slimmedLowPtElectrons
+from PhysicsTools.PatAlgos.slimming.lowPtGsfLinks_cfi import lowPtGsfLinks
+
+# Task
+slimmedLowPtElectronsTask = cms.Task(
+ lowPtGsfLinks,
+ slimmedLowPtElectrons,
+)
diff --git a/PhysicsTools/PatAlgos/python/slimming/slimmedLowPtElectrons_cfi.py b/PhysicsTools/PatAlgos/python/slimming/slimmedLowPtElectrons_cfi.py
index 1095a37703ca2..684512a4ce0fd 100644
--- a/PhysicsTools/PatAlgos/python/slimming/slimmedLowPtElectrons_cfi.py
+++ b/PhysicsTools/PatAlgos/python/slimming/slimmedLowPtElectrons_cfi.py
@@ -20,7 +20,26 @@
saveNonZSClusterShapes = cms.string("1"), # save additional user floats: (sigmaIetaIeta,sigmaIphiIphi,sigmaIetaIphi,r9,e1x5_over_e5x5)_NoZS
reducedBarrelRecHitCollection = cms.InputTag("reducedEcalRecHitsEB"),
reducedEndcapRecHitCollection = cms.InputTag("reducedEcalRecHitsEE"),
- modifyElectrons = cms.bool(False),
- modifierConfig = cms.PSet( modifications = cms.VPSet() )
+ modifyElectrons = cms.bool(True),
+ modifierConfig = cms.PSet(
+ modifications = cms.VPSet(
+ cms.PSet(
+ electron_config = cms.PSet(
+ ele2packed = cms.InputTag("lowPtGsfLinks:ele2packed"),
+ electronSrc = cms.InputTag("selectedPatLowPtElectrons"),
+ ),
+ modifierName = cms.string('EGExtraInfoModifierFromPackedCandPtrValueMaps'),
+ photon_config = cms.PSet()
+ ),
+ cms.PSet(
+ electron_config = cms.PSet(
+ ele2lost = cms.InputTag("lowPtGsfLinks:ele2lost"),
+ electronSrc = cms.InputTag("selectedPatLowPtElectrons"),
+ ),
+ modifierName = cms.string('EGExtraInfoModifierFromPackedCandPtrValueMaps'),
+ photon_config = cms.PSet()
+ ),
+ )
+ )
)
diff --git a/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py b/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py
index f774236d2b476..81c69b447ed5a 100644
--- a/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py
+++ b/PhysicsTools/PatAlgos/python/slimming/slimming_cff.py
@@ -13,8 +13,7 @@
from PhysicsTools.PatAlgos.slimming.slimmedCaloJets_cfi import *
from PhysicsTools.PatAlgos.slimming.slimmedGenJets_cfi import *
from PhysicsTools.PatAlgos.slimming.slimmedElectrons_cfi import *
-from PhysicsTools.PatAlgos.slimming.slimmedLowPtElectrons_cfi import *
-from PhysicsTools.PatAlgos.slimming.lowPtGsfLinks_cfi import *
+from PhysicsTools.PatAlgos.slimming.slimmedLowPtElectrons_cff import *
from PhysicsTools.PatAlgos.slimming.slimmedTrackExtras_cff import *
from PhysicsTools.PatAlgos.slimming.slimmedMuons_cfi import *
from PhysicsTools.PatAlgos.slimming.slimmedPhotons_cfi import *
@@ -45,8 +44,7 @@
slimmedGenJets,
slimmedGenJetsAK8,
slimmedElectrons,
- slimmedLowPtElectrons,
- lowPtGsfLinks,
+ slimmedLowPtElectronsTask,
slimmedMuonTrackExtras,
slimmedMuons,
slimmedPhotons,
@@ -66,6 +64,12 @@
from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
pp_on_AA_2018.toReplaceWith(slimmingTask, slimmingTask.copyAndExclude([slimmedOOTPhotons]))
+from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
+from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
+_mAOD = (run2_miniAOD_94XFall17 | run2_miniAOD_80XLegacy)
+(pp_on_AA_2018 | _mAOD).toReplaceWith(slimmingTask,
+ slimmingTask.copyAndExclude([slimmedLowPtElectronsTask]))
+
from Configuration.Eras.Modifier_phase2_timing_cff import phase2_timing
_phase2_timing_slimmingTask = cms.Task(slimmingTask.copy(),
offlineSlimmedPrimaryVertices4D)
diff --git a/PhysicsTools/PatAlgos/test/IntegrationTest_cfg.py b/PhysicsTools/PatAlgos/test/IntegrationTest_cfg.py
index 4808105fcf8fa..fa1bd5897bfd7 100644
--- a/PhysicsTools/PatAlgos/test/IntegrationTest_cfg.py
+++ b/PhysicsTools/PatAlgos/test/IntegrationTest_cfg.py
@@ -22,6 +22,7 @@
process.selectedPatCandidates
)
+process.patLowPtElectrons.addElectronID = False
process.patLowPtElectrons.electronSource = "gedGsfElectrons"
process.patLowPtElectrons.genParticleMatch = "electronMatch"
process.selectedPatLowPtElectrons.cut = "pt>99999."
diff --git a/PhysicsTools/PatAlgos/test/patTuple_addTriggerInfo_cfg.py b/PhysicsTools/PatAlgos/test/patTuple_addTriggerInfo_cfg.py
index 313f0465bb950..9e7c2fe6ffa7e 100644
--- a/PhysicsTools/PatAlgos/test/patTuple_addTriggerInfo_cfg.py
+++ b/PhysicsTools/PatAlgos/test/patTuple_addTriggerInfo_cfg.py
@@ -18,6 +18,7 @@
process.selectedPatCandidates
)
+process.patLowPtElectrons.addElectronID = False
process.patLowPtElectrons.electronSource = "gedGsfElectrons"
process.patLowPtElectrons.genParticleMatch = "electronMatch"
process.selectedPatLowPtElectrons.cut = "pt>99999."
diff --git a/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py b/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py
index 908e887d2765a..6f661aa503296 100644
--- a/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py
+++ b/RecoEgamma/Configuration/python/RecoEgamma_EventContent_cff.py
@@ -49,6 +49,7 @@
'keep *_lowPtGsfToTrackLinks_*_*',
'keep recoSuperClusters_lowPtGsfElectronSuperClusters_*_*',
'keep floatedmValueMap_lowPtGsfElectronSeedValueMaps_*_*',
+ 'keep floatedmValueMap_rekeyLowPtGsfElectronSeedValueMaps_*_*',
'keep floatedmValueMap_lowPtGsfElectronID_*_*',
)
)
@@ -114,6 +115,7 @@
'keep *_lowPtGsfToTrackLinks_*_*',
'keep recoSuperClusters_lowPtGsfElectronSuperClusters_*_*',
'keep floatedmValueMap_lowPtGsfElectronSeedValueMaps_*_*',
+ 'keep floatedmValueMap_rekeyLowPtGsfElectronSeedValueMaps_*_*',
'keep floatedmValueMap_lowPtGsfElectronID_*_*',
)
)
@@ -168,8 +170,8 @@
'keep *_lowPtGsfToTrackLinks_*_*',
'keep recoSuperClusters_lowPtGsfElectronSuperClusters_*_*',
'keep floatedmValueMap_lowPtGsfElectronSeedValueMaps_*_*',
- 'keep floatedmValueMap_lowPtGsfElectronID_*_*',
- )
+ 'keep floatedmValueMap_rekeyLowPtGsfElectronSeedValueMaps_*_*',
+ 'keep floatedmValueMap_lowPtGsfElectronID_*_*')
)
# mods for HGCAL
diff --git a/RecoEgamma/EgammaElectronProducers/BuildFile.xml b/RecoEgamma/EgammaElectronProducers/BuildFile.xml
index 69d9727f84652..1484c2266539e 100644
--- a/RecoEgamma/EgammaElectronProducers/BuildFile.xml
+++ b/RecoEgamma/EgammaElectronProducers/BuildFile.xml
@@ -1,3 +1,4 @@
+
diff --git a/RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h b/RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h
new file mode 100644
index 0000000000000..469a8d16b89b7
--- /dev/null
+++ b/RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h
@@ -0,0 +1,42 @@
+#ifndef RecoEgamma_EgammaElectronProducers_LowPtGsfElectronFeatures_h
+#define RecoEgamma_EgammaElectronProducers_LowPtGsfElectronFeatures_h
+
+#include "DataFormats/BeamSpot/interface/BeamSpot.h"
+#include "DataFormats/Common/interface/Ptr.h"
+#include "DataFormats/Common/interface/Ref.h"
+#include "DataFormats/Common/interface/RefToPtr.h"
+#include "DataFormats/Common/interface/View.h"
+#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
+#include "DataFormats/ParticleFlowReco/interface/PreId.h"
+#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
+#include
+
+namespace lowptgsfeleid {
+
+ // feature list for new model (2019Sept15)
+ std::vector features_V1(reco::GsfElectron const& ele, float rho, float unbiased, float field_z);
+
+ // feature list for original models (2019Aug07 and earlier)
+ std::vector features_V0(reco::GsfElectron const& ele, float rho, float unbiased);
+
+ // Find most energetic clusters
+ void findEnergeticClusters(reco::SuperCluster const&, int&, float&, float&, int&, int&);
+
+ // Track-cluster matching for most energetic clusters
+ void trackClusterMatching(reco::SuperCluster const&,
+ reco::GsfTrack const&,
+ bool const&,
+ GlobalPoint const&,
+ float&,
+ float&,
+ float&,
+ float&,
+ float&,
+ float&,
+ float&,
+ float&,
+ float&);
+
+} // namespace lowptgsfeleid
+
+#endif // RecoEgamma_EgammaElectronProducers_LowPtGsfElectronFeatures_h
diff --git a/RecoEgamma/EgammaElectronProducers/plugins/BuildFile.xml b/RecoEgamma/EgammaElectronProducers/plugins/BuildFile.xml
index f73674f445d0e..66ffcb6442d43 100644
--- a/RecoEgamma/EgammaElectronProducers/plugins/BuildFile.xml
+++ b/RecoEgamma/EgammaElectronProducers/plugins/BuildFile.xml
@@ -11,6 +11,7 @@
+
diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc
index f4c65dde72c11..6390a6e3d9fc3 100644
--- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc
+++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.cc
@@ -1,84 +1,187 @@
+#include "CommonTools/BaseParticlePropagator/interface/BaseParticlePropagator.h"
#include "DataFormats/Common/interface/Handle.h"
+#include "DataFormats/Common/interface/Ptr.h"
#include "DataFormats/Common/interface/ValueMap.h"
-#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
+#include "DataFormats/Common/interface/View.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
-#include "RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.h"
+#include "FWCore/ParameterSet/interface/ParameterSet.h"
+#include "FWCore/Framework/interface/ESHandle.h"
+#include "FWCore/Framework/interface/global/EDProducer.h"
+#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
+#include "CommonTools/MVAUtils/interface/GBRForestTools.h"
+#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
+#include "DataFormats/PatCandidates/interface/Electron.h"
+#include "DataFormats/EgammaReco/interface/SuperCluster.h"
+#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
+#include "DataFormats/TrackReco/interface/Track.h"
+#include "DataFormats/Math/interface/LorentzVector.h"
+#include "FWCore/Framework/interface/Event.h"
+#include "MagneticField/Engine/interface/MagneticField.h"
+#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
+#include "RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h"
+#include "RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronIDHeavyObjectCache.h"
+#include
+#include
////////////////////////////////////////////////////////////////////////////////
//
-LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer( const edm::ParameterSet& conf,
- const lowptgsfeleid::HeavyObjectCache* ) :
- gsfElectrons_(consumes(conf.getParameter("electrons"))),
- rho_(consumes(conf.getParameter("rho"))),
- names_(conf.getParameter< std::vector >("ModelNames")),
- passThrough_(conf.getParameter("PassThrough")),
- minPtThreshold_(conf.getParameter("MinPtThreshold")),
- maxPtThreshold_(conf.getParameter("MaxPtThreshold"))
-{
- for ( const auto& name : names_ ) {
- produces< edm::ValueMap >(name);
- }
-}
+class LowPtGsfElectronIDProducer final : public edm::global::EDProducer<> {
+public:
+ explicit LowPtGsfElectronIDProducer(const edm::ParameterSet&);
+
+ void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
+
+ static void fillDescriptions(edm::ConfigurationDescriptions&);
+
+private:
+ double eval(const std::string& name, const reco::GsfElectronRef&, double rho, float unbiased, float field_z) const;
+
+ const edm::EDGetTokenT electrons_;
+ const edm::EDGetTokenT rho_;
+ const edm::EDGetTokenT > unbiased_;
+ const std::vector names_;
+ const bool passThrough_;
+ const double minPtThreshold_;
+ const double maxPtThreshold_;
+ std::vector > models_;
+ const std::vector thresholds_;
+ const std::string version_;
+};
////////////////////////////////////////////////////////////////////////////////
//
-LowPtGsfElectronIDProducer::~LowPtGsfElectronIDProducer() {}
+LowPtGsfElectronIDProducer::LowPtGsfElectronIDProducer(const edm::ParameterSet& conf)
+ : electrons_(consumes(conf.getParameter("electrons"))),
+ rho_(consumes(conf.getParameter("rho"))),
+ unbiased_(consumes >(conf.getParameter("unbiased"))),
+ names_(conf.getParameter >("ModelNames")),
+ passThrough_(conf.getParameter("PassThrough")),
+ minPtThreshold_(conf.getParameter("MinPtThreshold")),
+ maxPtThreshold_(conf.getParameter("MaxPtThreshold")),
+ thresholds_(conf.getParameter >("ModelThresholds")),
+ version_(conf.getParameter("Version")) {
+ for (auto& weights : conf.getParameter >("ModelWeights")) {
+ models_.push_back(createGBRForest(edm::FileInPath(weights)));
+ }
+ if (names_.size() != models_.size()) {
+ throw cms::Exception("Incorrect configuration")
+ << "'ModelNames' size (" << names_.size() << ") != 'ModelWeights' size (" << models_.size() << ").\n";
+ }
+ if (models_.size() != thresholds_.size()) {
+ throw cms::Exception("Incorrect configuration")
+ << "'ModelWeights' size (" << models_.size() << ") != 'ModelThresholds' size (" << thresholds_.size() << ").\n";
+ }
+ if (version_ != "V0" && version_ != "V1" && !version_.empty()) {
+ throw cms::Exception("Incorrect configuration") << "Unknown Version: " << version_ << "\n";
+ }
+ for (const auto& name : names_) {
+ produces >(name);
+ }
+}
////////////////////////////////////////////////////////////////////////////////
//
-void LowPtGsfElectronIDProducer::produce( edm::Event& event, const edm::EventSetup& setup ) {
+void LowPtGsfElectronIDProducer::produce(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const {
+ // Get z-component of B field
+ edm::ESHandle field;
+ setup.get().get(field);
+ math::XYZVector zfield(field->inTesla(GlobalPoint(0, 0, 0)));
// Pileup
edm::Handle rho;
- event.getByToken(rho_,rho);
- if ( !rho.isValid() ) { edm::LogError("Problem with rho handle"); }
+ event.getByToken(rho_, rho);
+ if (!rho.isValid()) {
+ std::ostringstream os;
+ os << "Problem accessing rho collection for low-pT electrons" << std::endl;
+ throw cms::Exception("InvalidHandle", os.str());
+ }
// Retrieve GsfElectrons from Event
- edm::Handle gsfElectrons;
- event.getByToken(gsfElectrons_,gsfElectrons);
- if ( !gsfElectrons.isValid() ) { edm::LogError("Problem with gsfElectrons handle"); }
+ edm::Handle electrons;
+ event.getByToken(electrons_, electrons);
+ if (!electrons.isValid()) {
+ std::ostringstream os;
+ os << "Problem accessing low-pT electrons collection" << std::endl;
+ throw cms::Exception("InvalidHandle", os.str());
+ }
+
+ // ElectronSeed unbiased BDT
+ edm::Handle > unbiasedH;
+ event.getByToken(unbiased_, unbiasedH);
// Iterate through Electrons, evaluate BDT, and store result
- std::vector< std::vector > output;
- for ( unsigned int iname = 0; iname < names_.size(); ++iname ) {
- output.push_back( std::vector(gsfElectrons->size(),-999.) );
+ std::vector > output;
+ for (unsigned int iname = 0; iname < names_.size(); ++iname) {
+ output.emplace_back(electrons->size(), -999.);
}
- for ( unsigned int iele = 0; iele < gsfElectrons->size(); iele++ ) {
- reco::GsfElectronRef ele(gsfElectrons,iele);
+ for (unsigned int iele = 0; iele < electrons->size(); iele++) {
+ reco::GsfElectronRef ele(electrons, iele);
+
+ if (ele->core().isNull()) {
+ continue;
+ }
+ const auto& gsf = ele->core()->gsfTrack(); // reco::GsfTrackRef
+ if (gsf.isNull()) {
+ continue;
+ }
+ float unbiased = (*unbiasedH)[gsf];
+
//if ( !passThrough_ && ( ele->pt() < minPtThreshold_ ) ) { continue; }
- for ( unsigned int iname = 0; iname < names_.size(); ++iname ) {
- output[iname][iele] = globalCache()->eval( names_[iname], ele, *rho );
+ for (unsigned int iname = 0; iname < names_.size(); ++iname) {
+ output[iname][iele] = eval(names_[iname], ele, *rho, unbiased, zfield.z());
}
}
-
+
// Create and put ValueMap in Event
- for ( unsigned int iname = 0; iname < names_.size(); ++iname ) {
- auto ptr = std::make_unique< edm::ValueMap >( edm::ValueMap() );
+ for (unsigned int iname = 0; iname < names_.size(); ++iname) {
+ auto ptr = std::make_unique >(edm::ValueMap());
edm::ValueMap::Filler filler(*ptr);
- filler.insert(gsfElectrons, output[iname].begin(), output[iname].end());
+ filler.insert(electrons, output[iname].begin(), output[iname].end());
filler.fill();
- reco::GsfElectronRef ele(gsfElectrons,0);
- event.put(std::move(ptr),names_[iname]);
+ event.put(std::move(ptr), names_[iname]);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//
+double LowPtGsfElectronIDProducer::eval(
+ const std::string& name, const reco::GsfElectronRef& ele, double rho, float unbiased, float field_z) const {
+ auto iter = std::find(names_.begin(), names_.end(), name);
+ if (iter != names_.end()) {
+ int index = std::distance(names_.begin(), iter);
+ std::vector inputs;
+ if (version_.empty()) { // Original XML model
+ lowptgsfeleid::Features features;
+ features.set(ele, rho);
+ inputs = features.get();
+ } else if (version_ == "V0") {
+ inputs = lowptgsfeleid::features_V0(*ele, rho, unbiased);
+ } else if (version_ == "V1") {
+ inputs = lowptgsfeleid::features_V1(*ele, rho, unbiased, field_z);
+ }
+ return models_.at(index)->GetResponse(inputs.data());
+ } else {
+ throw cms::Exception("Unknown model name") << "'Name given: '" << name << "'. Check against configuration file.\n";
}
-
+ return 0.;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
-void LowPtGsfElectronIDProducer::fillDescriptions( edm::ConfigurationDescriptions& descriptions )
-{
+void LowPtGsfElectronIDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
- desc.add("electrons",edm::InputTag("lowPtGsfElectrons"));
- desc.add("rho",edm::InputTag("fixedGridRhoFastjetAllTmp"));
- desc.add< std::vector >("ModelNames",std::vector());
- desc.add< std::vector >("ModelWeights",std::vector());
- desc.add< std::vector >("ModelThresholds",std::vector());
- desc.add("PassThrough",false);
- desc.add("MinPtThreshold",0.5);
- desc.add("MaxPtThreshold",15.);
- descriptions.add("defaultLowPtGsfElectronID",desc);
+ desc.add("electrons", edm::InputTag("lowPtGsfElectrons"));
+ desc.add("unbiased", edm::InputTag("lowPtGsfElectronSeedValueMaps:unbiased"));
+ desc.add("rho", edm::InputTag("fixedGridRhoFastjetAllTmp"));
+ desc.add >("ModelNames", std::vector());
+ desc.add >("ModelWeights", std::vector());
+ desc.add >("ModelThresholds", std::vector());
+ desc.add("PassThrough", false);
+ desc.add("MinPtThreshold", 0.5);
+ desc.add("MaxPtThreshold", 15.);
+ desc.add("Version", "");
+ descriptions.add("defaultLowPtGsfElectronID", desc);
}
//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.h b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.h
deleted file mode 100644
index 2589ce9d1a8e8..0000000000000
--- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronIDProducer.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef RecoEgamma_EgammaElectronProducers_LowPtGsfElectronIDProducer_h
-#define RecoEgamma_EgammaElectronProducers_LowPtGsfElectronIDProducer_h
-
-#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
-#include "FWCore/Framework/interface/ESHandle.h"
-#include "FWCore/Framework/interface/stream/EDProducer.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include "RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronIDHeavyObjectCache.h"
-#include
-#include
-
-class LowPtGsfElectronIDProducer final :
-public edm::stream::EDProducer< edm::GlobalCache > {
-
- public:
-
- explicit LowPtGsfElectronIDProducer( const edm::ParameterSet&,
- const lowptgsfeleid::HeavyObjectCache* );
-
- ~LowPtGsfElectronIDProducer() override;
-
- static std::unique_ptr
- initializeGlobalCache( const edm::ParameterSet& conf ) {
- return std::make_unique(lowptgsfeleid::HeavyObjectCache(conf));
- }
-
- static void globalEndJob( lowptgsfeleid::HeavyObjectCache const* ) {}
-
- void produce( edm::Event&, const edm::EventSetup& ) override;
-
- static void fillDescriptions( edm::ConfigurationDescriptions& );
-
- private:
-
- const edm::EDGetTokenT gsfElectrons_;
- const edm::EDGetTokenT rho_;
- const std::vector names_;
- const bool passThrough_;
- const double minPtThreshold_;
- const double maxPtThreshold_;
-
-};
-
-#endif // RecoEgamma_EgammaElectronProducers_LowPtGsfElectronIDProducer_h
-
diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.cc
index a38504e3e7e97..876b71a6a143b 100644
--- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.cc
+++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.cc
@@ -1,4 +1,5 @@
#include "DataFormats/Common/interface/Handle.h"
+#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaReco/interface/ElectronSeed.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
@@ -8,78 +9,146 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
-#include "RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.h"
+#include "DataFormats/Common/interface/ValueMap.h"
+#include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
+#include "DataFormats/ParticleFlowReco/interface/PreIdFwd.h"
+#include "FWCore/Framework/interface/ESHandle.h"
+#include "FWCore/Framework/interface/stream/EDProducer.h"
+#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
+#include "FWCore/Utilities/interface/transform.h"
+
+#include
+#include
+
+class LowPtGsfElectronSeedValueMapsProducer : public edm::stream::EDProducer<> {
+public:
+ explicit LowPtGsfElectronSeedValueMapsProducer(const edm::ParameterSet&);
+
+ void produce(edm::Event&, const edm::EventSetup&) override;
+
+ static void fillDescriptions(edm::ConfigurationDescriptions&);
+
+private:
+ edm::EDGetTokenT gsfTracks_;
+ edm::EDGetTokenT > preIdsValueMap_;
+ std::vector names_;
+ const bool rekey_;
+ edm::EDGetTokenT gsfElectrons_;
+ std::vector > > floatValueMaps_;
+};
////////////////////////////////////////////////////////////////////////////////
//
-LowPtGsfElectronSeedValueMapsProducer::LowPtGsfElectronSeedValueMapsProducer( const edm::ParameterSet& conf ) :
- gsfTracks_(consumes(conf.getParameter("gsfTracks"))),
- preIdsValueMap_(consumes< edm::ValueMap >(conf.getParameter("preIdsValueMap"))),
- names_(conf.getParameter< std::vector >("ModelNames"))
-{
- for ( const auto& name : names_ ) { produces< edm::ValueMap >(name); }
+LowPtGsfElectronSeedValueMapsProducer::LowPtGsfElectronSeedValueMapsProducer(const edm::ParameterSet& conf)
+ : gsfTracks_(),
+ preIdsValueMap_(),
+ names_(),
+ rekey_(conf.getParameter("rekey")),
+ gsfElectrons_(),
+ floatValueMaps_() {
+ if (rekey_) {
+ gsfElectrons_ = consumes(conf.getParameter("gsfElectrons"));
+ std::vector tags = conf.getParameter >("floatValueMaps");
+ for (const auto& tag : tags) {
+ floatValueMaps_ = edm::vector_transform(
+ tags, [this](edm::InputTag const& tag) { return consumes >(tag); });
+ names_.push_back(tag.instance());
+ produces >(tag.instance());
+ }
+ } else {
+ gsfTracks_ = consumes(conf.getParameter("gsfTracks"));
+ preIdsValueMap_ = consumes >(conf.getParameter("preIdsValueMap"));
+ names_ = conf.getParameter >("ModelNames");
+ for (const auto& name : names_) {
+ produces >(name);
+ }
+ }
}
////////////////////////////////////////////////////////////////////////////////
//
-LowPtGsfElectronSeedValueMapsProducer::~LowPtGsfElectronSeedValueMapsProducer() {}
+void LowPtGsfElectronSeedValueMapsProducer::produce(edm::Event& event, const edm::EventSetup&) {
+ if (rekey_ == false) {
+ // TRANSFORM VALUEMAP OF PREID OBJECTS KEYED BY KF TRACK ...
+ // .. INTO VALUEMAP OF FLOATS (BDT SCORE) KEYED BY GSF TRACK ...
-////////////////////////////////////////////////////////////////////////////////
-//
-void LowPtGsfElectronSeedValueMapsProducer::produce( edm::Event& event, const edm::EventSetup& setup ) {
-
- // Retrieve GsfTracks from Event
- edm::Handle gsfTracks;
- event.getByToken(gsfTracks_,gsfTracks);
- if ( !gsfTracks.isValid() ) { edm::LogError("Problem with gsfTracks handle"); }
-
- // Retrieve PreIds from Event
- edm::Handle< edm::ValueMap > preIdsValueMap;
- event.getByToken(preIdsValueMap_,preIdsValueMap);
- if ( !preIdsValueMap.isValid() ) { edm::LogError("Problem with preIdsValueMap handle"); }
-
- // Iterate through GsfTracks, extract BDT output, and store result in ValueMap for each model
- std::vector< std::vector > output;
- for ( unsigned int iname = 0; iname < names_.size(); ++iname ) {
- output.push_back( std::vector(gsfTracks->size(),-999.) );
- }
- for ( unsigned int igsf = 0; igsf < gsfTracks->size(); igsf++ ) {
- reco::GsfTrackRef gsf(gsfTracks,igsf);
- if ( gsf.isNonnull() &&
- gsf->extra().isNonnull() &&
- gsf->extra()->seedRef().isNonnull() ) {
- reco::ElectronSeedRef seed = gsf->extra()->seedRef().castTo();
- if ( seed.isNonnull() && seed->ctfTrack().isNonnull() ) {
- const reco::PreIdRef preid = (*preIdsValueMap)[seed->ctfTrack()];
- if ( preid.isNonnull() ) {
- for ( unsigned int iname = 0; iname < names_.size(); ++iname ) {
- output[iname][igsf] = preid->mva(iname);
- }
- }
+ // Retrieve GsfTracks from Event
+ auto gsfTracks = event.getHandle(gsfTracks_);
+
+ // Retrieve PreIds from Event
+ auto preIdsValueMap = event.getHandle(preIdsValueMap_);
+
+ // Iterate through GsfTracks, extract BDT output, and store result in ValueMap for each model
+ std::vector > output;
+ for (unsigned int iname = 0; iname < names_.size(); ++iname) {
+ output.push_back(std::vector(gsfTracks->size(), -999.));
+ }
+ auto const& gsfTracksV = *gsfTracks;
+ for (unsigned int igsf = 0; igsf < gsfTracksV.size(); igsf++) {
+ const reco::GsfTrack& gsf = gsfTracksV[igsf];
+ if (gsf.extra().isNonnull() && gsf.extra()->seedRef().isNonnull()) {
+ reco::ElectronSeedRef seed = gsf.extra()->seedRef().castTo();
+ if (seed.isNonnull() && seed->ctfTrack().isNonnull()) {
+ const reco::PreIdRef preid = (*preIdsValueMap)[seed->ctfTrack()];
+ if (preid.isNonnull()) {
+ for (unsigned int iname = 0; iname < names_.size(); ++iname) {
+ output[iname][igsf] = preid->mva(iname);
+ }
+ }
+ }
}
}
- }
-
- // Create and put ValueMap in Event
- for ( unsigned int iname = 0; iname < names_.size(); ++iname ) {
- auto ptr = std::make_unique< edm::ValueMap >( edm::ValueMap() );
- edm::ValueMap::Filler filler(*ptr);
- filler.insert(gsfTracks, output[iname].begin(), output[iname].end());
- filler.fill();
- event.put(std::move(ptr),names_[iname]);
- }
+ // Create and put ValueMap in Event
+ for (unsigned int iname = 0; iname < names_.size(); ++iname) {
+ auto ptr = std::make_unique >(edm::ValueMap());
+ edm::ValueMap::Filler filler(*ptr);
+ filler.insert(gsfTracks, output[iname].begin(), output[iname].end());
+ filler.fill();
+ event.put(std::move(ptr), names_[iname]);
+ }
+
+ } else {
+ // TRANSFORM VALUEMAP OF FLOATS (BDT SCORE) KEYED BY GSF TRACK ...
+ // .. INTO VALUEMAP OF FLOATS (BDT SCORE) KEYED BY GSF ELECTRON ...
+
+ // Retrieve GsfElectrons from Event
+ auto gsfElectrons = event.getHandle(gsfElectrons_);
+
+ // Retrieve float ValueMaps from Event
+ for (unsigned int idx = 0; idx < names_.size(); ++idx) {
+ // Extract ValueMap from Event
+ auto const& floatValueMap = event.get(floatValueMaps_[idx]);
+
+ // Store BDT scores in vector
+ std::vector output(gsfElectrons->size(), -99.);
+ auto const& gsfElectronsV = *gsfElectrons;
+ for (unsigned int iele = 0; iele < gsfElectronsV.size(); iele++) {
+ const reco::GsfElectron& ele = gsfElectronsV[iele];
+ reco::GsfTrackRef gsf = ele.gsfTrack();
+ output[iele] = floatValueMap[gsf];
+ }
+ // Create and put ValueMap in Event
+ auto ptr = std::make_unique >(edm::ValueMap());
+ edm::ValueMap::Filler filler(*ptr);
+ filler.insert(gsfElectrons, output.begin(), output.end());
+ filler.fill();
+ event.put(std::move(ptr), names_[idx]);
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
//
-void LowPtGsfElectronSeedValueMapsProducer::fillDescriptions( edm::ConfigurationDescriptions& descriptions )
-{
+void LowPtGsfElectronSeedValueMapsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
- desc.add("gsfTracks",edm::InputTag("lowPtGsfEleGsfTracks"));
- desc.add("preIdsValueMap",edm::InputTag("lowPtGsfElectronSeeds"));
- desc.add< std::vector >("ModelNames",std::vector());
- descriptions.add("defaultLowPtGsfElectronSeedValueMaps",desc);
+ desc.add("gsfTracks", edm::InputTag("lowPtGsfEleGsfTracks"));
+ desc.add("preIdsValueMap", edm::InputTag("lowPtGsfElectronSeeds"));
+ desc.add >("ModelNames", {"unbiased", "ptbiased"});
+ desc.add("rekey", false);
+ desc.add("gsfElectrons", edm::InputTag());
+ desc.add >("floatValueMaps", std::vector());
+ descriptions.add("lowPtGsfElectronSeedValueMaps", desc);
}
//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.h b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.h
deleted file mode 100644
index 28f70374e5510..0000000000000
--- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGsfElectronSeedValueMapsProducer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef RecoEgamma_EgammaElectronProducers_LowPtGsfElectronSeedValueMapsProducer_h
-#define RecoEgamma_EgammaElectronProducers_LowPtGsfElectronSeedValueMapsProducer_h
-
-#include "DataFormats/Common/interface/ValueMap.h"
-#include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
-#include "DataFormats/ParticleFlowReco/interface/PreIdFwd.h"
-#include "FWCore/Framework/interface/ESHandle.h"
-#include "FWCore/Framework/interface/stream/EDProducer.h"
-#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
-#include
-#include
-
-class LowPtGsfElectronSeedValueMapsProducer : public edm::stream::EDProducer<> {
-
- public:
-
- explicit LowPtGsfElectronSeedValueMapsProducer( const edm::ParameterSet& );
-
- ~LowPtGsfElectronSeedValueMapsProducer() override;
-
- void produce( edm::Event&, const edm::EventSetup& ) override;
-
- static void fillDescriptions( edm::ConfigurationDescriptions& );
-
- private:
-
- const edm::EDGetTokenT gsfTracks_;
- const edm::EDGetTokenT< edm::ValueMap > preIdsValueMap_;
- const std::vector names_;
-
-};
-
-#endif // RecoEgamma_EgammaElectronProducers_LowPtGsfElectronSeedValueMapsProducer_h
diff --git a/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronID_cff.py b/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronID_cff.py
index 09f1db56328ed..15cb46811b4eb 100644
--- a/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronID_cff.py
+++ b/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronID_cff.py
@@ -9,3 +9,12 @@
]),
ModelThresholds = cms.vdouble([-10.])
)
+
+from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
+run2_miniAOD_UL.toModify(
+ lowPtGsfElectronID,
+ rho = "fixedGridRhoFastjetAll",
+ ModelWeights = ["RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2020Sept15.root"],
+ ModelThresholds = [-99.],
+ Version = "V1",
+)
diff --git a/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeedValueMaps_cff.py b/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeedValueMaps_cff.py
index 014cf4c57aa81..4ee7a8a749796 100644
--- a/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeedValueMaps_cff.py
+++ b/RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSeedValueMaps_cff.py
@@ -1,7 +1,11 @@
import FWCore.ParameterSet.Config as cms
+# Low pT Electron value maps
+from RecoEgamma.EgammaElectronProducers.lowPtGsfElectronSeedValueMaps_cfi import lowPtGsfElectronSeedValueMaps
-from RecoEgamma.EgammaElectronProducers.defaultLowPtGsfElectronSeedValueMaps_cfi import defaultLowPtGsfElectronSeedValueMaps
-
-lowPtGsfElectronSeedValueMaps = defaultLowPtGsfElectronSeedValueMaps.clone(
- ModelNames = cms.vstring(['unbiased','ptbiased'])
- )
+# Low pT Electron value maps, rekeyed by reco::GsfElectron
+rekeyLowPtGsfElectronSeedValueMaps = lowPtGsfElectronSeedValueMaps.clone(
+ rekey=True,
+ gsfElectrons="lowPtGsfElectrons",
+ floatValueMaps=["lowPtGsfElectronSeedValueMaps:unbiased",
+ "lowPtGsfElectronSeedValueMaps:ptbiased"],
+)
diff --git a/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc b/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc
new file mode 100644
index 0000000000000..5ab6abae8129a
--- /dev/null
+++ b/RecoEgamma/EgammaElectronProducers/src/LowPtGsfElectronFeatures.cc
@@ -0,0 +1,556 @@
+#include "RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h"
+#include "CommonTools/BaseParticlePropagator/interface/BaseParticlePropagator.h"
+#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
+#include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
+#include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
+#include "DataFormats/TrackReco/interface/Track.h"
+#include "DataFormats/TrackReco/interface/TrackFwd.h"
+#include "TVector3.h"
+#include
+
+namespace lowptgsfeleid {
+
+ std::vector