Skip to content

Commit a534d91

Browse files
author
ariffero
committed
Fix O2 linter warnings on PGD objects
1 parent 0896043 commit a534d91

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

PWGUD/Tasks/fwdMuonsUPC.cxx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
#include <unordered_map>
2121

2222
#include "Framework/runDataProcessing.h"
23+
#include "Framework/O2DatabasePDGPlugin.h"
2324
#include "Framework/AnalysisTask.h"
2425
#include "Framework/AnalysisDataModel.h"
2526
#include "CCDB/BasicCCDBManager.h"
2627
#include "DataFormatsParameters/GRPLHCIFData.h"
2728
#include "DataFormatsParameters/GRPECSObject.h"
2829
#include "PWGUD/DataModel/UDTables.h"
2930

30-
#include "TDatabasePDG.h"
31+
//#include "TDatabasePDG.h"
3132
#include "TLorentzVector.h"
3233
#include "TSystem.h"
3334
#include "TMath.h"
@@ -167,7 +168,7 @@ const float kPtMin = 0.;
167168
struct fwdMuonsUPC {
168169

169170
// a pdg object
170-
TDatabasePDG* pdg = nullptr;
171+
Service<o2::framework::O2DatabasePDG> pdg;
171172

172173
using CandidatesFwd = soa::Join<o2::aod::UDCollisions, o2::aod::UDCollisionsSelsFwd>;
173174
using ForwardTracks = soa::Join<o2::aod::UDFwdTracks, o2::aod::UDFwdTracksExtra>;
@@ -227,7 +228,7 @@ struct fwdMuonsUPC {
227228
void init(InitContext&)
228229
{
229230
// PDG
230-
pdg = TDatabasePDG::Instance();
231+
//pdg = TDatabasePDG::Instance();
231232

232233
// binning of pT axis fr fit
233234
std::vector<double> ptFitBinning = {
@@ -338,13 +339,14 @@ struct fwdMuonsUPC {
338339
// FUNCTIONS
339340

340341
// retrieve particle mass (GeV/c^2) from TDatabasePDG
341-
float particleMass(TDatabasePDG* pdg, int pid)
342+
float particleMass(int pid)
342343
{
343-
auto mass = 0.;
344-
TParticlePDG* pdgparticle = pdg->GetParticle(pid);
345-
if (pdgparticle != nullptr) {
346-
mass = pdgparticle->Mass();
347-
}
344+
auto mass = pdg->Mass(pid);
345+
346+
//auto pdgparticle = pdg->GetParticle(pid);
347+
//if (pdgparticle != nullptr) {
348+
// mass = pdgparticle->Mass();
349+
//}
348350
return mass;
349351
}
350352

@@ -446,7 +448,7 @@ struct fwdMuonsUPC {
446448
float rAbs = fwdTrack.rAtAbsorberEnd();
447449
float pDca = fwdTrack.pDca();
448450
TLorentzVector p;
449-
auto mMu = particleMass(pdg, 13);
451+
auto mMu = particleMass(13);
450452
p.SetXYZM(fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), mMu);
451453
float eta = p.Eta();
452454
float pt = p.Pt();
@@ -530,7 +532,7 @@ struct fwdMuonsUPC {
530532

531533
// form Lorentz vectors
532534
TLorentzVector p1, p2;
533-
auto mMu = particleMass(pdg, 13);
535+
auto mMu = particleMass(13);
534536
p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), mMu);
535537
p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), mMu);
536538
TLorentzVector p = p1 + p2;
@@ -655,7 +657,7 @@ struct fwdMuonsUPC {
655657

656658
// create Lorentz vectors
657659
TLorentzVector p1, p2;
658-
auto mMu = particleMass(pdg, 13);
660+
auto mMu = particleMass(13);
659661
p1.SetXYZM(McPart1.px(), McPart1.py(), McPart1.pz(), mMu);
660662
p2.SetXYZM(McPart2.px(), McPart2.py(), McPart2.pz(), mMu);
661663
TLorentzVector p = p1 + p2;
@@ -750,7 +752,7 @@ struct fwdMuonsUPC {
750752

751753
// form Lorentz vectors
752754
TLorentzVector p1, p2;
753-
auto mMu = particleMass(pdg, 13);
755+
auto mMu = particleMass(13);
754756
p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), mMu);
755757
p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), mMu);
756758
TLorentzVector p = p1 + p2;

0 commit comments

Comments
 (0)