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
add HLTJetL1TMatchProducer as simplified stage2L1-version - backport of #13468 #13469
Merged
cmsbuild
merged 3 commits into
cms-sw:CMSSW_8_0_X
from
kirschen:CMSSW_8_0_X_AddHLTJetL1TMatchProducer_ForStage2L1
Mar 1, 2016
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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,37 @@ | ||
#ifndef HLTJetL1TMatchProducer_h | ||
#define HLTJetL1TMatchProducer_h | ||
|
||
#include <string> | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
|
||
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" | ||
#include "DataFormats/L1Trigger/interface/L1JetParticle.h" | ||
#include "DataFormats/L1Trigger/interface/Jet.h" | ||
#include "DataFormats/JetReco/interface/CaloJet.h" | ||
#include "DataFormats/JetReco/interface/CaloJetCollection.h" | ||
#include "DataFormats/JetReco/interface/PFJet.h" | ||
#include "DataFormats/JetReco/interface/PFJetCollection.h" | ||
#include "DataFormats/JetReco/interface/TrackJetCollection.h" | ||
#include "DataFormats/JetReco/interface/BasicJetCollection.h" | ||
|
||
template<typename T> | ||
class HLTJetL1TMatchProducer : public edm::stream::EDProducer<> { | ||
public: | ||
explicit HLTJetL1TMatchProducer(const edm::ParameterSet&); | ||
~HLTJetL1TMatchProducer(); | ||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); | ||
virtual void beginJob() ; | ||
virtual void produce(edm::Event &, const edm::EventSetup&); | ||
private: | ||
edm::EDGetTokenT<std::vector<T>> m_theJetToken; | ||
edm::EDGetTokenT<l1t::JetBxCollection> m_theL1JetToken; | ||
edm::InputTag jetsInput_; | ||
edm::InputTag L1Jets_; | ||
// std::string jetType_; | ||
double DeltaR_; // DeltaR(HLT,L1) | ||
}; | ||
|
||
#endif |
This file contains 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
This file contains 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,83 @@ | ||
#include <string> | ||
|
||
#include "HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "DataFormats/Math/interface/deltaPhi.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" | ||
|
||
template<typename T> | ||
HLTJetL1TMatchProducer<T>::HLTJetL1TMatchProducer(const edm::ParameterSet& iConfig) | ||
{ | ||
jetsInput_ = iConfig.template getParameter<edm::InputTag>("jetsInput"); | ||
L1Jets_ = iConfig.template getParameter<edm::InputTag>("L1Jets"); | ||
DeltaR_ = iConfig.template getParameter<double>("DeltaR"); | ||
|
||
typedef std::vector<T> TCollection; | ||
m_theJetToken = consumes<TCollection>(jetsInput_); | ||
m_theL1JetToken = consumes<l1t::JetBxCollection>(L1Jets_); | ||
produces<TCollection> (); | ||
|
||
} | ||
|
||
template<typename T> | ||
void HLTJetL1TMatchProducer<T>::beginJob() | ||
{ | ||
|
||
} | ||
|
||
template<typename T> | ||
HLTJetL1TMatchProducer<T>::~HLTJetL1TMatchProducer() | ||
{ | ||
|
||
} | ||
|
||
template<typename T> | ||
void HLTJetL1TMatchProducer<T>::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("jetsInput",edm::InputTag("hltAntiKT5PFJets")); | ||
desc.add<edm::InputTag>("L1Jets",edm::InputTag("hltCaloStage2Digis")); | ||
desc.add<double>("DeltaR",0.5); | ||
descriptions.add(defaultModuleLabel<HLTJetL1TMatchProducer<T>>(), desc); | ||
} | ||
|
||
template<typename T> | ||
void HLTJetL1TMatchProducer<T>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) | ||
{ | ||
|
||
typedef std::vector<T> TCollection; | ||
|
||
edm::Handle<TCollection> jets; | ||
iEvent.getByToken(m_theJetToken, jets); | ||
|
||
std::auto_ptr<TCollection> result (new TCollection); | ||
|
||
|
||
edm::Handle<l1t::JetBxCollection> l1Jets; | ||
iEvent.getByToken(m_theL1JetToken,l1Jets); | ||
|
||
typename TCollection::const_iterator jet_iter; | ||
for (jet_iter = jets->begin(); jet_iter != jets->end(); ++jet_iter) { | ||
|
||
bool isMatched=false; | ||
|
||
for (unsigned int jetc=0;jetc<l1Jets->size();++jetc) | ||
{ | ||
const double deltaeta=jet_iter->eta()-(*l1Jets)[jetc].eta(); | ||
const double deltaphi=deltaPhi(jet_iter->phi(),(*l1Jets)[jetc].phi()); | ||
if (sqrt(deltaeta*deltaeta+deltaphi*deltaphi) < DeltaR_) isMatched=true; | ||
} | ||
|
||
|
||
if (isMatched==true) result->push_back(*jet_iter); | ||
|
||
} // jet_iter | ||
|
||
iEvent.put( result); | ||
|
||
} | ||
|
||
|
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.
You have to select the l1t objects on BX=0 (or make BX configurable and code that part), see the example code in cms-l1t-offline#156