From 7b06f91aa04624517b9117d894afc59c549494fd Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Fri, 2 Mar 2018 12:17:28 +0100 Subject: [PATCH] Fix https://github.com/AIDASoft/DD4hep/issues/324 --- DDCore/src/gdml/GdmlPlugins.cpp | 2 +- DDCore/src/plugins/Compact2Objects.cpp | 4 +++- DDG4/include/DDG4/Geant4PhysicsList.h | 4 ++++ DDG4/src/Geant4Converter.cpp | 2 +- DDG4/src/Geant4Exec.cpp | 1 + DDG4/src/Geant4PhysicsList.cpp | 9 +++++++++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/DDCore/src/gdml/GdmlPlugins.cpp b/DDCore/src/gdml/GdmlPlugins.cpp index 354236fb5..405e3922c 100644 --- a/DDCore/src/gdml/GdmlPlugins.cpp +++ b/DDCore/src/gdml/GdmlPlugins.cpp @@ -30,7 +30,7 @@ using namespace std; using namespace dd4hep; -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,13,1) +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,13,0) /// ROOT GDML reader plugin /** diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index ad2bf134d..d0e655507 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -391,7 +391,9 @@ template <> void Converter<Material>::operator()(xml_h e) const { throw_print("Compact2Objects[ERROR]: Converting material:" + mname + " Element missing: " + nam); } mix->SetRadLen(0e0); - +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,12,0) + mix->ComputeDerivedQuantities(); +#endif //fg: calling SetDensity for TGeoMixture results in incorrect radLen and intLen ( computed only from first element ) // // Update estimated density if not provided. // if ( has_density ) { diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index c0c6be12c..8b865a91d 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -169,6 +169,8 @@ namespace dd4hep { virtual void constructParticles(G4VUserPhysicsList* physics); /// Callback to construct processes (uses the G4 particle table) virtual void constructProcesses(G4VUserPhysicsList* physics); + /// Enable physics list: actions necessary to be propagated to Geant4. + virtual void enable(G4VUserPhysicsList* physics); }; /// The implementation of the single Geant4 physics list action sequence @@ -246,6 +248,8 @@ namespace dd4hep { virtual void constructParticles(G4VUserPhysicsList* physics); /// Execute sequence of G4 physics constructors virtual void constructPhysics(G4VModularPhysicsList* physics); + /// Enable physics list: actions necessary to be propagated to Geant4. + virtual void enable(G4VUserPhysicsList* physics); /// Extend physics list from factory: G4VUserPhysicsList* extensionList(); }; diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index 31efceb84..154db9353 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -864,7 +864,7 @@ void* Geant4Converter::handleLimitSet(LimitSet limitset, const set<const TGeoVol if (l.name == "step_length_max") g4->SetMaxAllowedStep(l.value*CLHEP::mm/units::mm); else if (l.name == "track_length_max") - g4->SetMaxAllowedStep(l.value*CLHEP::mm/units::mm); + g4->SetUserMaxTrackLength(l.value*CLHEP::mm/units::mm); else if (l.name == "time_max") g4->SetUserMaxTime(l.value*CLHEP::ns/units::ns); else if (l.name == "ekin_min") diff --git a/DDG4/src/Geant4Exec.cpp b/DDG4/src/Geant4Exec.cpp index 27f9cd154..1d211f938 100644 --- a/DDG4/src/Geant4Exec.cpp +++ b/DDG4/src/Geant4Exec.cpp @@ -593,6 +593,7 @@ int Geant4Exec::configure(Geant4Kernel& kernel) { physics->SetCuts(); if( DEBUG == printLevel() ) physics->DumpCutValuesTable(); #endif + phys_seq->enable(physics); runManager.SetUserInitialization(physics); // Construct the remaining user initialization in multi-threaded mode diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index fa70820b8..a876ae7b6 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -277,6 +277,10 @@ void Geant4PhysicsList::constructProcesses(G4VUserPhysicsList* physics_pointer) } } +/// Enable physics list: actions necessary to be propagated to Geant4. +void Geant4PhysicsList::enable(G4VUserPhysicsList* /* physics */) { +} + /// Standard constructor Geant4PhysicsListActionSequence::Geant4PhysicsListActionSequence(Geant4Context* ctxt, const string& nam) : Geant4Action(ctxt, nam), m_transportation(false), m_decays(false), m_rangecut(0.7*CLHEP::mm) { @@ -377,3 +381,8 @@ void Geant4PhysicsListActionSequence::constructDecays(G4VUserPhysicsList* physic } } +/// Enable physics list: actions necessary to be propagated to Geant4. +void Geant4PhysicsListActionSequence::enable(G4VUserPhysicsList* physics_pointer) { + m_actors(&Geant4PhysicsList::enable, physics_pointer); +} + -- GitLab