diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index b8cab1d1e..0586ce174 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -244,6 +244,8 @@ namespace dd4hep { std::string m_extends; /// global range cut for secondary productions double m_rangecut; + /// verbosity level for the physics list + int m_verbosity = 0; public: /// Standard constructor diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py index e585e5b5d..2272c1736 100644 --- a/DDG4/python/DDSim/DD4hepSimulation.py +++ b/DDG4/python/DDSim/DD4hepSimulation.py @@ -506,6 +506,7 @@ def run(self): # ================================================================================= # Now build the physics list: _phys = self.physics.setupPhysics(kernel, name=self.physicsList) + _phys.verbosity = self.output.physics # add the G4StepLimiterPhysics to activate the max step limits in volumes ph = DDG4.PhysicsList(kernel, 'Geant4PhysicsList/Myphysics') diff --git a/DDG4/python/DDSim/Helper/Output.py b/DDG4/python/DDSim/Helper/Output.py index 035e353c9..1e8fc2110 100644 --- a/DDG4/python/DDSim/Helper/Output.py +++ b/DDG4/python/DDSim/Helper/Output.py @@ -52,6 +52,9 @@ def __init__(self): self._geometry_EXTRA = {'choices': OUTPUT_CHOICES, 'type': outputLevelType} self._geometry = outputLevel('DEBUG') + + self._physics_EXTRA = {'choices': (0, 1, 2), 'type': outputLevelType} + self._physics = outputLevel(1) self._closeProperties() @property @@ -98,3 +101,12 @@ def geometry(self): @geometry.setter def geometry(self, level): self._geometry = outputLevel(level) + + @property + def physics(self): + """Output level for physics and physics constructors: 0 (silent), 1, 2""" + return self._physics + + @physics.setter + def physics(self, level): + self._physics = int(level) diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index eade54531..4c94488a3 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include // C/C++ include files #include @@ -319,6 +321,7 @@ Geant4PhysicsListActionSequence::Geant4PhysicsListActionSequence(Geant4Context* declareProperty("extends", m_extends); declareProperty("decays", m_decays); declareProperty("rangecut", m_rangecut); + declareProperty("verbosity", m_verbosity); m_needsControl = true; InstanceCount::increment(this); } @@ -362,6 +365,14 @@ G4VUserPhysicsList* Geant4PhysicsListActionSequence::extensionList() { // Ownership is transferred to the physics list. // Do not delete this pointer afterwards.... physics->RegisterPhysics(new ParticlePhysics(this,physics)); + + //Setting verbosity for pieces of the physics + physics->SetVerboseLevel(m_verbosity); + if(G4EmParameters::Instance()) + G4EmParameters::Instance()->SetVerbose(m_verbosity); + if(G4HadronicParameters::Instance()) + G4HadronicParameters::Instance()->SetVerboseLevel(m_verbosity); + return physics; } @@ -377,6 +388,7 @@ void Geant4PhysicsListActionSequence::dump() { printout(ALWAYS,name(),"+++ Transportation flag: %d",m_transportation); printout(ALWAYS,name(),"+++ Program decays: %d",m_decays); printout(ALWAYS,name(),"+++ RangeCut: %f",m_rangecut); + printout(ALWAYS,name(),"+++ Verbosity: %i",m_verbosity); m_actors(&Geant4PhysicsList::dump); }