|
Celeritas 0.7-develop+980877a
|
Manage track information for reconstruction. More...
#include <GeantTrackReconstruction.hh>
Public Types | |
Type aliases | |
| using | VecParticle = std::vector< G4ParticleDefinition const * > |
| using | SPStep = std::shared_ptr< G4Step > |
| using | EventIdGetter = int(*)() |
Public Member Functions | |
| GeantTrackReconstruction (VecParticle const &, SPStep) | |
| Construct with particle definitions for track reconstruction. | |
| ~GeantTrackReconstruction () | |
| Unset the user information for all tracks. | |
| GeantTrackReconstruction (GeantTrackReconstruction const &)=delete | |
| GeantTrackReconstruction & | operator= (GeantTrackReconstruction const &)=delete |
| GeantTrackReconstruction (GeantTrackReconstruction &&)=default | |
| GeantTrackReconstruction & | operator= (GeantTrackReconstruction &&)=default |
| void | clear () |
| Clear G4Track reconstruction data. | |
| PrimaryId | acquire (G4Track &) |
| Register mapping from Celeritas PrimaryID to Geant4 TrackID. | |
| void | init_event () |
| At the start of an event, reset the primary ID counter. | |
| G4Track & | view (ParticleId particle, PrimaryId primary, TrackId track, TrackId parent, size_type generation) const |
| Restore the Geant4 identity of any Celeritas track. | |
| G4VProcess const & | placeholder_process () const |
| Creator process reported for tracks created by Celeritas. | |
Static Public Member Functions | |
| static SPStep | make_g4step () |
| Allocate and initialize a valid Geant4 step object. | |
| static int | geant_track_id (TrackId) |
| Geant4 track ID of a track created by Celeritas. | |
Static Public Attributes | |
| static EventIdGetter | get_current_event_id {nullptr} |
| Event ID function pointer for unit testing when CELERITAS_DEBUG. | |
Manage track information for reconstruction.
This class handles the bookkeeping of Geant4 track information needed to reconstruct tracks during hit processing. It maintains mappings between Celeritas PrimaryID and Geant4 track data.
init_event acquire (multiple times)view (may be interleaved with acquire)clear (once all active tracks are used up)acquire , whatever their values. A track created by Celeritas has its own Geant4 identity, which never refers to the information of its offloaded ancestor:geant_track_id of its Celeritas track ID,SimTrackView::generation ), and otherwise the mapped ID of its Celeritas parent,A track that Geant4 offloads again after Celeritas handed it back is a new primary: it keeps the Geant4 ID it had, and its secondaries refer to it.
acquire until clear . | celeritas::GeantTrackReconstruction::GeantTrackReconstruction | ( | VecParticle const & | particles, |
| SPStep | step | ||
| ) |
Construct with particle definitions for track reconstruction.
This must be constructed on the thread that uses it. The placeholder creator process registers itself with that thread's Geant4 process table, which owns it and deletes it when Geant4 clears its thread-local state.
Register mapping from Celeritas PrimaryID to Geant4 TrackID.
This will take ownership of the G4VUserTrackInformation and unset it in the primary track.
| void celeritas::GeantTrackReconstruction::clear | ( | ) |
Clear G4Track reconstruction data.
This should be done when all Celeritas tracks have been completed, since afterward it will be impossible to reconstruct them.
The primary ID offset is saved to ensure consistency when flushing before an event is complete.
Geant4 track ID of a track created by Celeritas.
Celeritas track IDs are unique within an event and start at zero for each event. Like AdePT, they are mapped to Geant4 IDs counting down from the largest integer, so that they never collide with the IDs that Geant4 assigns in increasing order.
| void celeritas::GeantTrackReconstruction::init_event | ( | ) |
At the start of an event, reset the primary ID counter.
clear command.
|
static |
Allocate and initialize a valid Geant4 step object.
The allocation is done like G4SteppingManager constructor but we reset values to invalid ones.
| G4Track & celeritas::GeantTrackReconstruction::view | ( | ParticleId | particle_id, |
| PrimaryId | primary_id, | ||
| TrackId | track_id, | ||
| TrackId | parent_id, | ||
| size_type | generation | ||
| ) | const |
Restore the Geant4 identity of any Celeritas track.
A primary (generation 0) is the offloaded Geant4 track and is restored with its saved information. A track created by Celeritas is given its own identity (see the class documentation).
|
static |
Event ID function pointer for unit testing when CELERITAS_DEBUG.
When constructing a class instance, if the function pointer is null, it will be set to a function that gets the Geant4 event manager's active event.