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

adding a PFJets-Tau overlap removal module for HLT #18997

Merged
merged 9 commits into from
Jun 8, 2017
35 changes: 35 additions & 0 deletions RecoTauTag/HLTProducers/interface/PFJetsTauOverlapRemoval.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef PFJetsTauOverlapRemoval_H
#define 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"

#include <map>
#include <vector>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the map or vector includes needed here? It doesn't seem so

class PFJetsTauOverlapRemoval: public edm::global::EDProducer<> {
Copy link
Contributor

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

Copy link
Contributor Author

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..

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

private:

const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> tauSrc;
const edm::EDGetTokenT<reco::PFJetCollection> PFJetSrc;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a consistent convention for member data - eg, start with lowercase, append an underscore.

};
#endif
73 changes: 73 additions & 0 deletions RecoTauTag/HLTProducers/src/PFJetsTauOverlapRemoval.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#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"

//
// class declaration
//
using namespace reco ;
using namespace std ;
using namespace edm ;
using namespace trigger;

PFJetsTauOverlapRemoval::PFJetsTauOverlapRemoval(const edm::ParameterSet& iConfig):
tauSrc ( consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<InputTag>("TauSrc" ) ) ),
PFJetSrc( consumes<PFJetCollection>(iConfig.getParameter<InputTag>("PFJetSrc") ) )
{
produces<PFJetCollection>();
}
PFJetsTauOverlapRemoval::~PFJetsTauOverlapRemoval(){ }

void PFJetsTauOverlapRemoval::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const
{

unique_ptr<PFJetCollection> cleanedPFJets(new PFJetCollection);

double deltaR = 1.0;
double matchingR = 0.5;

edm::Handle<trigger::TriggerFilterObjectWithRefs> tauJets;
iEvent.getByToken( tauSrc, tauJets );

edm::Handle<PFJetCollection> PFJets;
iEvent.getByToken(PFJetSrc,PFJets);

trigger::VRpftau taus;
tauJets->getObjects(trigger::TriggerTau,taus);

if(PFJets->size() == 2 || PFJets->size() > 3){
for(unsigned int iTau = 0; iTau < taus.size(); iTau++){
for(unsigned int iJet = 0; iJet < PFJets->size(); iJet++){
const PFJet & myPFJet = (*PFJets)[iJet];
deltaR = ROOT::Math::VectorUtil::DeltaR((taus[iTau])->p4().Vect(), myPFJet.p4().Vect());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoting David Lange: please use deltaR2 from DataFormats/Math/interface/deltaR unless some other functionality is intended

if(deltaR > matchingR) cleanedPFJets->push_back(myPFJet);
break;
}
}
}
else if(PFJets->size() == 3){
for(unsigned int iTau = 0; iTau < taus.size(); iTau++){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a special case of 3 needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi Martin,

the general answer is this module is specific to the VBF seed and its corresponding HLT path (in development). The seed is such that it can have either 2 or 3 jets, and in case it selects 3 jets, we want to clean only those two that make up the larger m_jj.

I let Albert comment on the specific implementation though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
As Riccardo mentioned, there may be 2 or 3 jets of interest in the path. Using the first if statement (with condition PFJets->size() ==2) we cross-clean the 2 jets that make up the highest m_jj (finding these jets is done before by another module within the HLT path). However, if PFJets->size()==3 (else if statement) we again want to cross-clean the 2 jets with highest m_jj but also keep the 3rd jet which will have Pt>90 GeV (this is again decided by a previous module in the HLT path). Thus by adding this special case of PFJets->size()==3 this module can be used for both scenarios.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then the presence of a fourth jet switches from the second back to the first if case,
so any additional jet spoils this. That does not seem robust. Why should the
presence of a fourth jet change what you do with the first three jets?

for(unsigned int iJet = 0; iJet < PFJets->size()-1; iJet++){
const PFJet & myPFJet = (*PFJets)[iJet];
deltaR = ROOT::Math::VectorUtil::DeltaR((taus[iTau])->p4().Vect(), myPFJet.p4().Vect());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoting David Lange: please use deltaR2 from DataFormats/Math/interface/deltaR unless some other functionality is intended

if(deltaR > matchingR) cleanedPFJets->push_back(myPFJet);
break;
}
}
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("hltPFTau20TrackLooseIso"))->setComment("Input collection of PFTaus that have passed ID and isolation requirements");
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);
}
3 changes: 2 additions & 1 deletion RecoTauTag/HLTProducers/src/SealModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
//#include "RecoTauTag/HLTProducers/interface/L2TauPixelTrackMatch.h"
#include "HLTPFTauPairLeadTrackDzMatchFilter.h"
#include "RecoTauTag/HLTProducers/interface/L2TauPixelIsoTagProducer.h"
#include "RecoTauTag/HLTProducers/interface/PFJetsTauOverlapRemoval.h"

DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TauRegionalPixelSeedGenerator, "TauRegionalPixelSeedGenerator");
DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TrackingRegionsFromBeamSpotAndL2Tau, "TrackingRegionsFromBeamSpotAndL2Tau");
Expand All @@ -45,4 +46,4 @@ DEFINE_FWK_MODULE(VertexFromTrackProducer);
//DEFINE_FWK_MODULE(L2TauPixelTrackMatch);
DEFINE_FWK_MODULE(HLTPFTauPairLeadTrackDzMatchFilter);
DEFINE_FWK_MODULE(L2TauPixelIsoTagProducer);

DEFINE_FWK_MODULE(PFJetsTauOverlapRemoval);