diff --git a/DataFormats/simulation/include/SimulationDataFormat/O2DatabasePDG.h b/DataFormats/simulation/include/SimulationDataFormat/O2DatabasePDG.h index e369142c3cad4..68d03aa3e260e 100644 --- a/DataFormats/simulation/include/SimulationDataFormat/O2DatabasePDG.h +++ b/DataFormats/simulation/include/SimulationDataFormat/O2DatabasePDG.h @@ -344,7 +344,7 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa ionCode = -1010010030; if (!db->GetParticle(ionCode)) { db->AddParticle("AntiHyperTriton", "AntiHyperTriton", 2.991134, kFALSE, - 2.5e-15, 3, "Ion", ionCode); + 2.5e-15, -3, "Ion", ionCode); } //hyper hydrogen 4 ground state @@ -357,7 +357,7 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa ionCode = -1010010040; if (!db->GetParticle(ionCode)) { db->AddParticle("AntiHyperhydrog4", "AntiHyperhydrog4", 3.922434, kFALSE, - 2.5e-15, 3, "Ion", ionCode); + 2.5e-15, -3, "Ion", ionCode); } //hyper helium 4 ground state ionCode = 1010020040; @@ -369,7 +369,7 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa ionCode = -1010020040; if (!db->GetParticle(ionCode)) { db->AddParticle("AntiHyperhelium4", "AntiHyperhelium4", 3.921728, kFALSE, - 2.5e-15, 6, "Ion", ionCode); + 2.5e-15, -6, "Ion", ionCode); } // Lithium 4 ground state @@ -394,7 +394,7 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa ionCode = -1010020050; if (!db->GetParticle(ionCode)) { db->AddParticle("AntiHyperhelium5", "AntiHyperhelium5", 4.839961, kFALSE, - 2.5e-15, 6, "Ion", ionCode); + 2.5e-15, -6, "Ion", ionCode); } ionCode = 1020010040; diff --git a/Detectors/gconfig/g4Config.C b/Detectors/gconfig/g4Config.C index 2dc6af4947c13..0b5b0cd110d2b 100644 --- a/Detectors/gconfig/g4Config.C +++ b/Detectors/gconfig/g4Config.C @@ -80,6 +80,7 @@ R__LOAD_LIBRARY(libgeant4vmc) #include "G4UImanager.hh" #include "G4RegionStore.hh" #include "G4ProductionCuts.hh" +#include "G4HadronicParameters.hh" #endif #include "commonConfig.C" @@ -184,6 +185,11 @@ void Config() const char* nthreads = getenv("ALICE_NSIMWORKERS"); setenv("G4FORCENUMBEROFTHREADS", nthreads ? nthreads : "1", 1); } + // Geant4 gives its light hypernuclei and their antiparticles (3LH, 4LH, 4LHe, 5LHe, ...) + // ionisation, multiple scattering and hadronic interactions only when enabled; otherwise they + // cross the detectors without depositing energy. It must be set before the physics is built. + G4HadronicParameters::Instance()->SetEnableHyperNuclei(true); + /// Create the G4 VMC TGeant4* geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration); std::cout << "Geant4 has been created." << std::endl; diff --git a/Steer/include/Steer/O2MCApplicationBase.h b/Steer/include/Steer/O2MCApplicationBase.h index 42c39c1275777..6a07292be51f8 100644 --- a/Steer/include/Steer/O2MCApplicationBase.h +++ b/Steer/include/Steer/O2MCApplicationBase.h @@ -67,6 +67,7 @@ class O2MCApplicationBase : public FairMCApplication void InitGeometry() override; bool MisalignGeometry() override; void AddParticles() override; + void AddIons() override; // specific implementation of our hard geometry limits double TrackingRmax() const override { return mCutParams.maxRTracking; } diff --git a/Steer/src/O2MCApplication.cxx b/Steer/src/O2MCApplication.cxx index 8db7dd3c54b12..f9227ed960746 100644 --- a/Steer/src/O2MCApplication.cxx +++ b/Steer/src/O2MCApplication.cxx @@ -1814,6 +1814,29 @@ void addSpecialParticles() TVirtualMC::GetMC()->DefineParticle(-4120000, "AntiMonopole_asymm", kPTUndefined, monopoleMass, 0.0, 1e10, "BSM", 0.0, 0, 0, 0, 0, 0, 0, 0, 0, kTRUE); } +void O2MCApplicationBase::AddIons() +{ + // dispatch first to function in FairRoot + FairMCApplication::AddIons(); + + // Geant4 VMC looks a primary up in Geant4's particle table, which holds d, t, 3He and alpha from + // the start but a heavier ion only once it is created (by Z and A); an unknown primary is + // skipped. These are the stable ions beyond alpha that generators make (coalescence, + // injection). Only for Geant4: Geant3's DefineIon gives an ion already in TDatabasePDG a new + // isomer code. + if (std::strcmp(TVirtualMC::GetMC()->GetName(), "TGeant4") != 0) { + return; + } + struct Ion { + const char* name; // TDatabasePDG's: Geant4 VMC finds the ion's charge by the particle's name + int z; + int a; + }; + for (const auto& ion : {Ion{"Li6", 3, 6}, Ion{"Li7", 3, 7}}) { + TVirtualMC::GetMC()->DefineIon(ion.name, ion.z, ion.a, ion.z, 0., 0.); + } +} + void O2MCApplicationBase::AddParticles() { // dispatch first to function in FairRoot