ATLAS Offline Software
Loading...
Searching...
No Matches
MaterialTrackRecorder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ACTSGEOMETRY_MATERIALTRACKRECORDER_H
6#define ACTSGEOMETRY_MATERIALTRACKRECORDER_H
7
10
11#include "Acts/Definitions/Algebra.hpp"
12#include "Acts/Definitions/Units.hpp"
13#include "CLHEP/Units/SystemOfUnits.h"
14
15#include "G4UserEventAction.hh"
16#include "G4UserRunAction.hh"
17#include "G4UserSteppingAction.hh"
18#include "G4ThreeVector.hh"
19
20class G4Event;
21class G4Run;
22class G4Step;
23
24
25namespace ActsTrk
26{
33
34 class MaterialTrackRecorder: public AthMessaging, public G4UserEventAction,
35 public G4UserRunAction, public G4UserSteppingAction
36 {
37 public:
38 struct Config {
40 std::string materialTrackCollectionName = "MaterialTracks";
41 std::vector<std::string> excludeMaterials = {"Air", "Vacuum"};
42
43 };
44
46 virtual void BeginOfEventAction(const G4Event*) override;
47 virtual void EndOfEventAction(const G4Event*) override;
48 virtual void BeginOfRunAction(const G4Run*) override;
49 virtual void UserSteppingAction(const G4Step*) override;
50
51 private:
55 constexpr static double s_convertLength = Acts::UnitConstants::mm / CLHEP::mm;
56 constexpr static double s_convertDensity =
57 (Acts::UnitConstants::g / Acts::UnitConstants::mm3) / (CLHEP::gram / CLHEP::mm3);
58
61
63 Acts::Vector3 convertPosition(const G4ThreeVector& g4vec) {
64 return Acts::Vector3(g4vec[0] * s_convertLength, g4vec[1] * s_convertLength,
65 g4vec[2] * s_convertLength);
66 }
67
68 Acts::Vector3 convertDirection(const G4ThreeVector& g4vec) {
69 return Acts::Vector3{g4vec[0], g4vec[1], g4vec[2]};
70 }
71
72 }; // class MaterialTrackRecorder
73
74} // namespace ActsTrk
75
76#endif
77
virtual void UserSteppingAction(const G4Step *) override
static constexpr double s_convertDensity
Acts::Vector3 convertPosition(const G4ThreeVector &g4vec)
Useful fuction for position coversion.
static constexpr double s_convertLength
Conversion constants.
virtual void EndOfEventAction(const G4Event *) override
Acts::Vector3 convertDirection(const G4ThreeVector &g4vec)
Useful fuction for direction coversion.
virtual void BeginOfRunAction(const G4Run *) override
virtual void BeginOfEventAction(const G4Event *) override
MaterialTrackRecorder(const Config &config)
RecordedMaterialTrackCollection * m_rmtCollection
Pointer to the collection, non-owning.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::vector< RecordedMaterialTrack > RecordedMaterialTrackCollection
std::string materialTrackCollectionName
Output collection name for recorded material tracks.