G4Helper: store the index of the true particle within MCTruth in the primary particle information
g4b::ConvertMCTruthToG4 to convert the particle content of
simb::MCTruth into a list of particles to be fed to Geant4.
The converter saves extra information for each of these "primary" particles in
g4b::PrimaryParticleInformation instances, in particular the
simb::MCTruth it comes from, and the index of the MCTruth in the list. The information of which particle that is within that
simb::MCTruth is lost.
I would like the information of which particle it was to be retained.
Merge tag 'v1_12_01' into develop
nusimdata/SimulationBase/simb.h for #18716 v1_12_01
#1 Updated by Gianluca Petrillo almost 3 years ago
If the maintainers of nutools agree, I can implement this feature.
The idea would be simply to add a data member
std::size_t g4b::PrimaryParticleInformation::fMCParticleIndex (with accessor etc.) and have
g4b::ConvertMCTruthToG4::GeneratePrimaries() fill it with the already available value (variable
p in the current code: source:nutools/G4Base/ConvertMCTruthToG4.cxx#L116).
#4 Updated by Gianluca Petrillo almost 3 years ago
You are correct in your recollection.
That object is bound by
g4b::G4Helper to the primary particle given to Geant4 for propagation. LArSoft (`LArG4`) can access that object when creating a new
preTrackingAction() hook) and save its information at the same time as the
simb::MCParticle itself. That information will be used at the end of `LArG4` module
produce() method to create an additional data product (an association, see issue #17804#note-7).