Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion MC/config/examples/epos4/generator_EPOS4.C
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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());
Expand All @@ -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 &param0 = o2::eventgen::GeneratorFileOrCmdParam::Instance();
auto &param = o2::eventgen::GeneratorHepMCParam::Instance();
auto &conf = o2::conf::SimConfig::Instance();
Expand Down