Skip to content

Commit

Permalink
Replace DeltaR with DeltaR2 in RecoTauTag/HLTProducers
Browse files Browse the repository at this point in the history
  • Loading branch information
perrotta committed Mar 19, 2023
1 parent 22933fd commit 8bf7faf
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc
Expand Up @@ -57,9 +57,9 @@ void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSet
}
if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold) {
math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy());
double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p);
double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p);

if (delta < mCone) {
if (delta2 < mCone * mCone) {
isAccepted = true;
cands->push_back(*cal);
}
Expand Down
Expand Up @@ -57,8 +57,8 @@ 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 delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p);
if (delta < mCone) {
double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p);
if (delta2 < mCone * mCone) {
isAccepted = true;
cands->push_back(*cal);
}
Expand Down
11 changes: 5 additions & 6 deletions RecoTauTag/HLTProducers/src/L1HLTJetsMatching.cc
Expand Up @@ -33,8 +33,7 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev

unique_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection);

double deltaR = 1.0;
double matchingR = 0.5;
constexpr double matchingR = 0.5 * 0.5;
//Getting HLT jets to be matched
edm::Handle<edm::View<Candidate> > tauJets;
iEvent.getByToken(jetSrc, tauJets);
Expand All @@ -56,8 +55,8 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev
for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
//Find the relative L2TauJets, to see if it has been reconstructed
const Candidate& myJet = (*tauJets)[iJet];
deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR < matchingR) {
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
// LeafCandidate myLC(myJet);
CaloJet myCaloJet(myJet.p4(), a, f);
if (myJet.pt() > mEt_Min) {
Expand All @@ -73,8 +72,8 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev
for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
const Candidate& myJet = (*tauJets)[iJet];
//Find the relative L2TauJets, to see if it has been reconstructed
deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR < matchingR) {
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
// LeafCandidate myLC(myJet);
CaloJet myCaloJet(myJet.p4(), a, f);
if (myJet.pt() > mEt_Min) {
Expand Down
12 changes: 6 additions & 6 deletions RecoTauTag/HLTProducers/src/L1HLTTauMatching.cc
Expand Up @@ -31,8 +31,8 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm

unique_ptr<PFTauCollection> tauL2jets(new PFTauCollection);

double deltaR = 1.0;
double matchingR = 0.5;
constexpr double matchingR = 0.5;

//Getting HLT jets to be matched
edm::Handle<PFTauCollection> tauJets;
iEvent.getByToken(jetSrc, tauJets);
Expand All @@ -53,8 +53,8 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm
for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
//Find the relative L2TauJets, to see if it has been reconstructed
const PFTau& myJet = (*tauJets)[iJet];
deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR < matchingR) {
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
// LeafCandidate myLC(myJet);
if (myJet.leadChargedHadrCand().isNonnull()) {
a = myJet.leadChargedHadrCand()->vertex();
Expand All @@ -73,8 +73,8 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm
for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
const PFTau& myJet = (*tauJets)[iJet];
//Find the relative L2TauJets, to see if it has been reconstructed
deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR < matchingR) {
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
// LeafCandidate myLC(myJet);
if (myJet.leadChargedHadrCand().isNonnull()) {
a = myJet.leadChargedHadrCand()->vertex();
Expand Down
7 changes: 3 additions & 4 deletions RecoTauTag/HLTProducers/src/L1THLTTauMatching.cc
Expand Up @@ -26,8 +26,7 @@ L1THLTTauMatching::~L1THLTTauMatching() {}
void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const {
unique_ptr<PFTauCollection> tauL2jets(new PFTauCollection);

double deltaR = 1.0;
double matchingR = 0.5;
constexpr double matchingR = 0.5 * 0.5;

// Getting HLT jets to be matched
edm::Handle<PFTauCollection> tauJets;
Expand All @@ -45,8 +44,8 @@ void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const ed
for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) {
// Find the relative L2TauJets, to see if it has been reconstructed
const PFTau& myJet = (*tauJets)[iJet];
deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR < matchingR) {
double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect());
if (deltaR2 < matchingR) {
if (myJet.leadChargedHadrCand().isNonnull()) {
a = myJet.leadChargedHadrCand()->vertex();
}
Expand Down
4 changes: 2 additions & 2 deletions RecoTauTag/HLTProducers/src/L2TauJetsMerger.cc
Expand Up @@ -58,8 +58,8 @@ void L2TauJetsMerger::produce(edm::StreamID iSId, edm::Event& iEvent, const edm:
tauL2jets->push_back(myTmpJets[0]);
CaloJetCollection tmp;
for (unsigned int i = 1; i < myTmpJets.size(); ++i) {
double DR = ROOT::Math::VectorUtil::DeltaR(myTmpJets[0].p4(), myTmpJets[i].p4());
if (DR > 0.1)
double DR2 = ROOT::Math::VectorUtil::DeltaR2(myTmpJets[0].p4(), myTmpJets[i].p4());
if (DR > 0.1 * 0.1)
tmp.push_back(myTmpJets[i]);
}
myTmpJets.swap(tmp);
Expand Down

0 comments on commit 8bf7faf

Please sign in to comment.