LDMX Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
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 saveFlag_ {false}
 Flag for saving the track as a Trajectory.
 
bool isBremCandidate_ {false}
 Flag indicating whether this track is a brem candidate.
 
bool isRecoilElectron_ {false}
 Flag indicating whether this track is a recoil electron.
 
bool isPNGamma_ {false}
 Flag indicating whether this track has undergone a photo-nuclear reaction.
 
std::string vertexVolume_ {""}
 Volume the track was created in.
 
double vertex_time_ {0.}
 Global Time of Creation.
 
G4ThreeVector initialMomentum_
 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 simcore::g4user::TrackingAction::PostUserTrackingAction(), biasing::EcalDarkBremFilter::PostUserTrackingAction(), biasing::utility::DecayChildrenKeeper::PostUserTrackingAction(), biasing::utility::TrackProcessFilter::PostUserTrackingAction(), simcore::g4user::TrackingAction::PreUserTrackingAction(), simcore::TrackMap::save(), biasing::MidShowerDiMuonBkgdFilter::save(), biasing::MidShowerNuclearBkgdFilter::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 initialMomentum_; }
G4ThreeVector initialMomentum_
The initial momentum of the track.

References initialMomentum_.

Referenced by simcore::TrackMap::save().

◆ 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 saveFlag_; }
bool saveFlag_
Flag for saving the track as a Trajectory.

References saveFlag_.

◆ 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 vertexVolume_; }
std::string vertexVolume_
Volume the track was created in.

References vertexVolume_.

◆ 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 initialMomentum_ = track->GetMomentum();
19 vertexVolume_ = track->GetLogicalVolumeAtVertex()->GetName();
20 vertex_time_ = track->GetGlobalTime();
21}

References initialMomentum_, vertex_time_, and vertexVolume_.

Referenced by simcore::g4user::TrackingAction::PreUserTrackingAction().

◆ 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 isBremCandidate_; }
bool isBremCandidate_
Flag indicating whether this track is a brem candidate.

References isBremCandidate_.

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 isPNGamma_; }
bool isPNGamma_
Flag indicating whether this track has undergone a photo-nuclear reaction.

References isPNGamma_.

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 isRecoilElectron_; }
bool isRecoilElectron_
Flag indicating whether this track is a recoil electron.

References isRecoilElectron_.

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: " << saveFlag_ << "\n"
24 << "Is brem candidate: " << isBremCandidate_ << "\n"
25 << std::endl;
26}

References isBremCandidate_, and saveFlag_.

◆ 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{ saveFlag_ = saveFlag; }

References saveFlag_.

Referenced by biasing::EcalDarkBremFilter::PostUserTrackingAction(), biasing::utility::DecayChildrenKeeper::PostUserTrackingAction(), biasing::utility::TrackProcessFilter::PostUserTrackingAction(), biasing::MidShowerDiMuonBkgdFilter::save(), and biasing::MidShowerNuclearBkgdFilter::save().

◆ 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 isBremCandidate(), and isBremCandidate_.

Referenced by biasing::DeepEcalProcessFilter::stepping(), biasing::EcalProcessFilter::stepping(), and biasing::TargetBremFilter::stepping().

◆ 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 isPNGamma(), and isPNGamma_.

Referenced by biasing::PhotoNuclearProductsFilter::stepping(), and biasing::PhotoNuclearTopologyFilter::stepping().

◆ 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 isRecoilElectron(), and isRecoilElectron_.

Referenced by biasing::NonFiducialFilter::stepping().

Member Data Documentation

◆ initialMomentum_

G4ThreeVector simcore::UserTrackInformation::initialMomentum_
private

The initial momentum of the track.

Definition at line 167 of file UserTrackInformation.h.

Referenced by getInitialMomentum(), and initialize().

◆ isBremCandidate_

bool simcore::UserTrackInformation::isBremCandidate_ {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().

◆ isPNGamma_

bool simcore::UserTrackInformation::isPNGamma_ {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().

◆ isRecoilElectron_

bool simcore::UserTrackInformation::isRecoilElectron_ {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().

◆ saveFlag_

bool simcore::UserTrackInformation::saveFlag_ {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().

◆ vertexVolume_

std::string simcore::UserTrackInformation::vertexVolume_ {""}
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: