From a843299bf65be9c1b20b4fe2caaa6ad8b3326b04 Mon Sep 17 00:00:00 2001 From: andiwand Date: Tue, 4 Jul 2023 09:09:31 +0200 Subject: [PATCH 1/2] fix some G4<->Acts unit conversions --- Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp | 4 ++-- Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp b/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp index a84dbb64b55..55410190b22 100644 --- a/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp +++ b/Examples/Algorithms/Geant4/src/ParticleTrackingAction.cpp @@ -102,7 +102,7 @@ void ActsExamples::ParticleTrackingAction::PostUserTrackingAction( ActsExamples::SimParticle ActsExamples::ParticleTrackingAction::convert( const G4Track& aTrack, SimBarcode particleId) const { // Unit conversions G4->::ACTS - constexpr double convertTime = Acts::UnitConstants::s / CLHEP::s; + constexpr double convertTime = Acts::UnitConstants::ns / CLHEP::ns; constexpr double convertLength = Acts::UnitConstants::mm / CLHEP::mm; constexpr double convertEnergy = Acts::UnitConstants::GeV / CLHEP::GeV; @@ -110,7 +110,7 @@ ActsExamples::SimParticle ActsExamples::ParticleTrackingAction::convert( const G4ParticleDefinition* particleDef = aTrack.GetParticleDefinition(); G4int pdg = particleDef->GetPDGEncoding(); G4double charge = particleDef->GetPDGCharge(); - G4double mass = particleDef->GetPDGMass(); + G4double mass = convertEnergy * particleDef->GetPDGMass(); G4ThreeVector pPosition = convertLength * aTrack.GetPosition(); G4double pTime = convertTime * aTrack.GetGlobalTime(); G4ThreeVector pDirection = aTrack.GetMomentumDirection(); diff --git a/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp b/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp index c184cf0ef29..a66da42154a 100644 --- a/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp +++ b/Examples/Algorithms/Geant4/src/SimParticleTranslation.cpp @@ -76,6 +76,7 @@ void ActsExamples::SimParticleTranslation::GeneratePrimaries(G4Event* anEvent) { std::optional lastVertex; constexpr double convertLength = CLHEP::mm / Acts::UnitConstants::mm; + constexpr double convertTime = CLHEP::ns / Acts::UnitConstants::ns; constexpr double convertEnergy = CLHEP::GeV / Acts::UnitConstants::GeV; unsigned int pCounter = 0; @@ -95,7 +96,7 @@ void ActsExamples::SimParticleTranslation::GeneratePrimaries(G4Event* anEvent) { lastVertex = currentVertex; pVertex = new G4PrimaryVertex( currentVertex[0] * convertLength, currentVertex[1] * convertLength, - currentVertex[2] * convertLength, currentVertex[3]); + currentVertex[2] * convertLength, currentVertex[3] * convertTime); } // Add a new primary to the vertex From 8601f92f4f0310fdc6626a6bc892456ac75bfaa1 Mon Sep 17 00:00:00 2001 From: andiwand Date: Tue, 4 Jul 2023 11:22:59 +0200 Subject: [PATCH 2/2] update reference --- Examples/Python/tests/root_file_hashes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 1b9bb5ba2e7..88aaa1e1420 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -2,8 +2,8 @@ test_pythia8__pythia8_particles.root: d9a3d4f16c01aab9984e0e848292760d44015f2108 test_fatras__particles_final.root: 0bfe4bbac90b112fd960b39cd5edd7d19fb9b8e308f8315db0871bfae061b550 test_fatras__particles_initial.root: 0e2d9974fdd4aa5549c5c05817ec54fe6c7d9cbe7969647f227956167e31110d test_fatras__hits.root: d46b760e1647ab94c49d6976a78ee5a6178d41c45f2238f86f3987938a7901fb -test_geant4__particles_final.root: 94069908d2c77d5dd54193fbaa0d22d401b98df17c148fff6b48dbfa9e0b8a55 -test_geant4__particles_initial.root: 0c70278caa0adebcae8ce64e8f262b99daab0c905bc4aefb9600bcb22106e7c6 +test_geant4__particles_final.root: abf91622e96c0723651e864e050c7fdeee84b230aacb1c261ad81ff4e5df5f2c +test_geant4__particles_initial.root: 5be86aa4a2fc369093746451f37085e2c93f80f079b66023f5fe4b67e20100f6 test_geant4__hits.root: 70b592a546fd362c9341d87c9068b1f8fed657e0036e62e7262c01fa5eb2d469 test_seeding__estimatedparams.root: d39de91d7b0a88f0261070f33da5c5db96e2872f118b42a06577b38f5e81b25c test_seeding__performance_seeding.root: 992f9c611d30dde0d3f3ab676bab19ada61ab6a4442828e27b65ec5e5b7a2880