From e4fe95b07e5ad17603e41fc6bc41e734e4ab61f1 Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Fri, 16 May 2025 17:08:22 +0200 Subject: [PATCH 1/9] Preparation for Pythia8314 --- Generators/src/GeneratorPythia8.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index e883ceb6470a9..f1a52ad382a11 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -654,10 +654,16 @@ Bool_t // first particle is system auto particle = event[iparticle]; auto pdg = particle.id(); + // Select nuclei (A PDG id code for nuclei is on the form 100ZZZAAAI) + if (std::abs(pdg) > 1000000000) { + // Ignore isospin + pdg /= 10; + pdg *= 10; + } auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // .fullEncoding; - mParticles.push_back(TParticle(particle.id(), // Particle type + mParticles.push_back(TParticle(pdg, // Particle type st, // status particle.mother1() - 1, // first mother particle.mother2() - 1, // second mother @@ -776,7 +782,11 @@ void GeneratorPythia8::updateHeader(o2::dataformats::MCEventHeader* eventHeader) hiinfo->nAbsProj() + hiinfo->nDiffProj()); eventHeader->putInfo(Key::nPartTarget, hiinfo->nAbsTarg() + hiinfo->nDiffTarg()); +#if PYTHIA_VERSION_INTEGER >= 8313 + eventHeader->putInfo(Key::nCollHard, hiinfo->nCollND()); +#else eventHeader->putInfo(Key::nCollHard, hiinfo->nCollNDTot()); +#endif } } From 8910717d170f9270ab9038b7808dad082902fd8c Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Fri, 16 May 2025 17:16:43 +0200 Subject: [PATCH 2/9] Fix for clang-format --- Generators/src/GeneratorPythia8.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index f1a52ad382a11..48ec236076086 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -663,7 +663,7 @@ Bool_t auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // .fullEncoding; - mParticles.push_back(TParticle(pdg, // Particle type + mParticles.push_back(TParticle(pdg, // Particle type st, // status particle.mother1() - 1, // first mother particle.mother2() - 1, // second mother From 8f3d9eed63c4f2b60e1a85fa104d360e5d77ef94 Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Mon, 19 May 2025 17:40:07 +0200 Subject: [PATCH 3/9] Keep the original PDG code for versions older than 8313 --- Generators/src/GeneratorPythia8.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index 48ec236076086..e3bd96b6450e3 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -654,12 +654,14 @@ Bool_t // first particle is system auto particle = event[iparticle]; auto pdg = particle.id(); +#if PYTHIA_VERSION_INTEGER >= 8313 // Select nuclei (A PDG id code for nuclei is on the form 100ZZZAAAI) if (std::abs(pdg) > 1000000000) { // Ignore isospin pdg /= 10; pdg *= 10; } +#endif auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // .fullEncoding; From 161354581352ca6a52a424106901c6632a43791c Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Wed, 28 May 2025 14:59:29 +0200 Subject: [PATCH 4/9] Ignore nuclei isospin only if equal to 9. --- Generators/src/GeneratorPythia8.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index e3bd96b6450e3..4277c5a55a7b7 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -654,14 +654,12 @@ Bool_t // first particle is system auto particle = event[iparticle]; auto pdg = particle.id(); -#if PYTHIA_VERSION_INTEGER >= 8313 // Select nuclei (A PDG id code for nuclei is on the form 100ZZZAAAI) if (std::abs(pdg) > 1000000000) { - // Ignore isospin - pdg /= 10; - pdg *= 10; + // Ignore isospin if equal to 9 + auto pdgNoI = (pdg/10)*10; + if (std::abs(pdg-pdgNoI) == 9) pdg=pdgNoI; } -#endif auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // .fullEncoding; From 5225eec6f52cff486cb8923d5abacdb6d8c4ce30 Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Wed, 28 May 2025 15:11:33 +0200 Subject: [PATCH 5/9] Updates for clang-fromat --- Generators/src/GeneratorPythia8.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index 4277c5a55a7b7..dc336694379d3 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -657,8 +657,9 @@ Bool_t // Select nuclei (A PDG id code for nuclei is on the form 100ZZZAAAI) if (std::abs(pdg) > 1000000000) { // Ignore isospin if equal to 9 - auto pdgNoI = (pdg/10)*10; - if (std::abs(pdg-pdgNoI) == 9) pdg=pdgNoI; + auto pdgNoI = (pdg / 10) *1 0; + if (std::abs(pdg - pdgNoI) == 9) + pdg=pdgNoI; } auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // From fa09c99f2c1060196f6dbb43b12521aad7214579 Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Wed, 28 May 2025 15:12:22 +0200 Subject: [PATCH 6/9] Typo --- Generators/src/GeneratorPythia8.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index dc336694379d3..7d566c99ce369 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -657,7 +657,7 @@ Bool_t // Select nuclei (A PDG id code for nuclei is on the form 100ZZZAAAI) if (std::abs(pdg) > 1000000000) { // Ignore isospin if equal to 9 - auto pdgNoI = (pdg / 10) *1 0; + auto pdgNoI = (pdg / 10) * 10; if (std::abs(pdg - pdgNoI) == 9) pdg=pdgNoI; } From 83d2122ebf4f656ad08207d0e5a794095b792036 Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Wed, 28 May 2025 15:13:20 +0200 Subject: [PATCH 7/9] More formatting... --- Generators/src/GeneratorPythia8.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index 7d566c99ce369..8df9344d0bf83 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -659,7 +659,7 @@ Bool_t // Ignore isospin if equal to 9 auto pdgNoI = (pdg / 10) * 10; if (std::abs(pdg - pdgNoI) == 9) - pdg=pdgNoI; + pdg = pdgNoI; } auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // From d35f2ca7ccf45e83d2c80c8a9a1d91bbf03388c1 Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Thu, 29 May 2025 09:57:35 +0200 Subject: [PATCH 8/9] Now with braces... --- Generators/src/GeneratorPythia8.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index 8df9344d0bf83..9b57963969021 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -658,8 +658,9 @@ Bool_t if (std::abs(pdg) > 1000000000) { // Ignore isospin if equal to 9 auto pdgNoI = (pdg / 10) * 10; - if (std::abs(pdg - pdgNoI) == 9) + if (std::abs(pdg - pdgNoI) == 9) { pdg = pdgNoI; + } } auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // From 8beccfe52fdfcf7e86461031f8388e6eb82d667a Mon Sep 17 00:00:00 2001 From: Peter Hristov Date: Wed, 4 Jun 2025 15:06:30 +0200 Subject: [PATCH 9/9] Do not change the PDG code of beam remnants --- Generators/src/GeneratorPythia8.cxx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Generators/src/GeneratorPythia8.cxx b/Generators/src/GeneratorPythia8.cxx index 9b57963969021..becc810644f24 100644 --- a/Generators/src/GeneratorPythia8.cxx +++ b/Generators/src/GeneratorPythia8.cxx @@ -654,14 +654,6 @@ Bool_t // first particle is system auto particle = event[iparticle]; auto pdg = particle.id(); - // Select nuclei (A PDG id code for nuclei is on the form 100ZZZAAAI) - if (std::abs(pdg) > 1000000000) { - // Ignore isospin if equal to 9 - auto pdgNoI = (pdg / 10) * 10; - if (std::abs(pdg - pdgNoI) == 9) { - pdg = pdgNoI; - } - } auto st = o2::mcgenstatus::MCGenStatusEncoding(particle.statusHepMC(), // particle.status()) // .fullEncoding;