Geant4  10.02.p03
MCTruthTrackingAction Class Reference

#include <MCTruthTrackingAction.hh>

Inheritance diagram for MCTruthTrackingAction:
Collaboration diagram for MCTruthTrackingAction:

Public Member Functions

 MCTruthTrackingAction ()
 
virtual ~MCTruthTrackingAction ()
 
void PreUserTrackingAction (const G4Track *)
 
void PostUserTrackingAction (const G4Track *)
 
- Public Member Functions inherited from G4UserTrackingAction
 G4UserTrackingAction ()
 
virtual ~G4UserTrackingAction ()
 
void SetTrackingManagerPointer (G4TrackingManager *pValue)
 

Private Member Functions

G4bool trackToBeStored (const G4Track *)
 

Private Attributes

G4LorentzVector fmom
 

Additional Inherited Members

- Protected Attributes inherited from G4UserTrackingAction
G4TrackingManagerfpTrackingManager
 

Detailed Description

Definition at line 47 of file MCTruthTrackingAction.hh.

Constructor & Destructor Documentation

◆ MCTruthTrackingAction()

MCTruthTrackingAction::MCTruthTrackingAction ( )

Definition at line 49 of file MCTruthTrackingAction.cc.

50 {}

◆ ~MCTruthTrackingAction()

MCTruthTrackingAction::~MCTruthTrackingAction ( )
virtual

Definition at line 52 of file MCTruthTrackingAction.cc.

53 {}

Member Function Documentation

◆ PostUserTrackingAction()

void MCTruthTrackingAction::PostUserTrackingAction ( const G4Track *  track)
virtual

Reimplemented from G4UserTrackingAction.

Definition at line 66 of file MCTruthTrackingAction.cc.

67 {
68 
69  G4LorentzVector prodpos(track->GetGlobalTime() - track->GetLocalTime(),
70  track->GetVertexPosition());
71  G4LorentzVector endpos(track->GetGlobalTime(), track->GetPosition());
72 
73  // here (?) make all different checks to decide whether to store the particle
74  //
76  {
78  (MCTruthTrackInformation*) track->GetUserInformation();
79 
81  AddParticle(fmom, prodpos, endpos,
82  track->GetDefinition()->GetPDGEncoding(),
83  track->GetTrackID(),
84  track->GetParentID(), mcinf->GetDirectParent());
85  }
86  else
87  {
88  // If track is not to be stored, propagate it's parent ID (stored)
89  // to its secondaries
90  //
91  G4TrackVector* childrens = fpTrackingManager->GimmeSecondaries() ;
92 
93  for( unsigned int index = 0 ; index < childrens->size() ; ++index )
94  {
95  G4Track* tr = (*childrens)[index] ;
96  tr->SetParentID( track->GetParentID() );
97 
98  // set the flag saying that the direct mother is not stored
99  //
100  MCTruthTrackInformation* mcinf =
101  (MCTruthTrackInformation*) tr->GetUserInformation();
102  if(!mcinf)
103  tr->SetUserInformation(mcinf = new MCTruthTrackInformation);
104 
105  mcinf->SetDirectParent(false);
106  }
107  }
108 }
G4TrackVector * GimmeSecondaries() const
G4TrackingManager * fpTrackingManager
static MCTruthManager * GetInstance()
Int_t index
G4bool trackToBeStored(const G4Track *)
void SetDirectParent(G4bool value)
Here is the call graph for this function:

◆ PreUserTrackingAction()

void MCTruthTrackingAction::PreUserTrackingAction ( const G4Track *  track)
virtual

Reimplemented from G4UserTrackingAction.

Definition at line 55 of file MCTruthTrackingAction.cc.

56 {
57  fmom = G4LorentzVector(track->GetMomentum(), track->GetTotalEnergy());
58 
59  if(!track->GetUserInformation())
60  {
61  G4VUserTrackInformation* mcinf = new MCTruthTrackInformation;
63  }
64 }
G4TrackingManager * fpTrackingManager
void SetUserTrackInformation(G4VUserTrackInformation *aValue)
CLHEP::HepLorentzVector G4LorentzVector
Here is the call graph for this function:

◆ trackToBeStored()

G4bool MCTruthTrackingAction::trackToBeStored ( const G4Track *  track)
private

Definition at line 110 of file MCTruthTrackingAction.cc.

111 {
113 
114  // check energy
115  if (fmom.e() > config->GetMinE()) return true;
116 
117  // particle type
118  std::vector<G4int> types = config->GetParticleTypes();
119 
120  if(std::find( types.begin(), types.end(),
121  track->GetDefinition()->GetPDGEncoding())
122  != types.end()) return true;
123 
124  // creator process
125 
126  // etc...
127 
128  return false;
129 }
static MCTruthManager * GetInstance()
MCTruthConfig * GetConfig() const
std::vector< G4int > & GetParticleTypes()
G4double GetMinE() const
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fmom

G4LorentzVector MCTruthTrackingAction::fmom
private

Definition at line 60 of file MCTruthTrackingAction.hh.


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