ATLAS Offline Software
Loading...
Searching...
No Matches
G4UA::GeantFollower Class Reference

#include <GeantFollower.h>

Inheritance diagram for G4UA::GeantFollower:
Collaboration diagram for G4UA::GeantFollower:

Classes

struct  Config

Public Member Functions

 GeantFollower (const Config &config)
virtual void BeginOfEventAction (const G4Event *) override
virtual void EndOfEventAction (const G4Event *) override
virtual void BeginOfRunAction (const G4Run *) override
virtual void UserSteppingAction (const G4Step *) override

Private Attributes

Config m_config
Trk::IGeantFollowerHelperm_helperPointer

Detailed Description

Definition at line 33 of file GeantFollower.h.

Constructor & Destructor Documentation

◆ GeantFollower()

GeantFollower::GeantFollower ( const Config & config)

Definition at line 25 of file GeantFollower.cxx.

26 : m_config(config)
27 , m_helperPointer(nullptr)
28 {}
Trk::IGeantFollowerHelper * m_helperPointer

Member Function Documentation

◆ BeginOfEventAction()

void GeantFollower::BeginOfEventAction ( const G4Event * )
overridevirtual

Definition at line 30 of file GeantFollower.cxx.

31 {
32 m_helperPointer->beginEvent();
33 }

◆ BeginOfRunAction()

void GeantFollower::BeginOfRunAction ( const G4Run * )
overridevirtual

Definition at line 40 of file GeantFollower.cxx.

41 {
42 if(m_config.helper.retrieve()!=StatusCode::SUCCESS)
43 {
44 G4ExceptionDescription description;
45 description << "Cannot retrieve GeantFollower helper";
46 G4Exception("GeantFollower", "GeantFollower1", FatalException, description);
47 return;
48 }
49
50 m_helperPointer = (&(*m_config.helper));
51 }
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91

◆ EndOfEventAction()

void GeantFollower::EndOfEventAction ( const G4Event * )
overridevirtual

Definition at line 35 of file GeantFollower.cxx.

36 {
37 m_helperPointer->endEvent();
38 }

◆ UserSteppingAction()

void GeantFollower::UserSteppingAction ( const G4Step * aStep)
overridevirtual

Definition at line 53 of file GeantFollower.cxx.

54 {
55 // kill secondaries
56 if (aStep->GetTrack()->GetParentID())
57 {
58 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
59 return;
60 }
61
62 // get the prestep point and follow this guy
63 G4StepPoint * g4PreStep = aStep->GetPreStepPoint();
64 G4ThreeVector g4Momentum = g4PreStep->GetMomentum();
65 const G4ThreeVector& g4Position = g4PreStep->GetPosition();
66
67 G4Track* g4Track = aStep->GetTrack();
68 const G4DynamicParticle* g4DynParticle = g4Track->GetDynamicParticle();
69
70 // the material information
71 const G4TouchableHistory* touchHist = static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
72 if(ATH_LIKELY(touchHist))
73 {
74 // G4LogicalVolume
75 const G4LogicalVolume *lv= touchHist->GetVolume()->GetLogicalVolume();
76 if(ATH_LIKELY(lv))
77 {
78 const G4Material *mat = lv->GetMaterial();
79 // the step information
80 double steplength = aStep->GetStepLength();
81 // the position information
82 double X0 = mat->GetRadlen();
83 // update the track follower
84 m_helperPointer->trackParticle(g4Position,g4Momentum,g4DynParticle->GetPDGcode(),g4DynParticle->GetCharge(),steplength,X0);
85 }
86 else
87 {
88 G4ExceptionDescription description;
89 description << "GeantFollower::SteppingAction NULL G4LogicalVolume pointer.";
90 G4Exception("GeantFollower", "GeantFollower2", FatalException, description);
91 }
92 }
93 else
94 {
95 G4ExceptionDescription description;
96 description << "GeantFollower::SteppingAction NULL G4TouchableHistory pointer.";
97 G4Exception("GeantFollower", "GeantFollower3", FatalException, description);
98 }
99 }
#define ATH_LIKELY(x)

Member Data Documentation

◆ m_config

Config G4UA::GeantFollower::m_config
private

Definition at line 53 of file GeantFollower.h.

◆ m_helperPointer

Trk::IGeantFollowerHelper* G4UA::GeantFollower::m_helperPointer
private

Definition at line 55 of file GeantFollower.h.


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