LDMX Software
simcore::UserTrackInformation Class Reference

Provides user defined information to associate with a Geant4 track. More...

#include <UserTrackInformation.h>

Public Member Functions

 UserTrackInformation ()=default
 Constructor.
 
void initialize (const G4Track *track)
 Initialize the track information with the passed track.
 
void Print () const override
 Print the information associated with the track.
 
bool getSaveFlag () const
 Get the flag which indicates whether this track should be saved as a Trajectory.
 
void setSaveFlag (bool saveFlag)
 Set the save flag so the associated track will be persisted as a Trajectory.
 
bool isBremCandidate () const
 Check whether this track is a brem candidate.
 
void tagBremCandidate (bool isBremCandidate=true)
 Tag this track as a brem candidate by the biasing filters.
 
bool isRecoilElectron () const
 Check whether this track is a recoil electron.
 
void tagRecoilElectron (bool isRecoilElectron=true)
 Tag this track as a recoil electron by the biasing filters.
 
bool isPNGamma () const
 Check whether this track is a photon that has undergone a photo-nuclear reaction.
 
void tagPNGamma (bool isPNGamma=true)
 Tag this track as a photon that has undergone a photo-nuclear reaction.
 
const G4ThreeVector & getInitialMomentum () const
 Get the initial momentum 3-vector of the track [MeV].
 
std::string getVertexVolume () const
 Get the name of the volume that this track was created in.
 
double getVertexTime () const
 Get the global time at which this track was created.
 

Static Public Member Functions

static UserTrackInformationget (const G4Track *track)
 get
 

Private Attributes

bool save_flag_ {false}
 Flag for saving the track as a Trajectory.
 
bool is_brem_candidate_ {false}
 Flag indicating whether this track is a brem candidate.
 
bool is_recoil_electron_ {false}
 Flag indicating whether this track is a recoil electron.
 
bool is_pn_gamma_ {false}
 Flag indicating whether this track has undergone a photo-nuclear reaction.
 
std::string vertex_volume_ {""}
 Volume the track was created in.
 
double vertex_time_ {0.}
 Global Time of Creation.
 
G4ThreeVector initial_momentum_
 The initial momentum of the track.
 

Detailed Description

Provides user defined information to associate with a Geant4 track.

This is helpful for keeping track of information we care about that Geant4 doesn't persist by default.

Definition at line 16 of file UserTrackInformation.h.

Member Function Documentation

◆ get()

UserTrackInformation * simcore::UserTrackInformation::get ( const G4Track * track)
static

get

A static helper function for getting the track information from the passed G4Track. If the track doesn't have an information attached, a new one is created.

Note
The return value of this pointer is never NULL.
Parameters
[in]trackG4Track to get information from

Definition at line 10 of file UserTrackInformation.cxx.

10 {
11 if (!track->GetUserInformation()) {
12 const_cast<G4Track*>(track)->SetUserInformation(new UserTrackInformation);
13 }
14 return dynamic_cast<UserTrackInformation*>(track->GetUserInformation());
15}
UserTrackInformation()=default
Constructor.

Referenced by biasing::EcalDarkBremFilter::PostUserTrackingAction(), biasing::utility::DecayChildrenKeeper::PostUserTrackingAction(), biasing::utility::TrackProcessFilter::PostUserTrackingAction(), simcore::g4user::TrackingAction::PostUserTrackingAction(), simcore::g4user::TrackingAction::PreUserTrackingAction(), biasing::MidShowerDiMuonBkgdFilter::save(), biasing::MidShowerNuclearBkgdFilter::save(), simcore::TrackMap::save(), biasing::DeepEcalProcessFilter::stepping(), biasing::EcalProcessFilter::stepping(), biasing::NonFiducialFilter::stepping(), biasing::PhotoNuclearProductsFilter::stepping(), biasing::PhotoNuclearTopologyFilter::stepping(), biasing::TargetBremFilter::stepping(), and biasing::TargetProcessFilter::stepping().

◆ getInitialMomentum()

const G4ThreeVector & simcore::UserTrackInformation::getInitialMomentum ( ) const
inline

Get the initial momentum 3-vector of the track [MeV].

Returns
The initial momentum of the track.

Definition at line 126 of file UserTrackInformation.h.

126{ return initial_momentum_; }
G4ThreeVector initial_momentum_
The initial momentum of the track.

References initial_momentum_.

◆ getSaveFlag()

bool simcore::UserTrackInformation::getSaveFlag ( ) const
inline

Get the flag which indicates whether this track should be saved as a Trajectory.

Returns
The save flag.

Definition at line 59 of file UserTrackInformation.h.

59{ return save_flag_; }
bool save_flag_
Flag for saving the track as a Trajectory.

References save_flag_.

◆ getVertexTime()

double simcore::UserTrackInformation::getVertexTime ( ) const
inline

Get the global time at which this track was created.

Definition at line 136 of file UserTrackInformation.h.

136{ return vertex_time_; }
double vertex_time_
Global Time of Creation.

References vertex_time_.

◆ getVertexVolume()

std::string simcore::UserTrackInformation::getVertexVolume ( ) const
inline

Get the name of the volume that this track was created in.

Definition at line 131 of file UserTrackInformation.h.

131{ return vertex_volume_; }
std::string vertex_volume_
Volume the track was created in.

References vertex_volume_.

◆ initialize()

void simcore::UserTrackInformation::initialize ( const G4Track * track)

Initialize the track information with the passed track.

We assume the passed track is newly created so we can copy its "current" kinematics and define those kinematics to be the "vertex" kinematics.

Even though we are "initializing" the track, we only change the kinematic values. The boolean flags may have been edited prior to the track reaching its own processing phase (where it is initialized), so those flags should (and are) not changed here.

Definition at line 17 of file UserTrackInformation.cxx.

17 {
18 initial_momentum_ = track->GetMomentum();
19 vertex_volume_ = track->GetLogicalVolumeAtVertex()->GetName();
20 vertex_time_ = track->GetGlobalTime();
21}

References initial_momentum_, vertex_time_, and vertex_volume_.

◆ isBremCandidate()

bool simcore::UserTrackInformation::isBremCandidate ( ) const
inline

Check whether this track is a brem candidate.

Returns
True if this track is a brem candidate, false otherwise.

Definition at line 74 of file UserTrackInformation.h.

74{ return is_brem_candidate_; }
bool is_brem_candidate_
Flag indicating whether this track is a brem candidate.

References is_brem_candidate_.

Referenced by tagBremCandidate().

◆ isPNGamma()

bool simcore::UserTrackInformation::isPNGamma ( ) const
inline

Check whether this track is a photon that has undergone a photo-nuclear reaction.

Returns
True if this track is a photon that has undergone a photo-nuclear reaction, false otherwise.

Definition at line 110 of file UserTrackInformation.h.

110{ return is_pn_gamma_; }
bool is_pn_gamma_
Flag indicating whether this track has undergone a photo-nuclear reaction.

References is_pn_gamma_.

Referenced by tagPNGamma().

◆ isRecoilElectron()

bool simcore::UserTrackInformation::isRecoilElectron ( ) const
inline

Check whether this track is a recoil electron.

Returns
true if this track is a recoil electron, false otherwise.

Definition at line 91 of file UserTrackInformation.h.

91{ return is_recoil_electron_; }
bool is_recoil_electron_
Flag indicating whether this track is a recoil electron.

References is_recoil_electron_.

Referenced by tagRecoilElectron().

◆ Print()

void simcore::UserTrackInformation::Print ( ) const
override

Print the information associated with the track.

Definition at line 22 of file UserTrackInformation.cxx.

22 {
23 std::cout << "Saving track: " << save_flag_ << "\n"
24 << "Is brem candidate: " << is_brem_candidate_ << "\n"
25 << std::endl;
26}

References is_brem_candidate_, and save_flag_.

◆ setSaveFlag()

void simcore::UserTrackInformation::setSaveFlag ( bool saveFlag)
inline

Set the save flag so the associated track will be persisted as a Trajectory.

Parameters
[in]saveFlagTrue to save the associated track.

Definition at line 67 of file UserTrackInformation.h.

67{ save_flag_ = saveFlag; }

References save_flag_.

Referenced by biasing::EcalDarkBremFilter::PostUserTrackingAction(), and biasing::utility::DecayChildrenKeeper::PostUserTrackingAction().

◆ tagBremCandidate()

void simcore::UserTrackInformation::tagBremCandidate ( bool isBremCandidate = true)
inline

Tag this track as a brem candidate by the biasing filters.

Parameters
[in]isBremCandidateflag indicating whether this track is a candidate or not.

Definition at line 82 of file UserTrackInformation.h.

82 {
84 }
bool isBremCandidate() const
Check whether this track is a brem candidate.

References is_brem_candidate_, and isBremCandidate().

◆ tagPNGamma()

void simcore::UserTrackInformation::tagPNGamma ( bool isPNGamma = true)
inline

Tag this track as a photon that has undergone a photo-nuclear reaction.

Parameters
[in]isPNGammaflag indicating whether this track has undergone a photo-nuclear reaction or not.

Definition at line 119 of file UserTrackInformation.h.

bool isPNGamma() const
Check whether this track is a photon that has undergone a photo-nuclear reaction.

References is_pn_gamma_, and isPNGamma().

◆ tagRecoilElectron()

void simcore::UserTrackInformation::tagRecoilElectron ( bool isRecoilElectron = true)
inline

Tag this track as a recoil electron by the biasing filters.

Parameters
[in]isRecoilElectronflag indicating whether this track is a recoil electron or not.

Definition at line 99 of file UserTrackInformation.h.

99 {
101 }
bool isRecoilElectron() const
Check whether this track is a recoil electron.

References is_recoil_electron_, and isRecoilElectron().

Member Data Documentation

◆ initial_momentum_

G4ThreeVector simcore::UserTrackInformation::initial_momentum_
private

The initial momentum of the track.

Definition at line 167 of file UserTrackInformation.h.

Referenced by getInitialMomentum(), and initialize().

◆ is_brem_candidate_

bool simcore::UserTrackInformation::is_brem_candidate_ {false}
private

Flag indicating whether this track is a brem candidate.

Definition at line 149 of file UserTrackInformation.h.

149{false};

Referenced by isBremCandidate(), Print(), and tagBremCandidate().

◆ is_pn_gamma_

bool simcore::UserTrackInformation::is_pn_gamma_ {false}
private

Flag indicating whether this track has undergone a photo-nuclear reaction.

Definition at line 158 of file UserTrackInformation.h.

158{false};

Referenced by isPNGamma(), and tagPNGamma().

◆ is_recoil_electron_

bool simcore::UserTrackInformation::is_recoil_electron_ {false}
private

Flag indicating whether this track is a recoil electron.

Definition at line 152 of file UserTrackInformation.h.

152{false};

Referenced by isRecoilElectron(), and tagRecoilElectron().

◆ save_flag_

bool simcore::UserTrackInformation::save_flag_ {false}
private

Flag for saving the track as a Trajectory.

Default value is false because we want to save space in the output file. We assume everywhere else that the save flag is false unless some other part changes it.

Definition at line 146 of file UserTrackInformation.h.

146{false};

Referenced by getSaveFlag(), Print(), and setSaveFlag().

◆ vertex_time_

double simcore::UserTrackInformation::vertex_time_ {0.}
private

Global Time of Creation.

Definition at line 164 of file UserTrackInformation.h.

164{0.};

Referenced by getVertexTime(), and initialize().

◆ vertex_volume_

std::string simcore::UserTrackInformation::vertex_volume_ {""}
private

Volume the track was created in.

Definition at line 161 of file UserTrackInformation.h.

161{""};

Referenced by getVertexVolume(), and initialize().


The documentation for this class was generated from the following files: