ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 23 of file ActsGeantFollower.cxx.

23 {}

Member Function Documentation

◆ BeginOfEventAction()

void ActsGeantFollower::BeginOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 25 of file ActsGeantFollower.cxx.

26 {
27  m_helper->beginEvent();
28 }

◆ BeginOfRunAction()

void ActsGeantFollower::BeginOfRunAction ( const G4Run *  )
overridevirtual

Definition at line 35 of file ActsGeantFollower.cxx.

36 {
37  if(m_helper.retrieve()!=StatusCode::SUCCESS)
38  {
39  G4ExceptionDescription description;
40  description << "Cannot retrieve ActsGeantFollower helper";
41  G4Exception("ActsGeantFollower", "ActsGeantFollower1", FatalException, description);
42  return;
43  }
44  return;
45 }

◆ EndOfEventAction()

void ActsGeantFollower::EndOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 30 of file ActsGeantFollower.cxx.

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

◆ UserSteppingAction()

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

Definition at line 47 of file ActsGeantFollower.cxx.

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

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:
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
ActsGeantFollower::m_helper
ToolHandle< IActsGeantFollowerHelper > m_helper
Definition: ActsGeantFollower.h:34
pdg_comparison.X0
X0
Definition: pdg_comparison.py:314
ATH_LIKELY
#define ATH_LIKELY(x)
Definition: AthUnlikelyMacros.h:16
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88