@@ -56,18 +56,21 @@ struct ProcessMCDPMJetSGv3 {
5656 double massPion = 0 .;
5757 double massKaon = 0 .;
5858 double massProton = 0 .;
59+ const int codePion = 211 ;
60+ const int codeKaon = 321 ;
61+ const int codeProton = 2212 ;
5962
6063 void init (InitContext const &)
6164 {
62- TParticlePDG* pionPDG = fPDG ->GetParticle (211 );
65+ TParticlePDG* pionPDG = fPDG ->GetParticle (codePion );
6366 if (pionPDG != nullptr ) {
6467 massPion = pionPDG->Mass ();
6568 }
66- TParticlePDG* kaonPDG = fPDG ->GetParticle (321 );
69+ TParticlePDG* kaonPDG = fPDG ->GetParticle (codeKaon );
6770 if (kaonPDG != nullptr ) {
6871 massKaon = kaonPDG->Mass ();
6972 }
70- TParticlePDG* protonPDG = fPDG ->GetParticle (2212 );
73+ TParticlePDG* protonPDG = fPDG ->GetParticle (codeProton );
7174 if (protonPDG != nullptr ) {
7275 massProton = protonPDG->Mass ();
7376 }
@@ -147,13 +150,13 @@ struct ProcessMCDPMJetSGv3 {
147150 histos.fill (HIST (" eventCounter" ), 0.5 );
148151
149152 // auto massPion = 0.;
150- // TParticlePDG pionPDG = fPDG->GetParticle(211 );
153+ // TParticlePDG pionPDG = fPDG->GetParticle(codePion );
151154 // massPion = pionPDG.Mass();
152155 // auto massKaon = 0.;
153- // TParticlePDG kaonPDG = fPDG->GetParticle(321 );
156+ // TParticlePDG kaonPDG = fPDG->GetParticle(codeKaon );
154157 // massKaon = kaonPDG.Mass();
155158 // auto massProton = 0.;
156- // TParticlePDG protonPDG = fPDG->GetParticle(2212 );
159+ // TParticlePDG protonPDG = fPDG->GetParticle(codeProton );
157160 // massProton = protonPDG.Mass();
158161 histos.fill (HIST (" numberOfTracksMC" ), mcParticles.size ());
159162 // LOGF(info, "New event! mcParticles.size() = %d", mcParticles.size());
@@ -174,29 +177,29 @@ struct ProcessMCDPMJetSGv3 {
174177 continue ;
175178 // if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.eta())<0.9){ // do this in the context of the MC loop ! (context matters!!!)
176179 TLorentzVector pMC;
177- if (std::abs (mcParticle.pdgCode ()) == 211 ) {
180+ if (std::abs (mcParticle.pdgCode ()) == codePion ) {
178181 // histos.fill(HIST("ptGeneratedPion"), mcParticle.pt());
179182 pMC.SetXYZM (mcParticle.px (), mcParticle.py (), mcParticle.pz (), massPion);
180183 histos.fill (HIST (" ptGeneratedPion" ), pMC.Pt ());
181184 }
182- if (std::abs (mcParticle.pdgCode ()) == 321 ) {
185+ if (std::abs (mcParticle.pdgCode ()) == codeKaon ) {
183186 // histos.fill(HIST("ptGenerateKaon"), mcParticle.pt());
184187 pMC.SetXYZM (mcParticle.px (), mcParticle.py (), mcParticle.pz (), massKaon);
185188 histos.fill (HIST (" ptGeneratedKaon" ), pMC.Pt ());
186189 }
187- if (std::abs (mcParticle.pdgCode ()) == 2212 ) {
190+ if (std::abs (mcParticle.pdgCode ()) == codeProton ) {
188191 // histos.fill(HIST("ptGeneratedProton"), mcParticle.pt());
189192 pMC.SetXYZM (mcParticle.px (), mcParticle.py (), mcParticle.pz (), massProton);
190193 histos.fill (HIST (" ptGeneratedProton" ), pMC.Pt ());
191194 }
192195 if (std::abs (pMC.Rapidity ()) < 0.8 ) {
193- if (std::abs (mcParticle.pdgCode ()) == 211 )
196+ if (std::abs (mcParticle.pdgCode ()) == codePion )
194197 histos.fill (HIST (" ptGeneratedPionAxE" ), pMC.Pt ());
195- if (std::abs (mcParticle.pdgCode ()) == 321 )
198+ if (std::abs (mcParticle.pdgCode ()) == codeKaon )
196199 histos.fill (HIST (" ptGeneratedKaonAxE" ), pMC.Pt ());
197- if (std::abs (mcParticle.pdgCode ()) == 2212 )
200+ if (std::abs (mcParticle.pdgCode ()) == codeProton )
198201 histos.fill (HIST (" ptGeneratedProtonAxE" ), pMC.Pt ());
199- if (mcParticle.pdgCode () == 2212 ) {
202+ if (mcParticle.pdgCode () == codeProton ) {
200203 histos.fill (HIST (" ptGeneratedProtonAxEPos" ), pMC.Pt ());
201204 } else {
202205 histos.fill (HIST (" ptGeneratedProtonAxENeg" ), pMC.Pt ());
@@ -217,13 +220,13 @@ struct ProcessMCDPMJetSGv3 {
217220 PVContributors.bindTable (tracks);
218221
219222 // auto massPion = 0.;
220- // TParticlePDG pionPDG = fPDG->GetParticle(211 );
223+ // TParticlePDG pionPDG = fPDG->GetParticle(codePion );
221224 // massPion = pionPDG.Mass();
222225 // auto massKaon = 0.;
223- // TParticlePDG kaonPDG = fPDG->GetParticle(321 );
226+ // TParticlePDG kaonPDG = fPDG->GetParticle(codeKaon );
224227 // massKaon = kaonPDG.Mass();
225228 // auto massProton = 0.;
226- // TParticlePDG protonPDG = fPDG->GetParticle(2212 );
229+ // TParticlePDG protonPDG = fPDG->GetParticle(codeProton );
227230 // massProton = protonPDG.Mass();
228231
229232 histos.fill (HIST (" numberOfTracksReco" ), tracks.size ());
@@ -276,8 +279,8 @@ struct ProcessMCDPMJetSGv3 {
276279 histos.fill (HIST (" hSigmaPion" ), track.pt (), nSigmaPi);
277280 if (track.has_udMcParticle ()) {
278281 auto mcParticle = track.udMcParticle ();
279- // if(abs(mcParticle.pdgCode())==211 && mcParticle.isPhysicalPrimary()) howManyPionsHavePionMCandPrimaries += 1;
280- if (std::abs (mcParticle.pdgCode ()) == 211 ) {
282+ // if(abs(mcParticle.pdgCode())==codePion && mcParticle.isPhysicalPrimary()) howManyPionsHavePionMCandPrimaries += 1;
283+ if (std::abs (mcParticle.pdgCode ()) == codePion ) {
281284 histos.fill (HIST (" hSigmaPionTruth" ), track.pt (), nSigmaPi);
282285 histos.fill (HIST (" allreconstructedPFPion" ), track.pt ());
283286 if (mcParticle.isPhysicalPrimary ()) {
@@ -290,7 +293,7 @@ struct ProcessMCDPMJetSGv3 {
290293 histos.fill (HIST (" hSigmaKaon" ), track.pt (), nSigmaKa);
291294 if (track.has_udMcParticle ()) {
292295 auto mcParticle = track.udMcParticle ();
293- if (std::abs (mcParticle.pdgCode ()) == 321 ) {
296+ if (std::abs (mcParticle.pdgCode ()) == codeKaon ) {
294297 histos.fill (HIST (" hSigmaKaonTruth" ), track.pt (), nSigmaKa);
295298 histos.fill (HIST (" allreconstructedPFKaon" ), track.pt ());
296299 if (mcParticle.isPhysicalPrimary ()) {
@@ -303,17 +306,17 @@ struct ProcessMCDPMJetSGv3 {
303306 histos.fill (HIST (" hSigmaProton" ), track.pt (), nSigmaPr);
304307 if (track.has_udMcParticle ()) {
305308 auto mcParticle = track.udMcParticle ();
306- if (std::abs (mcParticle.pdgCode ()) == 2212 ) {
309+ if (std::abs (mcParticle.pdgCode ()) == codeProton ) {
307310 histos.fill (HIST (" hSigmaProtonTruth" ), track.pt (), nSigmaPr);
308311 histos.fill (HIST (" allreconstructedPFProton" ), track.pt ());
309- if (mcParticle.pdgCode () == 2212 ) {
312+ if (mcParticle.pdgCode () == codeProton ) {
310313 histos.fill (HIST (" allreconstructedPFProtonPos" ), track.pt ());
311314 } else {
312315 histos.fill (HIST (" allreconstructedPFProtonNeg" ), track.pt ());
313316 }
314317 if (mcParticle.isPhysicalPrimary ()) {
315318 histos.fill (HIST (" ptReconstructedProton" ), track.pt ());
316- if (mcParticle.pdgCode () == 2212 ) {
319+ if (mcParticle.pdgCode () == codeProton ) {
317320 histos.fill (HIST (" ptReconstructedProtonPos" ), track.pt ());
318321 } else {
319322 histos.fill (HIST (" ptReconstructedProtonNeg" ), track.pt ());
@@ -332,8 +335,8 @@ struct ProcessMCDPMJetSGv3 {
332335 histos.fill (HIST (" hSigmaPionTOF" ), track.pt (), nSigmaPiTOF);
333336 if (track.has_udMcParticle ()) {
334337 auto mcParticle = track.udMcParticle ();
335- // if(abs(mcParticle.pdgCode())==211 && mcParticle.isPhysicalPrimary()) howManyPionsHavePionMCandPrimaries += 1;
336- if (std::abs (mcParticle.pdgCode ()) == 211 ) {
338+ // if(abs(mcParticle.pdgCode())==codePion && mcParticle.isPhysicalPrimary()) howManyPionsHavePionMCandPrimaries += 1;
339+ if (std::abs (mcParticle.pdgCode ()) == codePion ) {
337340 histos.fill (HIST (" hSigmaPionTruthTOF" ), track.pt (), nSigmaPiTOF);
338341 histos.fill (HIST (" allreconstructedPFPionTOF" ), track.pt ());
339342 if (mcParticle.isPhysicalPrimary ()) {
@@ -346,7 +349,7 @@ struct ProcessMCDPMJetSGv3 {
346349 histos.fill (HIST (" hSigmaKaonTOF" ), track.pt (), nSigmaKaTOF);
347350 if (track.has_udMcParticle ()) {
348351 auto mcParticle = track.udMcParticle ();
349- if (std::abs (mcParticle.pdgCode ()) == 321 ) {
352+ if (std::abs (mcParticle.pdgCode ()) == codeKaon ) {
350353 histos.fill (HIST (" hSigmaKaonTruthTOF" ), track.pt (), nSigmaKaTOF);
351354 histos.fill (HIST (" allreconstructedPFKaonTOF" ), track.pt ());
352355 if (mcParticle.isPhysicalPrimary ()) {
@@ -359,7 +362,7 @@ struct ProcessMCDPMJetSGv3 {
359362 histos.fill (HIST (" hSigmaProtonTOF" ), track.pt (), nSigmaPrTOF);
360363 if (track.has_udMcParticle ()) {
361364 auto mcParticle = track.udMcParticle ();
362- if (std::abs (mcParticle.pdgCode ()) == 2212 ) {
365+ if (std::abs (mcParticle.pdgCode ()) == codeProton ) {
363366 histos.fill (HIST (" hSigmaProtonTruthTOF" ), track.pt (), nSigmaPrTOF);
364367 histos.fill (HIST (" allreconstructedPFProtonTOF" ), track.pt ());
365368 if (mcParticle.isPhysicalPrimary ()) {
0 commit comments