Skip to content
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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h
@@ -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
9 changes: 9 additions & 0 deletions HLTrigger/JetMET/plugins/SealModule.cc
Expand Up @@ -58,6 +58,9 @@
#include "HLTrigger/JetMET/interface/HLTJetL1MatchProducer.h"
#include "HLTrigger/JetMET/src/HLTJetL1MatchProducer.cc"
//
#include "HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h"
#include "HLTrigger/JetMET/src/HLTJetL1TMatchProducer.cc"
//
#include "HLTrigger/JetMET/interface/HLTMonoJetFilter.h"
#include "HLTrigger/JetMET/src/HLTMonoJetFilter.cc"
//
Expand Down Expand Up @@ -118,6 +121,9 @@ typedef HLTJetSortedVBFFilter< PFJet> HLTPFJetSortedVBFFilter;
typedef HLTJetL1MatchProducer<CaloJet> HLTCaloJetL1MatchProducer;
typedef HLTJetL1MatchProducer< PFJet> HLTPFJetL1MatchProducer;

typedef HLTJetL1TMatchProducer<CaloJet> HLTCaloJetL1TMatchProducer;
typedef HLTJetL1TMatchProducer< PFJet> HLTPFJetL1TMatchProducer;

typedef HLTMonoJetFilter<CaloJet> HLTMonoCaloJetFilter;
typedef HLTMonoJetFilter< PFJet> HLTMonoPFJetFilter;

Expand Down Expand Up @@ -228,6 +234,9 @@ DEFINE_FWK_MODULE(HLTPFJetEtaTopologyFilter);
DEFINE_FWK_MODULE(HLTCaloJetL1MatchProducer);
DEFINE_FWK_MODULE(HLTPFJetL1MatchProducer);

DEFINE_FWK_MODULE(HLTCaloJetL1TMatchProducer);
DEFINE_FWK_MODULE(HLTPFJetL1TMatchProducer);

DEFINE_FWK_MODULE(HLTCaloJetVBFFilter);
DEFINE_FWK_MODULE(HLTPFJetVBFFilter);

Expand Down
83 changes: 83 additions & 0 deletions HLTrigger/JetMET/src/HLTJetL1TMatchProducer.cc
@@ -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)
Copy link
Contributor

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

{
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);

}