Skip to content
Snippets Groups Projects
Commit c6e524ba authored by John Chapman's avatar John Chapman
Browse files

Migrate G4HitFilterTool configuration

Migrate `G4UA::G4HitFilterTool` configuration to use
`simFlags.OptionalUserActionList`. See ATLASSIM-3569.
parent 2540c22f
No related branches found
No related tags found
No related merge requests found
......@@ -35,5 +35,3 @@ atlas_add_component( G4HitFilter
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from AthenaCommon import CfgMgr
from G4AtlasServices import G4AtlasServicesConfig
def getG4HitFilterTool(name="G4UA::G4HitFilterTool", **kwargs):
from G4HitFilter.G4HitFilterConf import G4UA__G4HitFilterTool
return G4UA__G4HitFilterTool(name, **kwargs)
def addG4HitFilterTool(name="G4UA::G4HitFilterTool",system=False):
G4AtlasServicesConfig.addAction(name,['Run','Event'],system)
from G4AtlasApps.SimFlags import simFlags
# example custom configuration
if name in simFlags.UserActionConfig.get_Value().keys():
for prop,value in simFlags.UserActionConfig.get_Value()[name].iteritems():
kwargs.setdefault(prop,value)
kwargs.setdefault('VolumeNames',
["BCMHits",
"BLMHits",
"CSC_Hits",
"LArCalibrationHitActive",
"LArCalibrationHitDeadMaterial",
"LArCalibrationHitInactive",
"LArHitEMB",
"LArHitEMEC",
"LArHitFCAL",
"LArHitHEC",
"MBTSHits",
"MDT_Hits",
"PixelHits",
"RPC_Hits",
"SCT_Hits",
"TGC_Hits",
"TRTUncompressedHits",
"TileHitVec"]
)
return CfgMgr.G4UA__G4HitFilterTool(name, **kwargs)
from AthenaCommon.CfgGetter import getPublicTool
from G4AtlasApps.SimFlags import simFlags
# configuration for MT actions
from G4HitFilter.G4HitFilterConfig import addG4HitFilterTool
hitf = getPublicTool('G4UA::G4HitFilterTool',tryDefaultConfigurable=True)
addG4HitFilterTool(hitf)
hitf.VolumeNames=[
"BCMHits",
"BLMHits",
"CSC_Hits",
"LArCalibrationHitActive",
"LArCalibrationHitDeadMaterial",
"LArCalibrationHitInactive",
"LArHitEMB",
"LArHitEMEC",
"LArHitFCAL",
"LArHitHEC",
"MBTSHits",
"MDT_Hits",
"PixelHits",
"RPC_Hits",
"SCT_Hits",
"TGC_Hits",
"TRTUncompressedHits",
"TileHitVec"
]
......@@ -18,10 +18,4 @@ simFlags.EventFilter.switchFilterOn('VertexRangeChecker')
simFlags.VertexFromCondDB.set_Off()
simFlags.VertexTimeOffset.set_Off()
# Hit filter setup function for callback
def hitFilterSetup():
atlasG4log.info("Setting up filter parameters")
include("G4HitFilter/G4HitFilter.py")
# Register the callback
simFlags.InitFunctions.add_function("preInitG4", hitFilterSetup)
simFlags.OptionalUserActionList.addAction("G4UA::G4HitFilterTool",['Run','Event'])
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