ATLAS Offline Software
Classes | Public Member Functions | Private Attributes | List of all members
G4UA::EnergyLossRecorder Class Reference

#include <EnergyLossRecorder.h>

Inheritance diagram for G4UA::EnergyLossRecorder:
Collaboration diagram for G4UA::EnergyLossRecorder:

Classes

struct  Config
 

Public Member Functions

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

Private Attributes

Config m_config
 
unsigned int m_entries
 

Detailed Description

Definition at line 39 of file EnergyLossRecorder.h.

Constructor & Destructor Documentation

◆ EnergyLossRecorder()

EnergyLossRecorder::EnergyLossRecorder ( const Config config)

Definition at line 24 of file EnergyLossRecorder.cxx.

25  : m_config(config)
26  , m_entries(0)
27  {
28 
29  }

Member Function Documentation

◆ BeginOfEventAction()

void EnergyLossRecorder::BeginOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 40 of file EnergyLossRecorder.cxx.

41  {
42  }

◆ BeginOfRunAction()

void EnergyLossRecorder::BeginOfRunAction ( const G4Run *  )
overridevirtual

Definition at line 32 of file EnergyLossRecorder.cxx.

33  {
34  }

◆ EndOfEventAction()

void EnergyLossRecorder::EndOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 44 of file EnergyLossRecorder.cxx.

45  {
46  if (m_config.pmWriter) {
47  // FIXME: thread-unsafe usage of a component in a thread-local action?
48  // See ATLASSIM-3562.
50  }
51  m_entries = 0;
52  }

◆ EndOfRunAction()

void EnergyLossRecorder::EndOfRunAction ( const G4Run *  )
overridevirtual

Definition at line 36 of file EnergyLossRecorder.cxx.

37  {
38  }

◆ UserSteppingAction()

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

Definition at line 54 of file EnergyLossRecorder.cxx.

55  {
56  // kill secondary particles
57  if (aStep->GetTrack()->GetParentID()) {
58  aStep->GetTrack()->SetTrackStatus(fStopAndKill);
59  return;
60  }
61  if(!m_config.pmWriter) return;
62  // we require a minimum amount of material for recording the step
63 
64  // the material information
65  const G4TouchableHistory* touchHist = static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
66  // G4LogicalVolume
67  const G4LogicalVolume *lv= touchHist ? touchHist->GetVolume()->GetLogicalVolume() : nullptr;
68  const G4Material *mat = lv ? lv->GetMaterial() : nullptr;
69 
70  // log the information // cut off air
71  if (mat && mat->GetRadlen() < 200000.) {
72  // keep primary particles - calculate the kinematics for them
73  G4ThreeVector pos = aStep->GetPreStepPoint()->GetPosition();
74  double px = aStep->GetPreStepPoint()->GetMomentum().x();
75  double py = aStep->GetPreStepPoint()->GetMomentum().y();
76  double pz = aStep->GetPreStepPoint()->GetMomentum().z();
77  Amg::Vector3D position(pos.x(),pos.y(),pos.z());
79 
80  // record the starting parameters at the first step
81  if (m_entries==0) {
82  // increase the counter
83  ++m_entries;
84  double m = aStep->GetTrack()->GetDynamicParticle()->GetMass();
85  int pdgCode = aStep->GetTrack()->GetDynamicParticle()->GetPDGcode();
86  m_config.pmWriter->initializeTrack(position,momentum,m,pdgCode);
87  }
88  else {
90  }
91  }
92  }

Member Data Documentation

◆ m_config

Config G4UA::EnergyLossRecorder::m_config
private

Definition at line 56 of file EnergyLossRecorder.h.

◆ m_entries

unsigned int G4UA::EnergyLossRecorder::m_entries
private

Definition at line 57 of file EnergyLossRecorder.h.


The documentation for this class was generated from the following files:
test_pyathena.px
px
Definition: test_pyathena.py:18
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:53
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
G4UA::EnergyLossRecorder::m_entries
unsigned int m_entries
Definition: EnergyLossRecorder.h:57
G4UA::EnergyLossRecorder::m_config
Config m_config
Definition: EnergyLossRecorder.h:56
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
Amg::py
@ py
Definition: GeoPrimitives.h:39
G4UA::EnergyLossRecorder::Config::pmWriter
Trk::IPositionMomentumWriter * pmWriter
Definition: EnergyLossRecorder.h:46
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::IPositionMomentumWriter::initializeTrack
virtual void initializeTrack(const Amg::Vector3D &pos, const Amg::Vector3D &mom, double m, int pdg)=0
Initialize State.
Trk::IPositionMomentumWriter::finalizeTrack
virtual void finalizeTrack()=0
Finalization State.
Trk::IPositionMomentumWriter::recordTrackState
virtual void recordTrackState(const Amg::Vector3D &pos, const Amg::Vector3D &mom)=0
Record a single TrackState.