From d2035bb68acb2a74b82a4df1d91ee3e7f1fc4532 Mon Sep 17 00:00:00 2001 From: Charles Leggett <leggett@cern.ch> Date: Thu, 23 Feb 2017 22:28:17 +0100 Subject: [PATCH] update G4AtlasApps-00-12-08 to G4AtlasApps-00-12-00-15 from ChangeLog: 2017-01-19 John Chapman <John.Chapman@cern.ch> * python/SimFlags.py, python/SimCtbKernel.py: add support for tb_Tile2000_2003_2B1EB (2 barrels and 1 extended barrel) configuration. ATLASSIM-3184 * python/tbtile_flags.py: fixes for setting of Phi, Theta and Eta job properties. ATLASSIM-3184 * Tagging: G4AtlasApps-00-12-00-15 2016-11-16 Zach Marshall <ZLMarshall@lbl.gov> * Fixing minor typo in tbtile_flags.py * Tagging: G4AtlasApps-00-12-00-14 2016-11-04 John Chapman <John.Chapman@cern.ch> * python/SimAtlasKernel.py - comment out use of PyLArG4RunControler. ATLASSIM-2290 * Tagging: G4AtlasApps-00-12-00-13 2016-09-16 Steve Farrell <Steven.Farrell@cern.ch> * Copying CMakeLists.txt from trunk branch. * Tagging: G4AtlasApps-00-12-00-12 2016-09-09 John Chapman <John.Chapman@cern.ch> * python/SimFlags.py: Drop UseV2UserActions SimFlag as the V1 UserActions have been removed! ATLASSIM-3023 * Tagging: G4AtlasApps-00-12-00-11 2016-09-07 Zach Marshall <ZLMarshall@lbl.gov> * python/atlas_flags.py: Moving TRT range cut to 30mm by default for MC16. ATLASSIM-2332 * Tagging: G4AtlasApps-00-12-00-10 2016-08-25 Zach Marshall <ZLMarshall@lbl.gov> * python/PyG4Atlas.py: Updating output service settings at the recommendation of Peter vG * Tagging: G4AtlasApps-00-12-00-09 --- .../G4Atlas/G4AtlasApps/cmt/requirements | 1 + .../G4Atlas/G4AtlasApps/python/PyG4Atlas.py | 207 +----------------- .../G4AtlasApps/python/SimAtlasKernel.py | 26 +-- .../G4AtlasApps/python/SimCtbKernel.py | 2 +- .../G4Atlas/G4AtlasApps/python/SimFlags.py | 17 +- .../G4Atlas/G4AtlasApps/python/atlas_flags.py | 10 - .../G4Atlas/G4AtlasApps/python/callbacks.py | 11 +- .../G4AtlasApps/python/tbtile_flags.py | 2 +- .../G4AtlasApps/share/jobOptions.G4Atlas.py | 2 +- .../share/jobOptions.G4Atlas_ReadEvgen.py | 2 +- 10 files changed, 29 insertions(+), 251 deletions(-) diff --git a/Simulation/G4Atlas/G4AtlasApps/cmt/requirements b/Simulation/G4Atlas/G4AtlasApps/cmt/requirements index 08515c3374d..4f67b536c95 100644 --- a/Simulation/G4Atlas/G4AtlasApps/cmt/requirements +++ b/Simulation/G4Atlas/G4AtlasApps/cmt/requirements @@ -1,3 +1,4 @@ +# G4AtlasApps package G4AtlasApps author Andrea Dell'Acqua <dellacqu@mail.cern.ch> diff --git a/Simulation/G4Atlas/G4AtlasApps/python/PyG4Atlas.py b/Simulation/G4Atlas/G4AtlasApps/python/PyG4Atlas.py index 6672837aa2a..4ef3cedf16d 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/PyG4Atlas.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/PyG4Atlas.py @@ -141,8 +141,8 @@ class G4AtlasEngine: if "init_G4" not in self._InitList: G4AtlasEngine.log.debug(' G4AtlasEngine: _init_G4: init Geant4 ') if G4AtlasEngine.log.level <= 30: - g4Command = G4AtlasEngine.gbl.G4Commands() - g4Command.run.verbose(2) # FIXME make configurable based on Athena message level? + from SimFlags import simFlags + simFlags.G4Commands += ['/run/verbose 2'] # FIXME make configurable based on Athena message level? G4AtlasEngine._ctrl.initializeG4(is_hive) self._InitList.append('init_G4') G4AtlasEngine._app_profiler('_init_G4: ') @@ -169,22 +169,6 @@ class G4AtlasEngine: G4AtlasEngine._ctrl.mctruthMenu.listStrategies() - def _init_Graphics(self): - """ Inits the G4 visualization stuff. - - (for internal use) - """ - if 'init_Graphics' not in self._InitList: - G4AtlasEngine.log.debug('G4AtlasEngine: _init_Graphics: init G4 Graphics ') - G4Graphics = G4AtlasEngine.menu_Visualization() - if G4Graphics.ActiveStatusOn: - G4Graphics._init() - else: - G4AtlasEngine.log.debug('G4AtlasEngine: _init_Graphics: init G4 Graphics --> no graphics request' ) - else: - G4AtlasEngine.log.warning('G4AtlasEngine: init_Graphics is already done') - - def _init_Simulation(self): """\ Simulation engine initialization. @@ -198,7 +182,6 @@ class G4AtlasEngine: pre/postInitG4 - called before/after the init_G4 method pre/postInitMCTruth - called before/after the init_MCTruth method pre/postInitFields - called before/after the init_Fields method - pre/postInitGraphics - called before/after the init_Graphics method postInit - called after all sim engine initialisation methods The current init level is stored in G4AtlasEngine.init_status, and its @@ -232,8 +215,6 @@ class G4AtlasEngine: else: G4AtlasEngine.log.debug('not initializing MCTruth in G4AtlasEngine because useISF=True') - _run_init_stage("Graphics") - self.init_status = "postInit" G4AtlasEngine.log.debug("G4AtlasEngine:init stage " + self.init_status) _run_init_callbacks(self.init_status) @@ -282,21 +263,6 @@ class G4AtlasEngine: raise RuntimeError('Dict %s can not be found' % dict_name) - def read_XML(self, xml_name): - """ Reads XML files. - - xml_name ='name_XML_file' - """ - if xml_name: - if xml_name not in G4AtlasEngine.List_LoadedXML: - try: - G4AtlasEngine._ctrl.ReadXML(xml_name) - G4AtlasEngine.List_LoadedXML.append(xml_name) - G4AtlasEngine.log.debug('G4AtlasEngine:read_XML: %s read' % xml_name) - except: - RuntimeError('XML file %s can not be found' % xml_name) - - def print_Summary(self): """ Prints the summary """ @@ -470,167 +436,6 @@ class G4AtlasEngine: - # TODO: PLEASE can we remove this? - class menu_Visualization(object): - """ - Initial version of the menu for the visualization. - - NOT READY YET!!!! - """ - class __impl: - def spam(self): - return id(self) - __instance=None - - - def __init__(self): - if G4AtlasEngine.menu_Visualization.__instance is None: - G4AtlasEngine.menu_Visualization.__instance = G4AtlasEngine.menu_Visualization.__impl() - self._Built=False - self.ActiveStatusOn=False - self.VisTracks=False - self.VisDriver='VRML2FILE' - from AtlasG4Eng import GeV - self.TrackPtCut=.3*GeV - self.DrawNeutralTracks=False - self.List_Volumen2Vis=list() - self.List_Volumen2NotVis=list() - - - def __getattr__(self, attr): - return getattr(self.__instance, attr) - - - def __setattr__(self, attr, value): - return setattr(self.__instance, attr, value) - - - def add_volume2vis(self,name_volume): - """ Adds only one volume or wild-card to the list - of volumes you want to visualize - """ - self.List_Volumen2Vis.append(name_volume) - - - def add_ListV2vis(self,list_volume): - """ Adds a list of volumes or wild-cards to the list - of volumes you want to visualize - """ - self.List_Volumen2Vis=self.List_Volumen2Vis+list_volume - - - def add_volume2Notvis(self,name_volume): - """ Adds only one volume or wild-card to the list - of volumes you do not want to visualize - """ - self.List_Volumen2NotVis.append(name_volume) - - - def add_ListV2Notvis(self,list_volume): - """ Adds a list of volumes or wild-cards to the list - of volumes you do not want to visualize - """ - self.List_Volumen2NotVis=self.List_Volumen2NotVis+list_volume - - - def get_ListVolume2vis(self): - """ Gets the list of volumes that will be visible. - """ - return self.List_Volumen2Vis - - - def get_ListVolume2Notvis(self): - """ Gets the list of volumes that will be invisible. - """ - return self.List_Volumen2NotVis - - - def set_active(self): - """ Activates the visualization - """ - self.ActiveStatusOn=True - - - def set_Parameters(self,name_parameter,new_value): - """ Changes the default visualization parameters. - - VisDriver (default 'VRML2FILE') - TrackPtCut (default .3*GeV ) - DrawNeutralTracks (default False ) - """ - if (name_parameter=='VisDriver'): - self.VisDriver=new_value - if (name_parameter=='TrackPtCut'): - self.TrackPtCut=new_value - if (name_parameter=='DrawNeutralTracks'): - self.DrawNeutralTracks=new_value - - - def set_VisTrack(self): - """ Activates the visualization of tracks. - It will produce one wrl file for each event - """ - self.VisTracks=True - - - def print_status(self): - """ Gets the actual status of the visualization menu - """ - print 'AtlasG4Eng.menu_visualization status: ' - print '---------------------------------------' - print 'Built:: ',self._Built - print 'Active:: ',self.ActiveStatusOn - print 'Visualize Tracks:: ',self.VisTracks - print 'Visualization driver:: ',self.VisDriver - print 'TrackPtCut :: ',self.TrackPtCut - print 'DrawNeutralTracks :: ',self.DrawNeutralTracks - print 'List of Volumes to visualize ' - print self.List_Volumen2Vis - print 'List of Volumes not to visualize ' - print self.List_Volumen2NotVis - - - def _init(self): - if self.ActiveStatusOn and not(self._Built): - # init graphics - G4AtlasEngine._ctrl.initializeGraphics() - self._Built=True - # support for event visualization - if self.VisTracks: - G4AtlasEngine.load_Lib('G4UserActions') - G4AtlasEngine.load_Lib('G4EventGraphics') - VisAction=UserAction('G4EventGraphics',\ - 'DrawEventPyAction',['BeginOfEvent','EndOfEvent']) - G4AtlasEngine.menu_UserActions.add_UserAction(VisAction) - G4AtlasEngine.load_Dict("G4EventGraphicsDict") - self.EventGraphics=\ - G4AtlasEngine.gbl.EventGraphicsPyMessenger.Instance() - self.EventGraphics.SetTrackDisplayLevel(3) - self.EventGraphics.SetTrackPtCut(self.TrackPtCut) - self.EventGraphics.SetTrackColorScheme(3) - self.EventGraphics.SetDrawNeutralTracks(self.DrawNeutralTracks) - self.__dict__['EventGraphics']=self.EventGraphics - if self.ActiveStatusOn: - # invisible volumes - for v1 in self.List_Volumen2NotVis: - G4AtlasEngine._ctrl.geometryMenu.SetInvisible(v1) - # visible volumes - for v2 in self.List_Volumen2Vis: - G4AtlasEngine._ctrl.geometryMenu.SetVisible(v2) - G4command=G4AtlasEngine.gbl.G4Commands() - G4command.vis.open(self.VisDriver) - G4command.vis.drawVolume() - G4command.vis.viewer.flush() - - - def visualize(self): - if self._Built: - G4command = G4AtlasEngine.gbl.G4Commands() - G4command.vis.open(self.VisDriver) - G4command.vis.drawVolume() - G4command.vis.viewer.flush() - - class DetConfigurator: """ DetConfigurator is a hook for the specific sub-detector configuration. @@ -1219,14 +1024,6 @@ class _PyG4AtlasComp(PyG4Atlas_base): AtlasG4Eng.G4Eng._init_Simulation() from G4AtlasApps.SimFlags import simFlags - if simFlags.ISFRun: - # TODO: does this 'HACK' need to be fixed at some point? - # *AS* HACK, as "G4AtlasControl/SimControl.cxx" fails dynamic cast - # see also G4AtlasRunManager - AtlasG4Eng.G4Eng.gbl.G4Commands().run.verbose(2) - AtlasG4Eng.G4Eng._ctrl.G4Command("/run/initialize") - #AtlasG4Eng.G4Eng.gbl.G4Commands().tracking.verbose(1) - AtlasG4Eng.G4Eng._app_profiler('%s end of initialize' % self.name()) if "atlas_flags" in simFlags.extra_flags: beamcondsvc = PyAthena.py_svc('BeamCondSvc/BeamCondSvc', createIf=True, iface=cppyy.gbl.IBeamCondSvc) diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimAtlasKernel.py b/Simulation/G4Atlas/G4AtlasApps/python/SimAtlasKernel.py index c80503bbf56..e5caffd48c0 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/SimAtlasKernel.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/SimAtlasKernel.py @@ -61,8 +61,7 @@ class AtlasSimSkeleton(SimSkeleton): DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.digitize.all_setOff() - if not simFlags.IsEventOverlayInputSim(): - DetFlags.overlay.all_setOff() + DetFlags.overlay.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() @@ -271,21 +270,16 @@ class AtlasSimSkeleton(SimSkeleton): """ AtlasG4Eng.G4Eng.log.verbose('AtlasSimSkeleton._do_GeoSD :: starting') - ## Inner detector - if DetFlags.ID_on(): - if DetFlags.geometry.TRT_on(): - AtlasG4Eng.G4Eng.read_XML("TRgeomodelgeometry.xml") # FIXME need to find a better way to do this - ## Calorimeters - if DetFlags.Calo_on(): - ## LAr - if DetFlags.geometry.LAr_on(): - from G4AtlasApps.SimFlags import simFlags - # if this is an ISF run, allow the collections on store gate to be modified - # by other algorithms (i.e. set them non-const) - allowSGMods = True if simFlags.ISFRun else False - from atlas_calo import PyLArG4RunControler - lArG4RunControl = PyLArG4RunControler('PyLArG4RunControl', 'LArG4RunControlDict', allowMods=allowSGMods) + ##if DetFlags.Calo_on(): + ## ## LAr + ## if DetFlags.geometry.LAr_on(): + ## from G4AtlasApps.SimFlags import simFlags + ## # if this is an ISF run, allow the collections on store gate to be modified + ## # by other algorithms (i.e. set them non-const) + ## allowSGMods = True if simFlags.ISFRun else False + ## from atlas_calo import PyLArG4RunControler + ## lArG4RunControl = PyLArG4RunControler('PyLArG4RunControl', 'LArG4RunControlDict', allowMods=allowSGMods) AtlasG4Eng.G4Eng.log.verbose('AtlasSimSkeleton._do_GeoSD :: done') diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimCtbKernel.py b/Simulation/G4Atlas/G4AtlasApps/python/SimCtbKernel.py index 9796bafeebe..058e9abae39 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/SimCtbKernel.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/SimCtbKernel.py @@ -66,7 +66,7 @@ class TBSimSkeleton(SimSkeleton): Setup and add metadata to the HIT file """ import AtlasG4Eng - AtlasG4Eng.G4Eng.log.verbose('TBSimSkeleton :: _do_metadata :: starting') + AtlasG4Eng.G4Eng.log.verbose('SimSkeleton :: _do_metadata :: starting') from G4AtlasApps.G4Atlas_Metadata import createTBSimulationParametersMetadata createTBSimulationParametersMetadata() diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py b/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py index db2bfbb8ee2..ffa9f88a2b6 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/SimFlags.py @@ -649,16 +649,6 @@ class RecordFlux(JobProperty): allowedTypes = ['bool'] StoredValue = False -class UseV2UserActions(JobProperty): - """ - Migration version of the user actions. This should only be used by experts! - - V1 corresponds to JIRA ATLASSIM-1752 - - V2 corresponds to JIRA ATLASSIM-2226 - """ - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - class OptionalUserActionList(JobProperty): """Configuration for Optional UserActions The name of the action must be a name retrievable through the ConfigurableFactory""" @@ -706,14 +696,13 @@ class UserActionConfig(JobProperty): else: self.StoredValue[actionTool]={prop:value} - class specialConfiguration(JobProperty): """ contains information on configuring simulation for special physics models. Populated, if possible, by evgen file metadata. """ - statusOn = False - allowedTypes = ['dict'] - StoredValue = dict() + statusOn=False + allowedTypes=['dict'] + StoredValue=dict() ## Definition and registration of the simulation flag container diff --git a/Simulation/G4Atlas/G4AtlasApps/python/atlas_flags.py b/Simulation/G4Atlas/G4AtlasApps/python/atlas_flags.py index f9df1d6ecf2..b84b45a6d94 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/atlas_flags.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/atlas_flags.py @@ -400,13 +400,3 @@ class TRTRangeCut(JobProperty): allowedTypes = ['float'] allowedValues = [0.05,30.0] StoredValue = 30.0 - -class IsEventOverlayInputSim(JobProperty): - """ - Is will the output of this job be used as the input for an event - overlay job? - """ - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - diff --git a/Simulation/G4Atlas/G4AtlasApps/python/callbacks.py b/Simulation/G4Atlas/G4AtlasApps/python/callbacks.py index af06489bdf9..af27039578e 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/callbacks.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/callbacks.py @@ -23,8 +23,15 @@ def use_nystromrk4_stepper(): ## Use verbose G4 tracking def use_verbose_tracking(): - from G4AtlasApps import AtlasG4Eng - AtlasG4Eng.G4Eng.gbl.G4Commands().tracking.verbose(1) + from G4AtlasApps.SimFlags import simFlags + simFlags.G4Commands += ['/tracking/verbose 1'] + +## Do a recursive geometry test +def do_recursive_geometry_test(): + from G4AtlasApps.SimFlags import simFlags + simFlags.G4Commands += ["/geometry/test/recursion_start 0"] + simFlags.G4Commands += ["/geometry/test/recursion_depth 2"] + simFlags.G4Commands += ["/geometry/test/recursive_test"] # Add a truth catch for LLP decay processes def add_LLP_truth_strategies(): diff --git a/Simulation/G4Atlas/G4AtlasApps/python/tbtile_flags.py b/Simulation/G4Atlas/G4AtlasApps/python/tbtile_flags.py index ed1476bddc2..5e91d6165bb 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/tbtile_flags.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/tbtile_flags.py @@ -12,7 +12,7 @@ during the years 2000-2003. """ __author__= 'M. Gallas' -__version__ = "$Revision: 793038 $" +__version__ = "$Revision: 793036 $" from AthenaCommon.JobProperties import JobProperty diff --git a/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py b/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py index c816c914ab8..848202c2456 100644 --- a/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py +++ b/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas.py @@ -61,7 +61,7 @@ simFlags.EventFilter.set_On() ## Change the field stepper or use verbose G4 tracking #from G4AtlasApps import callbacks #callbacks.use_simplerunge_stepper() -#simFlags.InitFunctions.add_function("postInit", callbacks.use_verbose_tracking) +#callbacks.use_verbose_tracking() ## Use single particle generator from AthenaCommon.AthenaCommonFlags import athenaCommonFlags diff --git a/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas_ReadEvgen.py b/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas_ReadEvgen.py index d4b5657646d..eadaaff099c 100644 --- a/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas_ReadEvgen.py +++ b/Simulation/G4Atlas/G4AtlasApps/share/jobOptions.G4Atlas_ReadEvgen.py @@ -61,7 +61,7 @@ simFlags.EventFilter.set_On() ## Change the field stepper or use verbose G4 tracking #from G4AtlasApps import callbacks #callbacks.use_simplerunge_stepper() -#simFlags.InitFunctions.add_function("postInit", callbacks.use_verbose_tracking) +#callbacks.use_verbose_tracking() from AthenaCommon.CfgGetter import getAlgorithm topSeq += getAlgorithm("BeamEffectsAlg", tryDefaultConfigurable=True) -- GitLab