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 24 of file GeantFollower.cxx.

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

Member Function Documentation

◆ BeginOfEventAction()

void GeantFollower::BeginOfEventAction ( const G4Event * )
overridevirtual

Definition at line 29 of file GeantFollower.cxx.

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

◆ BeginOfRunAction()

void GeantFollower::BeginOfRunAction ( const G4Run * )
overridevirtual

Definition at line 39 of file GeantFollower.cxx.

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

◆ EndOfEventAction()

void GeantFollower::EndOfEventAction ( const G4Event * )
overridevirtual

Definition at line 34 of file GeantFollower.cxx.

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

◆ UserSteppingAction()

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

Definition at line 52 of file GeantFollower.cxx.

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