diff --git a/Simulation/G4Atlas/G4AtlasApps/cmt/requirements b/Simulation/G4Atlas/G4AtlasApps/cmt/requirements index 08515c3374d954432459bdcc3d4cda7d2506c832..4f67b536c9546ceea53a1029ce9f4564840a5844 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 6672837aa2a25d2c33e5f7cb312f17f68aaf9a7c..4ef3cedf16d8b8bbd10678060204a6b68e9fd238 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 c80503bbf56fdb731ae0f977d5e023ff64061e7f..e5caffd48c0d9bc387078da975e444f208870bba 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 9796bafeebe1b5897745133b7922ccd6b818c6f5..058e9abae39119f51741c76c688743a3b0971a17 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 db2bfbb8ee2d6c7a10e0d6d8db6954bd04b68abe..ffa9f88a2b68ecb684ed68248d308593f75f3da9 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 f9df1d6ecf2f27606078ce19962ff352cfc617b2..b84b45a6d94e4253664139d77db7e1c1a36a857f 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 af06489bdf96572d138a99dc6604ff1a9780e36a..af27039578ed956ef25f01c754bae49fd85e6df2 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 ed1476bddc2e7c7c490f3e4a25569f63c1da6478..5e91d6165bb41581bcbe3ae951a2c05abe4185e5 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 c816c914ab8e33798f0a140b2dbc41711a407cad..848202c2456ec09c4f03a613c03705d7844bae58 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 d4b5657646def05fd2eec3cceee58189622076a8..eadaaff099cf72925be42231bf5a201aeff0d87e 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)