allpix::TrackInfoManager
The TrackInfoManager is a factory for TrackInfoG4 objects and manages MCTracks within AP2.
#include <TrackInfoManager.hpp>
Public Functions
Name | |
---|---|
TrackInfoManager(bool record_all) Default constructor. |
|
std::unique_ptr< TrackInfoG4 > | makeTrackInfo(const G4Track *const track) Factory method for TrackInfoG4 instances. |
void | storeTrackInfo(std::unique_ptr< TrackInfoG4 > the_track_info) Will take a MCTrack and attempt to store it. |
void | setTrackInfoToBeStored(int track_id) Will register a track id to be stored. |
void | resetTrackInfoManager() Reset of the TrackInfoManager instance. |
void | dispatchMessage(Module * module, Messenger * messenger, Event * event) Dispatch the stored tracks as a MCTrackMessage. |
void | createMCTracks() Populate the stored_tracks_ with MCTrack objects. |
MCTrack const * | findMCTrack(int track_id) const Returns a pointer to the MCTrack object in the stored_tracks_ or a nullptr if not found. |
Public Functions Documentation
function TrackInfoManager
explicit TrackInfoManager(
bool record_all
)
Default constructor.
function makeTrackInfo
std::unique_ptr< TrackInfoG4 > makeTrackInfo(
const G4Track *const track
)
Factory method for TrackInfoG4 instances.
Parameters:
- track A pointer to the G4Track for which the TrackInfoG4 is used
Return: unique_ptr holding the TrackInfoG4
This factory method will take care that it will only assign every track id once for this TrackInfoManager instance, until reset
function storeTrackInfo
void storeTrackInfo(
std::unique_ptr< TrackInfoG4 > the_track_info
)
Will take a MCTrack and attempt to store it.
Parameters:
- the_track_info The MCTrack to be (possibly) stored
See: setTrackInfoToBeStored), otherwise deleted
It will be stored if it was registered to be stored (
function setTrackInfoToBeStored
void setTrackInfoToBeStored(
int track_id
)
Will register a track id to be stored.
Parameters:
- track_id The id of the track to be stored
See: storeTrackInfo once finished
The track itself will have to be provided via
function resetTrackInfoManager
void resetTrackInfoManager()
Reset of the TrackInfoManager instance.
This will reset the track id counter, the tracks which are registered to be stored and the already stored tracks, regardless if they have been dispatched or not. Make sure to call dispatchMessage before if the tracks should be dispatched
function dispatchMessage
void dispatchMessage(
Module * module,
Messenger * messenger,
Event * event
)
Dispatch the stored tracks as a MCTrackMessage.
Parameters:
- module The module which is responsible for dispatching the message
- messenger The messenger used to dispatch it
- event The event to dispatch the message to
function createMCTracks
void createMCTracks()
Populate the stored_tracks_ with MCTrack objects.
Warning: Must only be called once Geant4 finished stepping through all the G4Track objects guaranteed
function findMCTrack
MCTrack const * findMCTrack(
int track_id
) const
Returns a pointer to the MCTrack object in the stored_tracks_ or a nullptr if not found.
Parameters:
- track_id The id of the track for which to retrieve the pointer
Return: Const pointer to the MCTrack object or a nullptr if track_id is not found
Warning: Results are invalidated by any reallocation iof the internal stored_tracks_ vector
Updated on 2024-12-13 at 08:31:36 +0000