20 #include <unordered_map>
23 #include <G4Material.hh>
24 #include <G4RunManager.hh>
36 G4Material*
material = step->GetPreStepPoint()->GetMaterial();
37 if (material ==
nullptr) {
43 for (
const auto& emat :
m_cfg.excludeMaterials) {
44 if (emat == materialName) {
45 ACTS_VERBOSE(
"Exclude step in material '" << materialName <<
".");
51 constexpr
double convertDensity =
56 << convertLength * step->GetStepLength());
59 double X0 = convertLength * material->GetRadlen();
60 double L0 = convertLength * material->GetNuclearInterLength();
61 double rho = convertDensity * material->GetDensity();
65 const G4ElementVector* elements = material->GetElementVector();
66 const G4double* fraction = material->GetFractionVector();
67 size_t nElements = material->GetNumberOfElements();
71 Ar = material->GetA() / (CLHEP::gram / CLHEP::mole);
74 for (
size_t i = 0;
i < nElements;
i++) {
75 Ar += elements->at(
i)->GetA() * fraction[
i] / (CLHEP::gram / CLHEP::mole);
76 Z += elements->at(
i)->GetZ() * fraction[
i];
83 convertLength * step->GetStepLength());
86 const auto& rawPos = step->GetPreStepPoint()->GetPosition();
87 const auto& rawDir = step->GetPreStepPoint()->GetMomentum();
90 Acts::Vector3(convertLength * rawPos.x(), convertLength * rawPos.y(),
91 convertLength * rawPos.z());
97 G4Track* g4Track = step->GetTrack();
98 size_t trackID = g4Track->GetTrackID();
99 auto& materialTracks = eventStore().materialTracks;
100 if (materialTracks.find(trackID - 1) == materialTracks.end()) {
102 const auto& g4Vertex = g4Track->GetVertexPosition();
104 const auto& g4Direction = g4Track->GetMomentumDirection();
105 Acts::Vector3 direction(g4Direction[0], g4Direction[1], g4Direction[2]);
106 rmTrack.first = {vertex, direction};
107 rmTrack.second.materialInteractions.push_back(mInteraction);
108 materialTracks[trackID - 1] = rmTrack;
110 materialTracks[trackID - 1].second.materialInteractions.push_back(