CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
NewTrackAction Class Reference

#include <NewTrackAction.h>

Public Member Functions

 NewTrackAction ()
 
void primary (const G4Track *aSecondary) const
 
void primary (G4Track *aSecondary) const
 
void secondary (const G4Track *aSecondary, const G4Track &mother, int) const
 
void secondary (G4Track *aSecondary, const G4Track &mother, int) const
 

Private Member Functions

void addUserInfoToPrimary (G4Track *aTrack) const
 
void addUserInfoToSecondary (G4Track *aTrack, const TrackInformation &motherInfo, int) const
 

Detailed Description

SimG4Core Action for new G4tracks. This action is called each time a new G4Track is formed. Since formation (i.e. filling of data members) is done gradually, the best moment to call NewTrackAction is not very clear. Currently done from StackingAction...

Definition at line 14 of file NewTrackAction.h.

Constructor & Destructor Documentation

NewTrackAction::NewTrackAction ( )

Definition at line 12 of file NewTrackAction.cc.

12 {}

Member Function Documentation

void NewTrackAction::addUserInfoToPrimary ( G4Track *  aTrack) const
private

Definition at line 37 of file NewTrackAction.cc.

References TrackInformation::isPrimary(), TrackInformation::putInHistory(), TrackInformation::setGenParticleP(), TrackInformation::setGenParticlePID(), and TrackInformation::storeTrack().

Referenced by primary().

37  {
38  TrackInformation * trkInfo = new TrackInformation();
39  trkInfo->isPrimary(true);
40  trkInfo->storeTrack(true);
41  trkInfo->putInHistory();
42  trkInfo->setGenParticlePID(aTrack->GetDefinition()->GetPDGEncoding());
43  trkInfo->setGenParticleP(aTrack->GetMomentum().mag());
44  aTrack->SetUserInformation(trkInfo);
45 }
bool storeTrack() const
void setGenParticlePID(int id)
void setGenParticleP(double p)
bool isPrimary() const
void NewTrackAction::addUserInfoToSecondary ( G4Track *  aTrack,
const TrackInformation motherInfo,
int  flag 
) const
private

Definition at line 47 of file NewTrackAction.cc.

References TrackInformation::caloSurfaceParticleP(), TrackInformation::caloSurfaceParticlePID(), TrackInformation::genParticleP(), TrackInformation::genParticlePID(), TrackInformation::getIDCaloVolume(), TrackInformation::getIDLastVolume(), TrackInformation::getIDonCaloSurface(), TrackInformation::isPrimary(), TrackInformation::putInHistory(), TrackInformation::setGenParticleP(), TrackInformation::setGenParticlePID(), TrackInformation::setIDonCaloSurface(), and TrackInformation::storeTrack().

Referenced by secondary().

47  {
48 
49  TrackInformation * trkInfo = new TrackInformation();
50 // LogDebug("SimG4CoreApplication") << "NewTrackAction called for "
51 // << aTrack->GetTrackID()
52 // << " mother " << motherInfo.isPrimary()
53 // << " flag " << flag;
54 
55  // Take care of cascade decays
56  if (flag == 1) {
57  trkInfo->isPrimary(true);
58  trkInfo->setGenParticlePID(aTrack->GetDefinition()->GetPDGEncoding());
59  trkInfo->setGenParticleP(aTrack->GetMomentum().mag());
60  } else {
61  trkInfo->setGenParticlePID(motherInfo.genParticlePID());
62  trkInfo->setGenParticleP(motherInfo.genParticleP());
63  }
64 
65  // Store if decay or conversion
66  if (flag > 0) {
67  trkInfo->storeTrack(true);
68  trkInfo->putInHistory();
69  trkInfo->setIDonCaloSurface(aTrack->GetTrackID(),
70  motherInfo.getIDCaloVolume(),
71  motherInfo.getIDLastVolume(),
72  aTrack->GetDefinition()->GetPDGEncoding(),
73  aTrack->GetMomentum().mag());
74  } else {
75  // transfer calo ID from mother (to be checked in TrackingAction)
76  trkInfo->setIDonCaloSurface(motherInfo.getIDonCaloSurface(),
77  motherInfo.getIDCaloVolume(),
78  motherInfo.getIDLastVolume(),
79  motherInfo.caloSurfaceParticlePID(),
80  motherInfo.caloSurfaceParticleP());
81  }
82  aTrack->SetUserInformation(trkInfo);
83 }
long int flag
Definition: mlp_lapack.h:47
bool storeTrack() const
int getIDonCaloSurface() const
double genParticleP() const
void setGenParticlePID(int id)
int getIDCaloVolume() const
int genParticlePID() const
int caloSurfaceParticlePID() const
int getIDLastVolume() const
void setGenParticleP(double p)
bool isPrimary() const
void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p)
double caloSurfaceParticleP() const
void NewTrackAction::primary ( const G4Track *  aSecondary) const

Definition at line 14 of file NewTrackAction.cc.

Referenced by KillSecondariesStackingAction::ClassifyNewTrack(), and StackingAction::ClassifyNewTrack().

14  {
15  primary(const_cast<G4Track *>(aTrack));
16 }
void primary(const G4Track *aSecondary) const
void NewTrackAction::primary ( G4Track *  aSecondary) const

Definition at line 18 of file NewTrackAction.cc.

References addUserInfoToPrimary().

18  {
19  addUserInfoToPrimary(aTrack);
20 }
void addUserInfoToPrimary(G4Track *aTrack) const
void NewTrackAction::secondary ( const G4Track *  aSecondary,
const G4Track &  mother,
int  flag 
) const

Definition at line 22 of file NewTrackAction.cc.

Referenced by KillSecondariesStackingAction::ClassifyNewTrack(), and StackingAction::ClassifyNewTrack().

22  {
23  secondary(const_cast<G4Track *>(aSecondary),mother,flag);
24 }
long int flag
Definition: mlp_lapack.h:47
void secondary(const G4Track *aSecondary, const G4Track &mother, int) const
void NewTrackAction::secondary ( G4Track *  aSecondary,
const G4Track &  mother,
int  flag 
) const

Definition at line 26 of file NewTrackAction.cc.

References addUserInfoToSecondary(), and LogDebug.

26  {
27  if (aSecondary->GetParentID() != mother.GetTrackID())
28  throw SimG4Exception("NewTrackAction: secondary parent ID does not match mother id");
29  TrackInformationExtractor extractor;
30  const TrackInformation & motherInfo(extractor(mother));
31  addUserInfoToSecondary(aSecondary,motherInfo,flag);
32 #ifdef DebugLog
33  LogDebug("SimTrackManager") << "NewTrackAction: Add track " << aSecondary->GetTrackID() << " from mother " << mother.GetTrackID();
34 #endif
35 }
#define LogDebug(id)
long int flag
Definition: mlp_lapack.h:47
void addUserInfoToSecondary(G4Track *aTrack, const TrackInformation &motherInfo, int) const