-
Notifications
You must be signed in to change notification settings - Fork 4.6k
L1 phase 2: produce CaloJet/Tau (corrected version) #33750
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2b5f12a
Added Phase2Jet code to L1Trigger and minimum necessary files to test…
5e7f14c
Modified test_L1CaloJets_cfg.py to run Phase2 Jet code without errors…
cf43572
Made associated_l1EGs const in CaloJet.h to be consistent with experi…
6f12b7f
Merged l1t-Victor_Nov_120X from repository cecilecaillol with cms-mer…
954ad09
scram code format
220d8eb
Merged l1t-Victor_Nov_120X from repository cecilecaillol with cms-mer…
18eed77
minor fix, add empty line
f6d4c52
Merged l1t-Victor_Nov_120X from repository cecilecaillol with cms-mer…
cf9d35f
fix calo tower input collection
29bdf6f
fixing ESHandle
9f7cbdc
code format
5f7883f
Merged l1t-Victor_Nov_120X from repository cecilecaillol with cms-mer…
41e6e2e
switch from printf to LogDebug
ec50927
Phat's comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| // -*- C++ -*- | ||
| // | ||
| // Package: L1CaloTrigger | ||
| // Class: L1CaloJetHTTProducer | ||
| // | ||
| /**\class L1CaloJetHTTProducer L1CaloJetHTTProducer.cc | ||
|
|
||
| Description: | ||
| Use the L1CaloJetProducer collections to calculate | ||
| HTT energy sum for CaloJets | ||
|
|
||
| Implementation: | ||
| [Notes on implementation] | ||
| */ | ||
| // | ||
| // Original Author: Tyler Ruggles | ||
| // Created: Fri Mar 22 2019 | ||
| // $Id$ | ||
| // | ||
| // | ||
|
|
||
| #include "FWCore/Framework/interface/Frameworkfwd.h" | ||
| #include "FWCore/Framework/interface/EDProducer.h" | ||
| #include "FWCore/Framework/interface/ESHandle.h" | ||
| #include "FWCore/ServiceRegistry/interface/Service.h" | ||
| #include "FWCore/Framework/interface/Event.h" | ||
| #include "FWCore/Framework/interface/MakerMacros.h" | ||
| #include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
|
||
| #include <iostream> | ||
|
|
||
| // Run2/PhaseI output formats | ||
| #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" | ||
| #include "DataFormats/L1Trigger/interface/Jet.h" | ||
| // GenJets if needed | ||
| #include "DataFormats/JetReco/interface/GenJet.h" | ||
| #include "DataFormats/JetReco/interface/GenJetCollection.h" | ||
|
|
||
| class L1CaloJetHTTProducer : public edm::EDProducer { | ||
| public: | ||
| explicit L1CaloJetHTTProducer(const edm::ParameterSet&); | ||
|
|
||
| private: | ||
| void produce(edm::Event&, const edm::EventSetup&) override; | ||
|
|
||
| double EtaMax; | ||
| double PtMin; | ||
|
|
||
| edm::EDGetTokenT<BXVector<l1t::Jet>> bxvCaloJetsToken_; | ||
| edm::Handle<BXVector<l1t::Jet>> bxvCaloJetsHandle; | ||
|
|
||
| // Gen jet collections are only loaded and used if requested | ||
| // (use_gen_jets == true) | ||
| edm::EDGetTokenT<std::vector<reco::GenJet>> genJetsToken_; | ||
| edm::Handle<std::vector<reco::GenJet>> genJetsHandle; | ||
|
|
||
| bool debug; | ||
|
|
||
| bool use_gen_jets; | ||
| }; | ||
|
|
||
| L1CaloJetHTTProducer::L1CaloJetHTTProducer(const edm::ParameterSet& iConfig) | ||
| : EtaMax(iConfig.getParameter<double>("EtaMax")), | ||
| PtMin(iConfig.getParameter<double>("PtMin")), | ||
| bxvCaloJetsToken_(consumes<BXVector<l1t::Jet>>(iConfig.getParameter<edm::InputTag>("BXVCaloJetsInputTag"))), | ||
| genJetsToken_(consumes<std::vector<reco::GenJet>>(iConfig.getParameter<edm::InputTag>("genJets"))), | ||
| debug(iConfig.getParameter<bool>("debug")), | ||
| use_gen_jets(iConfig.getParameter<bool>("use_gen_jets")) | ||
|
|
||
| { | ||
| produces<float>("CaloJetHTT"); | ||
| } | ||
|
|
||
| void L1CaloJetHTTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { | ||
| // Output collections | ||
| std::unique_ptr<float> CaloJetHTT(new float); | ||
|
|
||
| *CaloJetHTT = 0.; | ||
|
|
||
| // CaloJet HTT for L1 collections | ||
| if (!use_gen_jets) { | ||
| iEvent.getByToken(bxvCaloJetsToken_, bxvCaloJetsHandle); | ||
|
|
||
| if (bxvCaloJetsHandle.isValid()) { | ||
| for (const auto& caloJet : *bxvCaloJetsHandle.product()) { | ||
| if (caloJet.pt() < PtMin) | ||
| continue; | ||
| if (fabs(caloJet.eta()) > EtaMax) | ||
| continue; | ||
| *CaloJetHTT += float(caloJet.pt()); | ||
| } | ||
| } | ||
|
|
||
| if (debug) { | ||
| LogDebug("L1CaloJetHTTProducer") << " BXV L1CaloJetCollection JetHTT = " << *CaloJetHTT << " for PtMin " << PtMin | ||
| << " and EtaMax " << EtaMax << "\n"; | ||
| } | ||
| } | ||
|
|
||
| // CaloJet HTT for gen jets | ||
| if (use_gen_jets) { | ||
| iEvent.getByToken(genJetsToken_, genJetsHandle); | ||
|
|
||
| if (genJetsHandle.isValid()) { | ||
| for (const auto& genJet : *genJetsHandle.product()) { | ||
| if (genJet.pt() < PtMin) | ||
| continue; | ||
| if (fabs(genJet.eta()) > EtaMax) | ||
| continue; | ||
| *CaloJetHTT += float(genJet.pt()); | ||
| } | ||
| } | ||
|
|
||
| if (debug) { | ||
| LogDebug("L1CaloJetHTTProducer") << " Gen Jets HTT = " << *CaloJetHTT << " for PtMin " << PtMin << " and EtaMax " | ||
| << EtaMax << "\n"; | ||
| } | ||
| } | ||
|
|
||
| iEvent.put(std::move(CaloJetHTT), "CaloJetHTT"); | ||
| } | ||
|
|
||
| DEFINE_FWK_MODULE(L1CaloJetHTTProducer); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly that, if genJet collection is not available but it is set to use, this module still RUN (no crash expected)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume so, but I have not tested with files where no genJet collection is available but with use_gen_jets set to True.