3636#include < Math/GenVector/LorentzVector.h>
3737#include < Math/GenVector/PxPyPzM4D.h>
3838#include < TMCProcess.h>
39+ #include < TPDGCode.h>
3940
4041#include < cmath>
4142#include < cstdlib>
@@ -63,9 +64,6 @@ struct PtSpectraInclusiveUpc {
6364 using TC = TCs::iterator;
6465 using LorentzVectorM = ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double >>;
6566
66- double massPion = 0 .;
67- double massKaon = 0 .;
68- double massProton = 0 .;
6967 const int codePion = 211 ;
7068 const int codeKaon = 321 ;
7169 const int codeProton = 2212 ;
@@ -79,11 +77,6 @@ struct PtSpectraInclusiveUpc {
7977
8078 void init (InitContext const &)
8179 {
82-
83- massPion = o2::constants::physics::MassPionCharged;
84- massKaon = o2::constants::physics::MassKaonCharged;
85- massProton = o2::constants::physics::MassProton;
86-
8780 // axes
8881 const AxisSpec axisPt{nBinsPt, 0 , 5 , " #it{p}_{T} GeV/#it{c}" };
8982 const AxisSpec axisEventCounter{2 , 0.5 , 2.5 , " Event type" };
@@ -130,7 +123,7 @@ struct PtSpectraInclusiveUpc {
130123 if (!mcParticle.isPhysicalPrimary ())
131124 continue ;
132125
133- LorentzVectorM pMC (mcParticle.px (), mcParticle.py (), mcParticle.pz (), massPion );
126+ LorentzVectorM pMC (mcParticle.px (), mcParticle.py (), mcParticle.pz (), o2::constants::physics::MassPionCharged );
134127
135128 if (applyKineCutsInGen) {
136129 if (std::fabs (pMC.Eta ()) > etaMax)
@@ -143,17 +136,17 @@ struct PtSpectraInclusiveUpc {
143136 continue ;
144137 }
145138
146- if (std::abs (mcParticle.pdgCode ()) == codePion ) {
139+ if (std::abs (mcParticle.pdgCode ()) == PDG_t:: kPiPlus ) {
147140 histos.fill (HIST (" ptGeneratedPion" ), pMC.Pt ());
148141 }
149142
150- if (std::abs (mcParticle.pdgCode ()) == codeKaon ) {
151- pMC.SetM (massKaon );
143+ if (std::abs (mcParticle.pdgCode ()) == PDG_t:: kKPlus ) {
144+ pMC.SetM (o2::constants::physics::MassKaonCharged );
152145 histos.fill (HIST (" ptGeneratedKaon" ), pMC.Pt ());
153146 }
154147
155- if (std::abs (mcParticle.pdgCode ()) == codeProton ) {
156- pMC.SetM (massProton );
148+ if (std::abs (mcParticle.pdgCode ()) == PDG_t:: kProton ) {
149+ pMC.SetM (o2::constants::physics::MassProton );
157150 histos.fill (HIST (" ptGeneratedProton" ), pMC.Pt ());
158151 }
159152
@@ -202,17 +195,17 @@ struct PtSpectraInclusiveUpc {
202195 pion->SetPx (track.px ());
203196 pion->SetPy (track.py ());
204197 pion->SetPz (track.pz ());
205- pion->SetM (massPion );
198+ pion->SetM (o2::constants::physics::MassPionCharged );
206199
207200 kaon->SetPx (track.px ());
208201 kaon->SetPy (track.py ());
209202 kaon->SetPz (track.pz ());
210- kaon->SetM (massKaon );
203+ kaon->SetM (o2::constants::physics::MassKaonCharged );
211204
212205 proton->SetPx (track.px ());
213206 proton->SetPy (track.py ());
214207 proton->SetPz (track.pz ());
215- proton->SetM (massProton );
208+ proton->SetM (o2::constants::physics::MassProton );
216209
217210 if (!track.has_udMcParticle ()) {
218211 continue ;
@@ -369,17 +362,17 @@ struct PtSpectraInclusiveUpc {
369362 pion->SetPx (track.px ());
370363 pion->SetPy (track.py ());
371364 pion->SetPz (track.pz ());
372- pion->SetM (massPion );
365+ pion->SetM (o2::constants::physics::MassPionCharged );
373366
374367 kaon->SetPx (track.px ());
375368 kaon->SetPy (track.py ());
376369 kaon->SetPz (track.pz ());
377- kaon->SetM (massKaon );
370+ kaon->SetM (o2::constants::physics::MassKaonCharged );
378371
379372 proton->SetPx (track.px ());
380373 proton->SetPy (track.py ());
381374 proton->SetPz (track.pz ());
382- proton->SetM (massProton );
375+ proton->SetM (o2::constants::physics::MassProton );
383376
384377 bool hasTpc = false ;
385378 // TPC tracks
0 commit comments