Skip to content

Commit d99a3ed

Browse files
committed
Fix o2 linter warnings on pgd
1 parent ac96e41 commit d99a3ed

1 file changed

Lines changed: 14 additions & 27 deletions

File tree

PWGUD/Tasks/FwdMuonsUPC.cxx

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
/// \author Andrea Giovanni Riffero <andrea.giovanni.riffero@cern.ch>
1818

19+
#include "CommonConstants/PhysicsConstants.h"
1920
#include "PWGUD/DataModel/UDTables.h"
2021

2122
#include "Framework/AnalysisDataModel.h"
@@ -26,6 +27,7 @@
2627
#include "TRandom3.h"
2728
#include <Math/Vector4D.h>
2829
#include <Math/VectorUtil.h>
30+
#include <TPDGCode.h>
2931

3032
#include <unordered_map>
3133
#include <vector>
@@ -174,13 +176,9 @@ const int kReqMatchMIDTracks = 2;
174176
const int kReqMatchMFTTracks = 2;
175177
const int kMaxChi2MFTMatch = 30;
176178
const float kMaxZDCTime = 2.;
177-
const int kMuonPDG = 13;
178179

179180
struct FwdMuonsUPC {
180181

181-
// a pdg object
182-
Service<o2::framework::O2DatabasePDG> pdg;
183-
184182
using CandidatesFwd = soa::Join<o2::aod::UDCollisions, o2::aod::UDCollisionsSelsFwd>;
185183
using ForwardTracks = soa::Join<o2::aod::UDFwdTracks, o2::aod::UDFwdTracksExtra>;
186184
using CompleteFwdTracks = soa::Join<ForwardTracks, o2::aod::UDMcFwdTrackLabels>;
@@ -244,13 +242,6 @@ struct FwdMuonsUPC {
244242

245243
// FUNCTIONS
246244

247-
// retrieve particle mass (GeV/c^2) from TDatabasePDG
248-
float particleMass(int pid)
249-
{
250-
auto mass = pdg->Mass(pid);
251-
return mass;
252-
}
253-
254245
// template function that fills a map with the collision id of each udcollision as key
255246
// and a vector with the tracks
256247
// map == (key, element) == (udCollisionId, vector of trks)
@@ -277,7 +268,7 @@ struct FwdMuonsUPC {
277268
if (candId < 0) {
278269
continue;
279270
}
280-
if (std::abs(tr.pdgCode()) != kMuonPDG) {
271+
if (std::abs(tr.pdgCode()) != PDG_t::kMuonMinus) {
281272
continue;
282273
}
283274
tracksPerCand[candId].push_back(tr.globalIndex());
@@ -350,8 +341,7 @@ struct FwdMuonsUPC {
350341
{
351342
float rAbs = fwdTrack.rAtAbsorberEnd();
352343
float pDca = fwdTrack.pDca();
353-
auto mMu = particleMass(kMuonPDG);
354-
ROOT::Math::PxPyPzMVector p{fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), mMu};
344+
ROOT::Math::PxPyPzMVector p{fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), o2::constants::physics::MassMuon};
355345

356346
float eta = p.Eta();
357347
float pt = p.Pt();
@@ -454,9 +444,8 @@ struct FwdMuonsUPC {
454444
return;
455445

456446
// form Lorentz vectors
457-
auto mMu = particleMass(kMuonPDG);
458-
ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), mMu};
459-
ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), mMu};
447+
ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassMuon};
448+
ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassMuon};
460449
ROOT::Math::PxPyPzMVector p = p1 + p2;
461450

462451
// cut on pair kinematics
@@ -540,7 +529,7 @@ struct FwdMuonsUPC {
540529
{
541530

542531
// check that all pairs are mu+mu-
543-
if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG) {
532+
if (std::abs(McPart1.pdgCode()) != PDG_t::kMuonMinus || std::abs(McPart2.pdgCode()) != PDG_t::kMuonMinus) {
544533
LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode());
545534
return;
546535
}
@@ -549,9 +538,8 @@ struct FwdMuonsUPC {
549538
}
550539

551540
// create Lorentz vectors
552-
auto mMu = particleMass(kMuonPDG);
553-
ROOT::Math::PxPyPzMVector p1{McPart1.px(), McPart1.py(), McPart1.pz(), mMu};
554-
ROOT::Math::PxPyPzMVector p2{McPart2.px(), McPart2.py(), McPart2.pz(), mMu};
541+
ROOT::Math::PxPyPzMVector p1{McPart1.px(), McPart1.py(), McPart1.pz(), o2::constants::physics::MassMuon};
542+
ROOT::Math::PxPyPzMVector p2{McPart2.px(), McPart2.py(), McPart2.pz(), o2::constants::physics::MassMuon};
555543
ROOT::Math::PxPyPzMVector p = p1 + p2;
556544

557545
// cut on pair kinematics
@@ -604,7 +592,7 @@ struct FwdMuonsUPC {
604592
{
605593

606594
// check that all pairs are mu+mu-
607-
if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG)
595+
if (std::abs(McPart1.pdgCode()) != PDG_t::kMuonMinus || std::abs(McPart2.pdgCode()) != PDG_t::kMuonMinus)
608596
LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode());
609597

610598
// V0 selection
@@ -654,9 +642,8 @@ struct FwdMuonsUPC {
654642
return;
655643

656644
// form Lorentz vectors
657-
auto mMu = particleMass(kMuonPDG);
658-
ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), mMu};
659-
ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), mMu};
645+
ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassMuon};
646+
ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassMuon};
660647
ROOT::Math::PxPyPzMVector p = p1 + p2;
661648

662649
// cut on pair kinematics (reco candidates)
@@ -681,8 +668,8 @@ struct FwdMuonsUPC {
681668
float phiCharge = 0;
682669
computePhiAnis(p1, p2, tr1.sign(), phiAverage, phiCharge);
683670

684-
ROOT::Math::PxPyPzMVector p1Mc{McPart1.px(), McPart1.py(), McPart1.pz(), mMu};
685-
ROOT::Math::PxPyPzMVector p2Mc{McPart2.px(), McPart2.py(), McPart2.pz(), mMu};
671+
ROOT::Math::PxPyPzMVector p1Mc{McPart1.px(), McPart1.py(), McPart1.pz(), o2::constants::physics::MassMuon};
672+
ROOT::Math::PxPyPzMVector p2Mc{McPart2.px(), McPart2.py(), McPart2.pz(), o2::constants::physics::MassMuon};
686673
ROOT::Math::PxPyPzMVector pMc = p2Mc + p2Mc;
687674

688675
// compute gen phi for azimuth anisotropy

0 commit comments

Comments
 (0)