ATLAS Offline Software
Loading...
Searching...
No Matches
ActsGeantFollower Class Reference

#include <ActsGeantFollower.h>

Inheritance diagram for ActsGeantFollower:
Collaboration diagram for ActsGeantFollower:

Public Member Functions

 ActsGeantFollower ()
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

ToolHandle< IActsGeantFollowerHelperm_helper

Detailed Description

Definition at line 21 of file ActsGeantFollower.h.

Constructor & Destructor Documentation

◆ ActsGeantFollower()

ActsGeantFollower::ActsGeantFollower ( )

Definition at line 22 of file ActsGeantFollower.cxx.

22{}

Member Function Documentation

◆ BeginOfEventAction()

void ActsGeantFollower::BeginOfEventAction ( const G4Event * )
overridevirtual

Definition at line 24 of file ActsGeantFollower.cxx.

25{
26 m_helper->beginEvent();
27}
ToolHandle< IActsGeantFollowerHelper > m_helper

◆ BeginOfRunAction()

void ActsGeantFollower::BeginOfRunAction ( const G4Run * )
overridevirtual

Definition at line 34 of file ActsGeantFollower.cxx.

35{
36 if(m_helper.retrieve()!=StatusCode::SUCCESS)
37 {
38 G4ExceptionDescription description;
39 description << "Cannot retrieve ActsGeantFollower helper";
40 G4Exception("ActsGeantFollower", "ActsGeantFollower1", FatalException, description);
41 return;
42 }
43 return;
44}
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:93

◆ EndOfEventAction()

void ActsGeantFollower::EndOfEventAction ( const G4Event * )
overridevirtual

Definition at line 29 of file ActsGeantFollower.cxx.

30{
31 m_helper->endEvent();
32}

◆ UserSteppingAction()

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

Definition at line 46 of file ActsGeantFollower.cxx.

47{
48 // kill secondaries and low momentum particles
49 if (aStep->GetTrack()->GetParentID() || aStep->GetPreStepPoint()->GetMomentum().mag()<500 )
50 {
51 std::cout << "low pt" << std::endl;
52 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
53 return;
54 }
55
56 // kill Particles outiside the tracking volume
57 if (aStep->GetPreStepPoint()->GetPosition().z()>3000 || sqrt(aStep->GetPreStepPoint()->GetPosition().x()*aStep->GetPreStepPoint()->GetPosition().x()+aStep->GetPreStepPoint()->GetPosition().y()*aStep->GetPreStepPoint()->GetPosition().y())>1050 )
58 {
59 std::cout << "out" << std::endl;
60 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
61 return;
62 }
63
64 // get the prestep point and follow this guy
65 G4StepPoint * g4PreStep = aStep->GetPreStepPoint();
66 G4ThreeVector g4Momentum = g4PreStep->GetMomentum();
67 G4ThreeVector g4Position = g4PreStep->GetPosition();
68
69 G4Track* g4Track = aStep->GetTrack();
70 const G4DynamicParticle* g4DynParticle = g4Track->GetDynamicParticle();
71
72 // the material information
73 const G4TouchableHistory* touchHist = static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
74 if(touchHist) [[likely]]
75 {
76 // G4LogicalVolume
77 const G4LogicalVolume *lv= touchHist->GetVolume()->GetLogicalVolume();
78 if(lv) [[likely]]
79 {
80 const G4Material *mat = lv->GetMaterial();
81 // the step information
82 double steplength = aStep->GetStepLength();
83 // the position information
84 double X0 = mat->GetRadlen();
85 // update the track follower when a sensor is encountered
86 // bool isSensitive = (lv->GetSensitiveDetector() != nullptr);
87 bool isSensitive = true;
88 m_helper->trackParticle(g4Position, g4Momentum, g4DynParticle->GetPDGcode(), g4DynParticle->GetCharge(), steplength, X0, isSensitive);
89
90 }
91 else
92 {
93 G4ExceptionDescription description;
94 description << "ActsGeantFollower::SteppingAction NULL G4LogicalVolume pointer.";
95 G4Exception("ActsGeantFollower", "ActsGeantFollower2", FatalException, description);
96 }
97 }
98 else
99 {
100 G4ExceptionDescription description;
101 description << "ActsGeantFollower::SteppingAction NULL G4TouchableHistory pointer.";
102 G4Exception("ActsGeantFollower", "ActsGeantFollower3", FatalException, description);
103 }
104 return;
105}
#define likely(x)

Member Data Documentation

◆ m_helper

ToolHandle<IActsGeantFollowerHelper> ActsGeantFollower::m_helper
private
Initial value:
=
ToolHandle<IActsGeantFollowerHelper>("ActsGeantFollowerHelper")

Definition at line 34 of file ActsGeantFollower.h.


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