diff --git a/DDSim/DD4hepSimulation.py b/DDSim/DD4hepSimulation.py index 461886d9db29e7a2613695cd6bb033f2ea37213a..542f385dd57388f69ea35a10f77833b4f3578884 100644 --- a/DDSim/DD4hepSimulation.py +++ b/DDSim/DD4hepSimulation.py @@ -76,7 +76,6 @@ class DD4hepSimulation(object): self._errorMessages = [] self._dumpParameter = False self._dumpSteeringFile = False - self.enableDetailedHitsAndParticleInfo = False ## objects for extended configuration option self.output = Output() @@ -397,25 +396,9 @@ class DD4hepSimulation(object): part.enableUI() - if self.enableDetailedHitsAndParticleInfo: - #---- debug code from Markus for detailed dumps of hits and MC-truth assignement ------ - # Add the particle dumper to associate the MC truth - evt = DDG4.EventAction(kernel,"Geant4ParticleDumpAction/ParticleDump") - kernel.eventAction().adopt(evt) - evt.enableUI() - # Add the hit dumper BEFORE any hit truth is fixed - evt = DDG4.EventAction(kernel,"Geant4HitDumpAction/RawDump") - kernel.eventAction().adopt(evt) - evt.enableUI() - # Add the hit dumper to the event action sequence - evt = DDG4.EventAction(kernel,"Geant4HitTruthHandler/HitTruth") - kernel.eventAction().adopt(evt) - evt.enableUI() - # Add the hit dumper AFTER any hit truth is fixed. We should see the reduced track references - evt = DDG4.EventAction(kernel,"Geant4HitDumpAction/HitDump") - kernel.eventAction().adopt(evt) - evt.enableUI() - + if self.part.enableDetailedHitsAndParticleInfo: + self.part.setDumpDetailedParticleInfo( kernel, DDG4 ) + #---------------------------------- diff --git a/DDSim/Helper/ParticleHandler.py b/DDSim/Helper/ParticleHandler.py index 9b91c052199fad2485a1eac2d2fd48f75b0c503c..bd3c729462c075dd9b9d7c7df3489fbb16dd1385 100644 --- a/DDSim/Helper/ParticleHandler.py +++ b/DDSim/Helper/ParticleHandler.py @@ -13,6 +13,18 @@ class ParticleHandler( ConfigHelper ): self._printEndTracking = False self._printStartTracking = False self._minDistToParentVertex = 2.2e-14*mm + self._enableDetailedHitsAndParticleInfo = False + self._enableDetailedHitsAndParticleInfo_HELP = "print out lots of info about MCHistory" + + @property + def enableDetailedHitsAndParticleInfo(self): + """Enamble lots of printout on simulated hits and MC-truth inforamation""" + return self._enableDetailedHitsAndParticleInfo + + @enableDetailedHitsAndParticleInfo.setter + def enableDetailedHitsAndParticleInfo( self, val ): + self._enableDetailedHitsAndParticleInfo = val + @property def minDistToParentVertex( self ): @@ -63,3 +75,22 @@ class ParticleHandler( ConfigHelper ): @printEndTracking.setter def printEndTracking( self, val ): self._printEndTracking = val + + def setDumpDetailedParticleInfo( self, kernel, DDG4 ): + #---- debug code from Markus for detailed dumps of hits and MC-truth assignement ------ + # Add the particle dumper to associate the MC truth + evt = DDG4.EventAction(kernel,"Geant4ParticleDumpAction/ParticleDump") + kernel.eventAction().adopt(evt) + evt.enableUI() + # Add the hit dumper BEFORE any hit truth is fixed + evt = DDG4.EventAction(kernel,"Geant4HitDumpAction/RawDump") + kernel.eventAction().adopt(evt) + evt.enableUI() + # Add the hit dumper to the event action sequence + evt = DDG4.EventAction(kernel,"Geant4HitTruthHandler/HitTruth") + kernel.eventAction().adopt(evt) + evt.enableUI() + # Add the hit dumper AFTER any hit truth is fixed. We should see the reduced track references + evt = DDG4.EventAction(kernel,"Geant4HitDumpAction/HitDump") + kernel.eventAction().adopt(evt) + evt.enableUI()