@@ -9,6 +9,38 @@ class GeneratorEPOS4 : public o2::eventgen::GeneratorHepMC
99 GeneratorEPOS4 () = default ;
1010 ~GeneratorEPOS4 () = default ;
1111
12+ bool importParticles () override {
13+ bool status = GeneratorHepMC ::importParticles ();
14+ if (!status ) {
15+ LOG (error ) << "Failed to import particles from HepMC event!" ;
16+ return false;
17+ }
18+ // Remove charmonia chi_0c and chi_1c from the particles list (incompatible with default G4 physics list)
19+ // These are not decayed by EPOS4 (no daughters)
20+ if (!mEnChi )
21+ {
22+ for (int a = 0 ; a < mParticles .size (); ++ a ) {
23+ if (mParticles [a ].GetPdgCode () == 10441 || mParticles [a ].GetPdgCode () == 20443 )
24+ {
25+ LOG (debug ) << "Removing charmonium state " << mParticles [a ].GetPdgCode () << " from particles list" ;
26+ mParticles .erase (mParticles .begin () + a );
27+ -- a ; // Adjust index after erasing
28+ }
29+ }
30+ }
31+ return true;
32+ }
33+
34+ void setChiFlag (bool & flag ) {
35+ mEnChi = flag ;
36+ if (!flag ) {
37+ LOG (info ) << "Charmonium states chi_0c and chi_1c will be removed from the particles list" ;
38+ }
39+ }
40+
41+ private :
42+ bool mEnChi = false; // Switch to enable chi_0c and chi_1c mesons
43+
1244};
1345
1446// 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
1951// type for the nfull parameter. Might be changed in the future.
2052// When running locally, or on the GRID (not in hyperloop), the default parameters provided in the .ini file of the
2153// external generation can be overwritten using the confKeyValues option (or similar depending on the tool used).
22- FairGenerator * generateEPOS4 (const std ::string & name , const int & nEvents )
54+ FairGenerator * generateEPOS4 (const std ::string & name , const int & nEvents , bool enableChi = false )
2355{
2456 // check if the file exists
2557 auto filename = gSystem -> ExpandPathName (name .c_str ());
@@ -44,6 +76,8 @@ FairGenerator* generateEPOS4(const std::string &name, const int& nEvents)
4476 }
4577 file .close ();
4678 auto gen = new GeneratorEPOS4 ();
79+ // Set the chi flag
80+ gen -> setChiFlag (enableChi );
4781 auto & param0 = o2 ::eventgen ::GeneratorFileOrCmdParam ::Instance ();
4882 auto & param = o2 ::eventgen ::GeneratorHepMCParam ::Instance ();
4983 auto & conf = o2 ::conf ::SimConfig ::Instance ();
0 commit comments