Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: G4 material converter #1803

Merged
merged 2 commits into from
Jan 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Plugins/Geant4/src/Geant4Converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "Acts/Surfaces/TrapezoidBounds.hpp"
#include "Acts/Utilities/Helpers.hpp"

#include <cassert>

#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
Expand Down Expand Up @@ -301,12 +303,14 @@ std::shared_ptr<Acts::HomogeneousSurfaceMaterial>
Acts::Geant4MaterialConverter::surfaceMaterial(const G4Material& g4Material,
ActsScalar original,
ActsScalar compressed) {
assert(g4Material.GetNumberOfElements() == 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, if is a compound, one would have to do the averaging ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

followed up on this here #1805


ActsScalar compression = original / compressed;

auto g4X0 = g4Material.GetRadlen();
auto g4L0 = g4Material.GetNuclearInterLength();
auto g4Z = g4Material.GetZ();
auto g4A = g4Material.GetZ();
auto g4A = (*g4Material.GetElementVector())[0]->GetN();
auto g4Rho = g4Material.GetDensity();

Material mat = Material::fromMassDensity(
Expand Down