-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Sub-event aware genJet and parton matching for HI miniAOD #31698
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 8 commits
9bb1b99
fb1c496
b270197
afa1434
8ac4539
0262462
8859bd0
f189a56
5db41b8
fdbde17
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,4 @@ | ||
| import FWCore.ParameterSet.Config as cms | ||
|
|
||
| genJetSubEvent = cms.Modifier() | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #include <memory> | ||
| #include <vector> | ||
|
|
||
| #include "FWCore/Framework/interface/Frameworkfwd.h" | ||
| #include "FWCore/Framework/interface/global/EDProducer.h" | ||
|
|
||
| #include "FWCore/Framework/interface/Event.h" | ||
| #include "FWCore/Framework/interface/MakerMacros.h" | ||
|
|
||
| #include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
| #include "FWCore/Utilities/interface/InputTag.h" | ||
|
|
||
| #include "DataFormats/Common/interface/View.h" | ||
| #include "DataFormats/JetReco/interface/GenJetCollection.h" | ||
| #include "DataFormats/HepMCCandidate/interface/GenParticle.h" | ||
|
|
||
| class HiSignalGenJetProducer : public edm::global::EDProducer<> { | ||
| public: | ||
| explicit HiSignalGenJetProducer(const edm::ParameterSet&); | ||
| ~HiSignalGenJetProducer() override = default; | ||
|
|
||
| static void fillDescriptions(edm::ConfigurationDescriptions&); | ||
|
|
||
| private: | ||
| void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; | ||
|
|
||
| edm::EDGetTokenT<edm::View<reco::GenJet> > jetSrc_; | ||
| }; | ||
|
|
||
| HiSignalGenJetProducer::HiSignalGenJetProducer(const edm::ParameterSet& iConfig) | ||
| : jetSrc_(consumes<edm::View<reco::GenJet> >(iConfig.getParameter<edm::InputTag>("src"))) { | ||
| std::string alias = (iConfig.getParameter<edm::InputTag>("src")).label(); | ||
| produces<reco::GenJetCollection>().setBranchAlias(alias); | ||
| } | ||
|
|
||
| void HiSignalGenJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { | ||
| auto jets = std::make_unique<reco::GenJetCollection>(); | ||
|
|
||
| edm::Handle<edm::View<reco::GenJet> > genjets; | ||
| iEvent.getByToken(jetSrc_, genjets); | ||
|
|
||
| for (const reco::GenJet& jet1 : *genjets) { | ||
| const reco::GenParticle* gencon = jet1.getGenConstituent(0); | ||
|
|
||
| if (gencon == nullptr) | ||
| throw cms::Exception("GenConstituent", "GenJet is missing its constituents"); | ||
| else if (gencon->collisionId() == 0) { | ||
| jets->push_back(jet1); | ||
| } | ||
| } | ||
|
|
||
| iEvent.put(std::move(jets)); | ||
| } | ||
|
|
||
| void HiSignalGenJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
| edm::ParameterSetDescription desc; | ||
| desc.setComment("Selects genJets from collision id = 0"); | ||
| desc.add<edm::InputTag>("src", edm::InputTag("akHiGenJets")); | ||
| descriptions.add("HiSignalGenJetProducer", desc); | ||
mandrenguyen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| DEFINE_FWK_MODULE(HiSignalGenJetProducer); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #include <memory> | ||
| #include <vector> | ||
|
|
||
| #include "FWCore/Framework/interface/Frameworkfwd.h" | ||
| #include "FWCore/Framework/interface/global/EDProducer.h" | ||
|
|
||
| #include "FWCore/Framework/interface/Event.h" | ||
| #include "FWCore/Framework/interface/MakerMacros.h" | ||
|
|
||
| #include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
| #include "FWCore/Utilities/interface/InputTag.h" | ||
|
|
||
| #include "DataFormats/Common/interface/View.h" | ||
| #include "DataFormats/JetReco/interface/GenJetCollection.h" | ||
| #include "DataFormats/HepMCCandidate/interface/GenParticle.h" | ||
| #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" | ||
|
|
||
| class HiSignalParticleProducer : public edm::global::EDProducer<> { | ||
| public: | ||
| explicit HiSignalParticleProducer(const edm::ParameterSet&); | ||
| ~HiSignalParticleProducer() override = default; | ||
|
|
||
| static void fillDescriptions(edm::ConfigurationDescriptions&); | ||
|
|
||
| private: | ||
| void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; | ||
|
|
||
| edm::EDGetTokenT<edm::View<reco::GenParticle> > genParticleSrc_; | ||
| }; | ||
|
|
||
| HiSignalParticleProducer::HiSignalParticleProducer(const edm::ParameterSet& iConfig) | ||
| : genParticleSrc_(consumes<edm::View<reco::GenParticle> >(iConfig.getParameter<edm::InputTag>("src"))) { | ||
| std::string alias = (iConfig.getParameter<edm::InputTag>("src")).label(); | ||
| produces<reco::GenParticleCollection>().setBranchAlias(alias); | ||
| } | ||
|
|
||
| void HiSignalParticleProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { | ||
| auto signalGenParticles = std::make_unique<reco::GenParticleCollection>(); | ||
|
|
||
| edm::Handle<edm::View<reco::GenParticle> > genParticles; | ||
| iEvent.getByToken(genParticleSrc_, genParticles); | ||
|
|
||
| for (const reco::GenParticle& genParticle : *genParticles) { | ||
| if (genParticle.collisionId() == 0) { | ||
| signalGenParticles->push_back(genParticle); | ||
| } | ||
| } | ||
|
|
||
| iEvent.put(std::move(signalGenParticles)); | ||
| } | ||
|
|
||
| void HiSignalParticleProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
| edm::ParameterSetDescription desc; | ||
| desc.setComment("Selects genParticles from collision id = 0"); | ||
| desc.add<edm::InputTag>("src", edm::InputTag("genParticles")); | ||
| descriptions.add("HiSignalParticleProducer", desc); | ||
mandrenguyen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| DEFINE_FWK_MODULE(HiSignalParticleProducer); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import FWCore.ParameterSet.Config as cms | ||
|
|
||
|
|
||
| hiSignalGenJets = cms.EDProducer('HiSignalGenJetProducer', | ||
mandrenguyen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| src = cms.InputTag('ak4HiGenJets') | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import FWCore.ParameterSet.Config as cms | ||
|
|
||
|
|
||
| hiSignalGenParticles = cms.EDProducer('HiSignalParticleProducer', | ||
mandrenguyen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| src = cms.InputTag('genParticles') | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,6 @@ | |
| #include "FWCore/Framework/interface/MakerMacros.h" | ||
| #include "RecoJets/JetProducers/plugins/SubEventGenJetProducer.h" | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "FWCore/Utilities/interface/Exception.h" | ||
| #include "FWCore/Utilities/interface/isFinite.h" | ||
| #include "RecoJets/JetProducers/interface/JetSpecific.h" | ||
|
|
@@ -36,9 +34,8 @@ namespace { | |
| } // namespace | ||
|
|
||
| SubEventGenJetProducer::SubEventGenJetProducer(edm::ParameterSet const& conf) : VirtualJetProducer(conf) { | ||
| // mapSrc_ = conf.getParameter<edm::InputTag>( "srcMap"); | ||
| ignoreHydro_ = conf.getUntrackedParameter<bool>("ignoreHydro", true); | ||
| produces<reco::BasicJetCollection>(); | ||
|
|
||
|
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. What is this going to
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. The code is producing a collection of type |
||
| // the subjet collections are set through the config file in the "jetCollInstanceName" field. | ||
|
|
||
| input_cand_token_ = consumes<reco::CandidateView>(src_); | ||
|
|
@@ -104,8 +101,7 @@ void SubEventGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& | |
|
|
||
| //////////////// | ||
|
|
||
| auto jets = std::make_unique<std::vector<GenJet>>(); | ||
| subJets_ = jets.get(); | ||
| jets_ = std::make_unique<std::vector<GenJet>>(); | ||
|
|
||
| LogDebug("VirtualJetProducer") << "Inputted towers\n"; | ||
|
|
||
|
|
@@ -123,7 +119,7 @@ void SubEventGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& | |
| //Finalize | ||
| LogDebug("SubEventJetProducer") << "Wrote jets\n"; | ||
|
|
||
| iEvent.put(std::move(jets)); | ||
| iEvent.put(std::move(jets_)); | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -156,7 +152,7 @@ void SubEventGenJetProducer::runAlgorithm(edm::Event& iEvent, edm::EventSetup co | |
| jet.setJetArea(jetArea); | ||
| jet.setPileup(pu); | ||
|
|
||
| subJets_->push_back(jet); | ||
| jets_->push_back(jet); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.