-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
adding a PFJets-Tau overlap removal module for HLT #18997
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
81e2091
adding the latest PFJets/Tau cross cleaning module
albertdow 73364f2
use deltaR2 and consistent member data convention
albertdow 610e68a
working on a new solution for PFJets Tau overlap
albertdow a60bc8e
changed logic within overlap removal and removed using namespace
albertdow 8a15e70
adding missed std:: for unique_ptr
albertdow 6b772d8
minor changes (parameters,deltaR2,guard string) in both header and so…
albertdow 9a4e110
changed deltaR2 function
albertdow 33af49b
moving Rsquared to constructor and removing unnecessary includes
albertdow 74b124e
removing initialisation of mindR_ and using only matchingR2_ instead
albertdow 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
34 changes: 34 additions & 0 deletions
34
RecoTauTag/HLTProducers/interface/PFJetsTauOverlapRemoval.h
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,34 @@ | ||
#ifndef RecoTauTag_HLTProducers_PFJetsTauOverlapRemoval_H | ||
#define RecoTauTag_HLTProducers_PFJetsTauOverlapRemoval_H | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/global/EDProducer.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "DataFormats/L1Trigger/interface/Tau.h" | ||
#include "DataFormats/JetReco/interface/CaloJetCollection.h" | ||
#include "DataFormats/TauReco/interface/PFTauFwd.h" | ||
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" | ||
#include "DataFormats/HLTReco/interface/TriggerObject.h" | ||
#include "DataFormats/HLTReco/interface/TriggerEvent.h" | ||
|
||
class PFJetsTauOverlapRemoval: public edm::global::EDProducer<> { | ||
|
||
private: | ||
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> tauSrc_; | ||
const edm::EDGetTokenT<reco::PFJetCollection> pfJetSrc_; | ||
const double mindR_; | ||
|
||
public: | ||
explicit PFJetsTauOverlapRemoval(const edm::ParameterSet&); | ||
~PFJetsTauOverlapRemoval(); | ||
virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; | ||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
const double matchingR2; | ||
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. just store matchingR2 instead of mindR_ and keep as a private member data. |
||
}; | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include "RecoTauTag/HLTProducers/interface/PFJetsTauOverlapRemoval.h" | ||
#include "Math/GenVector/VectorUtil.h" | ||
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" | ||
#include "FWCore/Utilities/interface/EDMException.h" | ||
#include "DataFormats/TauReco/interface/PFTau.h" | ||
#include "DataFormats/Math/interface/deltaR.h" | ||
|
||
// | ||
// class declaration | ||
// | ||
PFJetsTauOverlapRemoval::PFJetsTauOverlapRemoval(const edm::ParameterSet& iConfig): | ||
tauSrc_ ( consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<edm::InputTag>("TauSrc" ) ) ), | ||
pfJetSrc_ ( consumes<reco::PFJetCollection>(iConfig.getParameter<edm::InputTag>("PFJetSrc") ) ), | ||
mindR_ ( iConfig.getParameter<double>("Min_dR") ), | ||
|
||
matchingR2 ( mindR_*mindR_ ) | ||
{ | ||
produces<reco::PFJetCollection>(); | ||
} | ||
PFJetsTauOverlapRemoval::~PFJetsTauOverlapRemoval(){ } | ||
|
||
void PFJetsTauOverlapRemoval::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const | ||
{ | ||
|
||
std::unique_ptr<reco::PFJetCollection> cleanedPFJets(new reco::PFJetCollection); | ||
|
||
edm::Handle<trigger::TriggerFilterObjectWithRefs> tauJets; | ||
iEvent.getByToken(tauSrc_, tauJets); | ||
|
||
edm::Handle<reco::PFJetCollection> PFJets; | ||
iEvent.getByToken(pfJetSrc_,PFJets); | ||
|
||
trigger::VRpftau taus; | ||
tauJets->getObjects(trigger::TriggerTau,taus); | ||
|
||
if(PFJets->size() > 1){ | ||
for(unsigned int iJet = 0; iJet < 2; iJet++){ | ||
bool isMatched = false; | ||
const reco::PFJet & myPFJet = (*PFJets)[iJet]; | ||
for(unsigned int iTau = 0; iTau < taus.size(); iTau++){ | ||
if(reco::deltaR2(taus[iTau]->p4(), myPFJet.p4()) < matchingR2){ | ||
isMatched = true; | ||
break; | ||
} | ||
} | ||
if(isMatched == false) cleanedPFJets->push_back(myPFJet); | ||
} | ||
if(PFJets->size() > 2) cleanedPFJets->push_back((*PFJets)[2]); | ||
} | ||
iEvent.put(std::move(cleanedPFJets)); | ||
} | ||
|
||
void PFJetsTauOverlapRemoval::fillDescriptions(edm::ConfigurationDescriptions& descriptions) | ||
{ | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("PFJetSrc", edm::InputTag("hltAK4PFJetsCorrected"))->setComment("Input collection of PFJets" ); | ||
desc.add<edm::InputTag>("TauSrc", edm::InputTag("hltSinglePFTau20TrackPt1LooseChargedIsolationReg"))->setComment("Input collection of PFTaus that have passed ID and isolation requirements"); | ||
desc.add<double> ("Min_dR",0.5)->setComment("Minimum dR outside of which PFJets will be saved"); | ||
descriptions.setComment("This module produces a collection of PFJets that are cross-cleaned with respect to PFTaus passing a HLT filter."); | ||
descriptions.add ("PFJetsTauOverlapRemoval",desc); | ||
} |
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
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.
could this not be a stream module?
@albertdow
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'm not sure, I haven't found anything that does exactly this..