Skip to content

Commit

Permalink
Apply code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
perrotta committed Mar 21, 2023
1 parent 2ccf189 commit b8b0a9e
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ class CaloTowerCreatorForTauHLT : public edm::global::EDProducer<> {
/// label of source collection
const edm::EDGetTokenT<CaloTowerCollection> mtowers_token;
/// use only towers in cone mCone around L1 candidate for regional jet reco
const double mCone;
const double mCone, mCone2;
/// label of tau trigger type analysis
const edm::EDGetTokenT<l1extra::L1JetParticleCollection> mTauTrigger_token;
/// imitator of L1 seeds
//edm::InputTag ml1seeds;
/// ET threshold
const double mEtThreshold;
/// E threshold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ class CaloTowerFromL1TCreatorForTauHLT : public edm::global::EDProducer<> {
/// label of source collection
const edm::EDGetTokenT<CaloTowerCollection> mtowers_token;
/// use only towers in cone mCone around L1 candidate for regional jet reco
const double mCone;
const double mCone, mCone2;
/// label of tau trigger type analysis
const edm::EDGetTokenT<l1t::TauBxCollection> mTauTrigger_token;
/// imitator of L1 seeds
//edm::InputTag ml1seeds;
/// ET threshold
const double mEtThreshold;
/// E threshold
Expand Down
8 changes: 2 additions & 6 deletions RecoTauTag/HLTProducers/interface/L1HLTJetsMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
#include "FWCore/Framework/interface/global/EDProducer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"

#include <map>
Expand All @@ -20,7 +16,7 @@
class L1HLTJetsMatching : public edm::global::EDProducer<> {
public:
explicit L1HLTJetsMatching(const edm::ParameterSet&);
~L1HLTJetsMatching() override;
~L1HLTJetsMatching() override = default;
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;

private:
Expand Down
9 changes: 2 additions & 7 deletions RecoTauTag/HLTProducers/interface/L1HLTTauMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@
#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/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
#include "DataFormats/TauReco/interface/PFTauFwd.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"

Expand All @@ -21,7 +16,7 @@
class L1HLTTauMatching : public edm::global::EDProducer<> {
public:
explicit L1HLTTauMatching(const edm::ParameterSet&);
~L1HLTTauMatching() override;
~L1HLTTauMatching() override = default;
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
11 changes: 3 additions & 8 deletions RecoTauTag/HLTProducers/interface/L1THLTTauMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@
// 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 "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "DataFormats/TauReco/interface/PFTauFwd.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"

Expand All @@ -20,7 +15,7 @@
class L1THLTTauMatching : public edm::global::EDProducer<> {
public:
explicit L1THLTTauMatching(const edm::ParameterSet&);
~L1THLTTauMatching() override;
~L1THLTTauMatching() override = default;
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
4 changes: 2 additions & 2 deletions RecoTauTag/HLTProducers/interface/L1TJetsMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ std::pair<std::vector<T>, std::vector<T>> L1TJetsMatching<T>::categorise(

const T& myJet1 = (pfMatchedJets)[i1];
const T& myJet2 = (pfMatchedJets)[i2];
const double M2jj = (Mjj > 0. ? Mjj * Mjj : -1.);
const double M2jj = (Mjj >= 0. ? Mjj * Mjj : -1.);

if ((m2jj > M2jj) && (myJet1.pt() >= pt1) && (myJet2.pt() > pt2)) {
output.first.push_back(myJet1);
Expand Down Expand Up @@ -145,7 +145,7 @@ std::tuple<std::vector<T>, std::vector<T>, std::vector<T>> L1TJetsMatching<T>::c

const T& myJet1 = (pfMatchedJets)[i1];
const T& myJet2 = (pfMatchedJets)[i2];
const double M2jj = (Mjj > 0. ? Mjj * Mjj : -1.);
const double M2jj = (Mjj >= 0. ? Mjj * Mjj : -1.);

std::vector<T> vec4jets;
vec4jets.reserve(4);
Expand Down
11 changes: 7 additions & 4 deletions RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CaloTowerCreatorForTauHLT::CaloTowerCreatorForTauHLT(const ParameterSet& p)
: mVerbose(p.getUntrackedParameter<int>("verbose", 0)),
mtowers_token(consumes<CaloTowerCollection>(p.getParameter<InputTag>("towers"))),
mCone(p.getParameter<double>("UseTowersInCone")),
mCone2(mCone * mCone),
mTauTrigger_token(consumes<L1JetParticleCollection>(p.getParameter<InputTag>("TauTrigger"))),
mEtThreshold(p.getParameter<double>("minimumEt")),
mEThreshold(p.getParameter<double>("minimumE")),
Expand All @@ -30,9 +31,6 @@ CaloTowerCreatorForTauHLT::CaloTowerCreatorForTauHLT(const ParameterSet& p)
}

void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSetup& stp) const {
if (mCone < 0.)
return;

edm::Handle<CaloTowerCollection> caloTowers;
evt.getByToken(mtowers_token, caloTowers);

Expand All @@ -43,6 +41,11 @@ void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSet
std::unique_ptr<CaloTowerCollection> cands(new CaloTowerCollection);
cands->reserve(caloTowers->size());

if (mCone < 0.) {
evt.put(std::move(cands));
return;
}

int idTau = 0;
L1JetParticleCollection::const_iterator myL1Jet = jetsgen->begin();
for (; myL1Jet != jetsgen->end(); myL1Jet++) {
Expand All @@ -60,7 +63,7 @@ void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSet
math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy());
double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p);

if (delta2 < mCone * mCone) {
if (delta2 < mCone2) {
isAccepted = true;
cands->push_back(*cal);
}
Expand Down
11 changes: 7 additions & 4 deletions RecoTauTag/HLTProducers/src/CaloTowerFromL1TCreatorForTauHLT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CaloTowerFromL1TCreatorForTauHLT::CaloTowerFromL1TCreatorForTauHLT(const Paramet
mVerbose(p.getUntrackedParameter<int>("verbose", 0)),
mtowers_token(consumes<CaloTowerCollection>(p.getParameter<InputTag>("towers"))),
mCone(p.getParameter<double>("UseTowersInCone")),
mCone2(mCone * mCone),
mTauTrigger_token(consumes<l1t::TauBxCollection>(p.getParameter<InputTag>("TauTrigger"))),
mEtThreshold(p.getParameter<double>("minimumEt")),
mEThreshold(p.getParameter<double>("minimumE")),
Expand All @@ -30,9 +31,6 @@ CaloTowerFromL1TCreatorForTauHLT::CaloTowerFromL1TCreatorForTauHLT(const Paramet
}

void CaloTowerFromL1TCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSetup& stp) const {
if (mCone < 0.)
return;

edm::Handle<CaloTowerCollection> caloTowers;
evt.getByToken(mtowers_token, caloTowers);

Expand All @@ -43,6 +41,11 @@ void CaloTowerFromL1TCreatorForTauHLT::produce(StreamID sid, Event& evt, const E
std::unique_ptr<CaloTowerCollection> cands(new CaloTowerCollection);
cands->reserve(caloTowers->size());

if (mCone < 0.) {
evt.put(std::move(cands));
return;
}

int idTau = 0;
if (jetsgen.isValid()) {
for (auto myL1Jet = jetsgen->begin(mBX); myL1Jet != jetsgen->end(mBX); myL1Jet++) {
Expand All @@ -59,7 +62,7 @@ void CaloTowerFromL1TCreatorForTauHLT::produce(StreamID sid, Event& evt, const E
if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold) {
math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy());
double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p);
if (delta2 < mCone * mCone) {
if (delta2 < mCone2) {
isAccepted = true;
cands->push_back(*cal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void HLTPFDiJetCorrCheckerWithDiTau::produce(edm::StreamID iSId, edm::Event& iEv
const reco::PFJet& myPFJet1 = pfJets[iJet1];
const reco::PFJet& myPFJet2 = pfJets[iJet2];

if (mjjMin_ <= 0. || (myPFJet1.p4() + myPFJet2.p4()).M2() < m2jjMin_)
if (mjjMin_ >= 0. && (myPFJet1.p4() + myPFJet2.p4()).M2() < m2jjMin_)
continue;

for (unsigned int iTau1 = 0; iTau1 < taus.size(); iTau1++) {
Expand Down
12 changes: 7 additions & 5 deletions RecoTauTag/HLTProducers/src/L1HLTJetsMatching.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include "RecoTauTag/HLTProducers/interface/L1HLTJetsMatching.h"
#include "Math/GenVector/VectorUtil.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/Utilities/interface/InputTag.h"
//
// class decleration
//
Expand All @@ -20,8 +23,6 @@ L1HLTJetsMatching::L1HLTJetsMatching(const edm::ParameterSet& iConfig) {
produces<CaloJetCollection>();
}

L1HLTJetsMatching::~L1HLTJetsMatching() {}

void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iES) const {
using namespace edm;
using namespace std;
Expand All @@ -33,7 +34,8 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev

unique_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection);

constexpr double matchingR = 0.5 * 0.5;
constexpr double matchingR2 = 0.5 * 0.5;

//Getting HLT jets to be matched
edm::Handle<edm::View<Candidate> > tauJets;
iEvent.getByToken(jetSrc, tauJets);
Expand All @@ -56,7 +58,7 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev
//Find the relative L2TauJets, to see if it has been reconstructed
const Candidate& myJet = (*tauJets)[iJet];
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
if (deltaR2 < matchingR2) {
// LeafCandidate myLC(myJet);
CaloJet myCaloJet(myJet.p4(), a, f);
if (myJet.pt() > mEt_Min) {
Expand All @@ -73,7 +75,7 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev
const Candidate& myJet = (*tauJets)[iJet];
//Find the relative L2TauJets, to see if it has been reconstructed
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
if (deltaR2 < matchingR2) {
// LeafCandidate myLC(myJet);
CaloJet myCaloJet(myJet.p4(), a, f);
if (myJet.pt() > mEt_Min) {
Expand Down
15 changes: 6 additions & 9 deletions RecoTauTag/HLTProducers/src/L1HLTTauMatching.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "RecoTauTag/HLTProducers/interface/L1HLTTauMatching.h"
#include "Math/GenVector/VectorUtil.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "DataFormats/TauReco/interface/PFTau.h"

//
Expand All @@ -20,7 +22,6 @@ L1HLTTauMatching::L1HLTTauMatching(const edm::ParameterSet& iConfig)
mEt_Min(iConfig.getParameter<double>("EtMin")) {
produces<PFTauCollection>();
}
L1HLTTauMatching::~L1HLTTauMatching() {}

void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const {
using namespace edm;
Expand All @@ -31,14 +32,12 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm

unique_ptr<PFTauCollection> tauL2jets(new PFTauCollection);

constexpr double matchingR = 0.5;
constexpr double matchingR2 = 0.5 * 0.5;

//Getting HLT jets to be matched
edm::Handle<PFTauCollection> tauJets;
iEvent.getByToken(jetSrc, tauJets);

// std::cout <<"Size of input jet collection "<<tauJets->size()<<std::endl;

edm::Handle<trigger::TriggerFilterObjectWithRefs> l1TriggeredTaus;
iEvent.getByToken(tauTrigger, l1TriggeredTaus);

Expand All @@ -54,7 +53,7 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm
//Find the relative L2TauJets, to see if it has been reconstructed
const PFTau& myJet = (*tauJets)[iJet];
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
if (deltaR2 < matchingR2) {
// LeafCandidate myLC(myJet);
if (myJet.leadChargedHadrCand().isNonnull()) {
a = myJet.leadChargedHadrCand()->vertex();
Expand All @@ -74,7 +73,7 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm
const PFTau& myJet = (*tauJets)[iJet];
//Find the relative L2TauJets, to see if it has been reconstructed
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
if (deltaR2 < matchingR2) {
// LeafCandidate myLC(myJet);
if (myJet.leadChargedHadrCand().isNonnull()) {
a = myJet.leadChargedHadrCand()->vertex();
Expand All @@ -90,8 +89,6 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm
}
}

//std::cout <<"Size of L1HLT matched jets "<<tauL2jets->size()<<std::endl;

iEvent.put(std::move(tauL2jets));
// iEvent.put(std::move(tauL2LC));
}
Expand Down
14 changes: 9 additions & 5 deletions RecoTauTag/HLTProducers/src/L1THLTTauMatching.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#include "RecoTauTag/HLTProducers/interface/L1THLTTauMatching.h"
#include "Math/GenVector/VectorUtil.h"
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "DataFormats/TauReco/interface/PFTau.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/RefVector.h"
#include "DataFormats/L1Trigger/interface/Tau.h"
#include "DataFormats/TauReco/interface/PFTau.h"

//
// class decleration
// class declaration
//
using namespace reco;
using namespace std;
Expand All @@ -21,12 +26,11 @@ L1THLTTauMatching::L1THLTTauMatching(const edm::ParameterSet& iConfig)
keepOriginalVertex(iConfig.getParameter<bool>("KeepOriginalVertex")) {
produces<PFTauCollection>();
}
L1THLTTauMatching::~L1THLTTauMatching() {}

void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const {
unique_ptr<PFTauCollection> tauL2jets(new PFTauCollection);

constexpr double matchingR = 0.5 * 0.5;
constexpr double matchingR2 = 0.5 * 0.5;

// Getting HLT jets to be matched
edm::Handle<PFTauCollection> tauJets;
Expand All @@ -45,7 +49,7 @@ void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const ed
// Find the relative L2TauJets, to see if it has been reconstructed
const PFTau& myJet = (*tauJets)[iJet];
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
if (deltaR2 < matchingR2) {
if (myJet.leadChargedHadrCand().isNonnull()) {
a = myJet.leadChargedHadrCand()->vertex();
}
Expand Down

0 comments on commit b8b0a9e

Please sign in to comment.