-
Notifications
You must be signed in to change notification settings - Fork 4.6k
LowPtElectrons: final energy regression and ID (back port of 32391) #33589
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #include "CommonTools/CandAlgos/interface/ModifyObjectValueBase.h" | ||
| #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" | ||
| #include "FWCore/Framework/interface/stream/EDProducer.h" | ||
| #include "FWCore/Framework/interface/Event.h" | ||
| #include "FWCore/Framework/interface/EventSetup.h" | ||
| #include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
| #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
| #include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
| #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
|
|
||
| class LowPtGsfElectronFinalizer : public edm::stream::EDProducer<> { | ||
| public: | ||
| explicit LowPtGsfElectronFinalizer(const edm::ParameterSet&); | ||
|
|
||
| void produce(edm::Event&, const edm::EventSetup&) override; | ||
|
|
||
| static void fillDescriptions(edm::ConfigurationDescriptions&); | ||
|
|
||
| private: | ||
| const edm::EDGetTokenT<reco::GsfElectronCollection> previousGsfElectrons_; | ||
| std::unique_ptr<ModifyObjectValueBase> regression_; | ||
|
|
||
| const edm::EDPutTokenT<reco::GsfElectronCollection> putToken_; | ||
| }; | ||
|
|
||
| using edm::InputTag; | ||
| using reco::GsfElectronCollection; | ||
|
|
||
| LowPtGsfElectronFinalizer::LowPtGsfElectronFinalizer(const edm::ParameterSet& cfg) | ||
| : previousGsfElectrons_{consumes<GsfElectronCollection>(cfg.getParameter<InputTag>("previousGsfElectronsTag"))}, | ||
| putToken_{produces<GsfElectronCollection>()} { | ||
| auto const& iconf = cfg.getParameterSet("regressionConfig"); | ||
| auto const& mname = iconf.getParameter<std::string>("modifierName"); | ||
| auto cc = consumesCollector(); | ||
| regression_.reset(ModifyObjectValueFactory::get()->create(mname, iconf, cc)); | ||
| } | ||
|
|
||
| void LowPtGsfElectronFinalizer::produce(edm::Event& event, const edm::EventSetup& setup) { | ||
| // Setup regression for event | ||
| regression_->setEvent(event); | ||
| regression_->setEventContent(setup); | ||
|
|
||
| // Create new modified electron collection | ||
| reco::GsfElectronCollection outputElectrons; | ||
| for (auto const& electron : event.get(previousGsfElectrons_)) { | ||
| outputElectrons.emplace_back(electron); | ||
| auto& newElectron = outputElectrons.back(); | ||
| regression_->modifyObject(newElectron); | ||
| } | ||
|
|
||
| // Emplace modified electrons to event | ||
| event.emplace(putToken_, std::move(outputElectrons)); | ||
| } | ||
|
|
||
| void LowPtGsfElectronFinalizer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
| edm::ParameterSetDescription desc; | ||
| desc.add<edm::InputTag>("previousGsfElectronsTag", {}); | ||
| edm::ParameterSetDescription psd; | ||
| psd.setUnknown(); | ||
| desc.add<edm::ParameterSetDescription>("regressionConfig", psd); | ||
| descriptions.addWithDefaultLabel(desc); | ||
| } | ||
|
|
||
| #include "FWCore/Framework/interface/MakerMacros.h" | ||
| DEFINE_FWK_MODULE(LowPtGsfElectronFinalizer); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,10 +11,20 @@ | |
| ) | ||
|
|
||
| from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL | ||
| run2_miniAOD_UL.toModify( | ||
| from Configuration.Eras.Modifier_run2_miniAOD_devel_cff import run2_miniAOD_devel | ||
| from Configuration.Eras.Modifier_bParking_cff import bParking | ||
| ( run2_miniAOD_UL | bParking ).toModify( | ||
| lowPtGsfElectronID, | ||
| rho = "fixedGridRhoFastjetAll", | ||
| ModelWeights = ["RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2020Sept15.root"], | ||
| ModelThresholds = [-99.], | ||
| Version = "V1", | ||
| ) | ||
| run2_miniAOD_devel.toModify( | ||
| lowPtGsfElectronID, | ||
| ModelWeights = ["RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2020Nov28.root"], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't devel use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
let me rephrase my earlier question: why can't
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ) | ||
| (bParking & run2_miniAOD_UL).toModify( | ||
| lowPtGsfElectronID, | ||
| ModelWeights = ["RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2021May17.root"], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||
| import FWCore.ParameterSet.Config as cms | ||||
| from RecoEgamma.EgammaElectronProducers.lowPtGsfElectronsPreRegression_cfi import lowPtGsfElectronsPreRegression | ||||
|
|
||||
| lowPtGsfElectrons = lowPtGsfElectronsPreRegression.clone() | ||||
|
|
||||
| ################################################################################ | ||||
| # LowPtGsfElectronProducer above is run by default in RECO | ||||
| # LowPtGsfElectronFinalizer below is scheduled for run2_miniAOD_UL | ||||
|
|
||||
| from RecoEgamma.EgammaTools.regressionModifier_cfi import regressionModifier106XUL | ||||
| _lowPtRegressionModifier = regressionModifier106XUL.clone( | ||||
| modifierName = 'EGRegressionModifierV3', | ||||
| rhoTag = 'fixedGridRhoFastjetAll', | ||||
| eleRegs = dict( | ||||
| ecalOnlyMean = dict( | ||||
| lowEtHighEtBoundary = 20., | ||||
| ebLowEtForestName = "lowPtElectron_eb_ecalOnly_05To50_mean", | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that the master version has a colon in all names
was there a change in name formatting or is this a not necessary change?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to @jainshilpi no colons are needed. I will double check the implementation in master (with the colons), but I've seen errors (in >11_3_X) without them ... As far as I'm aware, the tests in 10_6_X (with no colons) appear to work. |
||||
| ebHighEtForestName = "lowPtElectron_eb_ecalOnly_05To50_mean", | ||||
| eeLowEtForestName = "lowPtElectron_ee_ecalOnly_05To50_mean", | ||||
| eeHighEtForestName = "lowPtElectron_ee_ecalOnly_05To50_mean", | ||||
| ), | ||||
| ecalOnlySigma = dict( | ||||
| lowEtHighEtBoundary = 20., | ||||
| ebLowEtForestName = "lowPtElectron_eb_ecalOnly_05To50_sigma", | ||||
| ebHighEtForestName = "lowPtElectron_eb_ecalOnly_05To50_sigma", | ||||
| eeLowEtForestName = "lowPtElectron_ee_ecalOnly_05To50_sigma", | ||||
| eeHighEtForestName = "lowPtElectron_ee_ecalOnly_05To50_sigma", | ||||
| ), | ||||
| epComb = dict( | ||||
| ecalTrkRegressionConfig = dict( | ||||
| lowEtHighEtBoundary = 20., | ||||
| ebLowEtForestName = "lowPtElectron_eb_ecalTrk_05To50_mean", | ||||
| ebHighEtForestName = "lowPtElectron_eb_ecalTrk_05To50_mean", | ||||
| eeLowEtForestName = "lowPtElectron_ee_ecalTrk_05To50_mean", | ||||
| eeHighEtForestName = "lowPtElectron_ee_ecalTrk_05To50_mean", | ||||
| ), | ||||
| ecalTrkRegressionUncertConfig = dict( | ||||
| lowEtHighEtBoundary = 20., | ||||
| ebLowEtForestName = "lowPtElectron_eb_ecalTrk_05To50_sigma", | ||||
| ebHighEtForestName = "lowPtElectron_eb_ecalTrk_05To50_sigma", | ||||
| eeLowEtForestName = "lowPtElectron_ee_ecalTrk_05To50_sigma", | ||||
| eeHighEtForestName = "lowPtElectron_ee_ecalTrk_05To50_sigma", | ||||
| ), | ||||
| ) | ||||
| ), | ||||
| ) | ||||
|
|
||||
| from RecoEgamma.EgammaElectronProducers.lowPtGsfElectronFinalizer_cfi import lowPtGsfElectronFinalizer | ||||
| _lowPtGsfElectrons = lowPtGsfElectronFinalizer.clone( | ||||
| previousGsfElectronsTag = "lowPtGsfElectrons::@skipCurrentProcess", | ||||
| regressionConfig = _lowPtRegressionModifier, | ||||
| ) | ||||
|
|
||||
| from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL | ||||
| run2_miniAOD_UL.toReplaceWith(lowPtGsfElectrons,_lowPtGsfElectrons) | ||||
Uh oh!
There was an error while loading. Please reload this page.