Skip to content
Snippets Groups Projects
Commit cff1bf62 authored by Graeme Stewart's avatar Graeme Stewart
Browse files

Simulation/ISF/ISF_Geant4/ISF_Geant4Config deleted from 21.0

Former-commit-id: fc10bd91bb26ed943a608d961ea15ad6f53c5885
parent 48aeda2a
No related branches found
No related tags found
Loading
################################################################################
# Package: ISF_Geant4Config
################################################################################
# Declare the package name:
atlas_subdir( ISF_Geant4Config )
# Install files from the package:
atlas_install_python_modules( python/*.py )
package ISF_Geant4Config
manager Elmar Ritsch <Elmar.Ritsch@cern.ch>
private
use AtlasPolicy AtlasPolicy-*
branches share
apply_pattern declare_python_modules files="*.py"
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
"""
Tools configurations for ISF
KG Tan, 17/06/2012
"""
from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicTool,getPublicToolClone,\
getService,getServiceClone,getAlgorithm,getAlgorithmClone
from AthenaCommon.Constants import * # FATAL,ERROR etc.
from AthenaCommon.SystemOfUnits import *
from AthenaCommon.DetFlags import DetFlags
from ISF_Config.ISF_jobProperties import ISF_Flags # IMPORTANT: Flags must be set before tools are retrieved
cache = {}
def usingGeant4():
global cache
return bool(cache)
def getIGeant4(**kwargs):
global cache
FullGeant4 = kwargs.pop('FullGeant4',False)
if 'iGeant4' in cache:
i = cache['iGeant4']
# if FullGeant4 specified, make sure returning cached version with FullGeant4 already in use
if FullGeant4:
if (i.FullGeant4 == False) :
print "asking for FullGeant4 but already configured Geant4 without specifying Full Geant4! Must specify FullGeant4 everywhere (or nowhere)!!!"
sys.exit()
else:
from ISF_Config.ISF_jobProperties import ISF_Flags
from iGeant4 import iGeant4
i = iGeant4(**kwargs)
cache['iGeant4'] = i
return i
def getGeant4SimSvc(name="ISF_Geant4SimSvc", **kwargs):
from ISF_Config.ISF_jobProperties import ISF_Flags
kwargs.setdefault('FullGeant4' , False )
kwargs.setdefault('SimulationTool' , 'ISFG4TransportTool' )
kwargs.setdefault('Identifier' , "Geant4" )
kwargs.setdefault('PrintTimingInfo' , ISF_Flags.DoTimeMonitoring() )
return getIGeant4(**kwargs).getSimSvc()
def getFullGeant4SimSvc(name="ISF_Geant4SimSvc", **kwargs):
kwargs.setdefault('FullGeant4' , True )
kwargs.setdefault('SimulationTool' , 'FullG4TransportTool' )
return getGeant4SimSvc(name, **kwargs)
def getPassBackGeant4SimSvc(name="ISF_PassBackGeant4SimSvc", **kwargs):
kwargs.setdefault('FullGeant4' , False )
kwargs.setdefault('SimulationTool' , 'PassBackG4TransportTool' )
return getGeant4SimSvc(name, **kwargs)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
"""
ISF_Geant4Config
"""
print 'loading ISF_Geant4Config'
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from Gaudi.Configuration import *
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.BeamFlags import jobproperties
# confgetter
from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicTool,getPublicToolClone,\
getService,getServiceClone,getAlgorithm,getAlgorithmClone
G4Eng = None
class iGeant4:
def __init__(self, **kwargs):
from G4AtlasApps.SimFlags import simFlags
from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
####################################
##
## the Athena part:
##
####################################
##FIXME: This should be configured using a CfgGetter method
##defined in the SubDetectorEnvelopes package.
##G4EnvelopeDefSvc is only used in G4DetectorEnvelopes/src/DefSvcEnvelope.cxx
from SubDetectorEnvelopes.SubDetectorEnvelopesConf import DetDescrDBEnvelopeSvc
G4_DDDBEnvelopeDefSvc = DetDescrDBEnvelopeSvc( "G4EnvelopeDefSvc" )
G4_DDDBEnvelopeDefSvc.DBBeamPipeNode = 'BPipeEnvelopeG4'
G4_DDDBEnvelopeDefSvc.DBInDetNode = 'InDetEnvelopeG4'
G4_DDDBEnvelopeDefSvc.DBCaloNode = 'CaloEnvelopeG4'
G4_DDDBEnvelopeDefSvc.DBMSNode = 'MuonEnvelopeG4'
G4_DDDBEnvelopeDefSvc.DBCavernNode = 'CavernEnvelopeG4'
svcMgr += G4_DDDBEnvelopeDefSvc
# configure Geant4SimSvc
from ISF_Geant4Services.ISF_Geant4ServicesConf import iGeant4__Geant4SimSvc
Geant4SimService = iGeant4__Geant4SimSvc('ISFG4SimSvc', **kwargs)
# DEBUG: dump Geant4SimService
print Geant4SimService
svcMgr += Geant4SimService
self.__simSvc__ = Geant4SimService
##FIXME: ISF_ParticleFinalStateFilter is configured in
##ISF_HepMC_ToolsConfig.py and is only used by ISF_StackFiller
##which is also configured in ISF_HepMC_ToolsConfig.py.
finalStateFilter = getPublicTool("ISF_ParticleFinalStateFilter")
finalStateFilter.CheckGenSimStable = False
finalStateFilter.CheckGenInteracting = False
####################################
##
## the G4 Python part:
##
####################################
# let the G4 configuration know that is an ISF run!
simFlags.ISFRun.set_Value_and_Lock( True)
# call the standard G4 config
# ADS: these lines must be called somewhere else. Can't have the alg added to the sequence in an unpredictable order
#from AthenaCommon.AlgSequence import AlgSequence
#topSequence = AlgSequence()
#from G4AtlasApps.PyG4Atlas import PyG4AtlasAlg
#topSequence += PyG4AtlasAlg()
def getSimSvc(self):
return self.__simSvc__
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment