From 921db25a5004f3825cbc84b16dd2e4594b33bc3d Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Wed, 18 Jun 2025 08:04:51 +0200 Subject: [PATCH] Flag to remove chi_0c and chi_1c --- MC/config/examples/epos4/generator_EPOS4.C | 36 +++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/MC/config/examples/epos4/generator_EPOS4.C b/MC/config/examples/epos4/generator_EPOS4.C index 1dd5cd3fd..ded97ec17 100644 --- a/MC/config/examples/epos4/generator_EPOS4.C +++ b/MC/config/examples/epos4/generator_EPOS4.C @@ -9,6 +9,38 @@ class GeneratorEPOS4 : public o2::eventgen::GeneratorHepMC GeneratorEPOS4() = default; ~GeneratorEPOS4() = default; + bool importParticles() override { + bool status = GeneratorHepMC::importParticles(); + if (!status) { + LOG(error) << "Failed to import particles from HepMC event!"; + return false; + } + // Remove charmonia chi_0c and chi_1c from the particles list (incompatible with default G4 physics list) + // These are not decayed by EPOS4 (no daughters) + if (!mEnChi) + { + for (int a = 0; a < mParticles.size(); ++a) { + if (mParticles[a].GetPdgCode() == 10441 || mParticles[a].GetPdgCode() == 20443) + { + LOG(debug) << "Removing charmonium state " << mParticles[a].GetPdgCode() << " from particles list"; + mParticles.erase(mParticles.begin() + a); + --a; // Adjust index after erasing + } + } + } + return true; + } + + void setChiFlag(bool &flag) { + mEnChi = flag; + if (!flag) { + LOG(info) << "Charmonium states chi_0c and chi_1c will be removed from the particles list"; + } + } + + private: + bool mEnChi = false; // Switch to enable chi_0c and chi_1c mesons + }; // Next function takes the optns file as argument and edits the maximum number of events to be generated. @@ -19,7 +51,7 @@ class GeneratorEPOS4 : public o2::eventgen::GeneratorHepMC // type for the nfull parameter. Might be changed in the future. // When running locally, or on the GRID (not in hyperloop), the default parameters provided in the .ini file of the // external generation can be overwritten using the confKeyValues option (or similar depending on the tool used). -FairGenerator* generateEPOS4(const std::string &name, const int& nEvents) +FairGenerator* generateEPOS4(const std::string &name, const int& nEvents, bool enableChi = false) { // check if the file exists auto filename = gSystem->ExpandPathName(name.c_str()); @@ -44,6 +76,8 @@ FairGenerator* generateEPOS4(const std::string &name, const int& nEvents) } file.close(); auto gen = new GeneratorEPOS4(); + // Set the chi flag + gen->setChiFlag(enableChi); auto ¶m0 = o2::eventgen::GeneratorFileOrCmdParam::Instance(); auto ¶m = o2::eventgen::GeneratorHepMCParam::Instance(); auto &conf = o2::conf::SimConfig::Instance();