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

#include <GeantFollowerMS.h>

Inheritance diagram for G4UA::GeantFollowerMS:
Collaboration diagram for G4UA::GeantFollowerMS:

Classes

struct  Config

Public Member Functions

 GeantFollowerMS (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::IGeantFollowerMSHelperm_helperPointer

Detailed Description

Definition at line 33 of file GeantFollowerMS.h.

Constructor & Destructor Documentation

◆ GeantFollowerMS()

GeantFollowerMS::GeantFollowerMS ( const Config & config)

Definition at line 25 of file GeantFollowerMS.cxx.

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

Member Function Documentation

◆ BeginOfEventAction()

void GeantFollowerMS::BeginOfEventAction ( const G4Event * )
overridevirtual

Definition at line 30 of file GeantFollowerMS.cxx.

31 {
32 // FIXME: thread-unsafe tool usage in thread-local action? ATLASSIM-3562.
33 m_helperPointer->beginEvent();
34 }

◆ BeginOfRunAction()

void GeantFollowerMS::BeginOfRunAction ( const G4Run * )
overridevirtual

Definition at line 42 of file GeantFollowerMS.cxx.

43 {
44 if(m_config.helper.retrieve()!=StatusCode::SUCCESS) {
45 G4ExceptionDescription description;
46 description << "Cannot retrieve GeantFollowerMS helper";
47 G4Exception("GeantFollowerMS", "GeantFollowerMS1", FatalException, description);
48 return;
49 }
50 m_helperPointer = (&(*m_config.helper));
51
52 if(m_config.trackingGeometrySvc.retrieve()!=StatusCode::SUCCESS) {
53 G4ExceptionDescription description;
54 description << "Cannot retrieve TrackingGeometrySvc in GeantFollowerMS";
55 G4Exception("GeantFollowerMS", "GeantFollowerMS2", FatalException, description);
56 return;
57 }
58
59 }
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:93

◆ EndOfEventAction()

void GeantFollowerMS::EndOfEventAction ( const G4Event * )
overridevirtual

Definition at line 36 of file GeantFollowerMS.cxx.

37 {
38 // FIXME: thread-unsafe tool usage in thread-local action? ATLASSIM-3562.
39 m_helperPointer->endEvent();
40 }

◆ UserSteppingAction()

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

Definition at line 61 of file GeantFollowerMS.cxx.

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

Member Data Documentation

◆ m_config

Config G4UA::GeantFollowerMS::m_config
private

Definition at line 56 of file GeantFollowerMS.h.

◆ m_helperPointer

Trk::IGeantFollowerMSHelper* G4UA::GeantFollowerMS::m_helperPointer
private

Definition at line 58 of file GeantFollowerMS.h.


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