#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 |
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.
NewTrackAction::NewTrackAction | ( | ) |
Definition at line 12 of file NewTrackAction.cc.
{}
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().
{ TrackInformation * trkInfo = new TrackInformation(); trkInfo->isPrimary(true); trkInfo->storeTrack(true); trkInfo->putInHistory(); trkInfo->setGenParticlePID(aTrack->GetDefinition()->GetPDGEncoding()); trkInfo->setGenParticleP(aTrack->GetMomentum().mag()); aTrack->SetUserInformation(trkInfo); }
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().
{ TrackInformation * trkInfo = new TrackInformation(); // LogDebug("SimG4CoreApplication") << "NewTrackAction called for " // << aTrack->GetTrackID() // << " mother " << motherInfo.isPrimary() // << " flag " << flag; // Take care of cascade decays if (flag == 1) { trkInfo->isPrimary(true); trkInfo->setGenParticlePID(aTrack->GetDefinition()->GetPDGEncoding()); trkInfo->setGenParticleP(aTrack->GetMomentum().mag()); } else { trkInfo->setGenParticlePID(motherInfo.genParticlePID()); trkInfo->setGenParticleP(motherInfo.genParticleP()); } // Store if decay or conversion if (flag > 0) { trkInfo->storeTrack(true); trkInfo->putInHistory(); trkInfo->setIDonCaloSurface(aTrack->GetTrackID(), motherInfo.getIDCaloVolume(), motherInfo.getIDLastVolume(), aTrack->GetDefinition()->GetPDGEncoding(), aTrack->GetMomentum().mag()); } else { // transfer calo ID from mother (to be checked in TrackingAction) trkInfo->setIDonCaloSurface(motherInfo.getIDonCaloSurface(), motherInfo.getIDCaloVolume(), motherInfo.getIDLastVolume(), motherInfo.caloSurfaceParticlePID(), motherInfo.caloSurfaceParticleP()); } aTrack->SetUserInformation(trkInfo); }
void NewTrackAction::primary | ( | G4Track * | aSecondary | ) | const |
Definition at line 18 of file NewTrackAction.cc.
References addUserInfoToPrimary().
{ addUserInfoToPrimary(aTrack); }
void NewTrackAction::primary | ( | const G4Track * | aSecondary | ) | const |
Definition at line 14 of file NewTrackAction.cc.
Referenced by StackingAction::ClassifyNewTrack(), and KillSecondariesStackingAction::ClassifyNewTrack().
{ primary(const_cast<G4Track *>(aTrack)); }
void NewTrackAction::secondary | ( | const G4Track * | aSecondary, |
const G4Track & | mother, | ||
int | flag | ||
) | const |
Definition at line 22 of file NewTrackAction.cc.
Referenced by StackingAction::ClassifyNewTrack(), and KillSecondariesStackingAction::ClassifyNewTrack().
void NewTrackAction::secondary | ( | G4Track * | aSecondary, |
const G4Track & | mother, | ||
int | flag | ||
) | const |
Definition at line 26 of file NewTrackAction.cc.
References addUserInfoToSecondary(), and LogDebug.
{ if (aSecondary->GetParentID() != mother.GetTrackID()) throw SimG4Exception("NewTrackAction: secondary parent ID does not match mother id"); TrackInformationExtractor extractor; const TrackInformation & motherInfo(extractor(mother)); addUserInfoToSecondary(aSecondary,motherInfo,flag); #ifdef DebugLog LogDebug("SimTrackManager") << "NewTrackAction: Add track " << aSecondary->GetTrackID() << " from mother " << mother.GetTrackID(); #endif }