def buildListOfModifiers(): Modifiers = [] from Digitization.DigitizationFlags import digitizationFlags if digitizationFlags.RunAndLumiOverrideList.get_Value(): if not digitizationFlags.RunAndLumiOverrideList.is_locked(): raise RuntimeError( 'You cannot configure the EvtIdModifierSvc with an unlocked JobProperty.' ) pDicts = digitizationFlags.RunAndLumiOverrideList.get_Value() for el in pDicts: if 'evt_nbr' in el: Modifiers += add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts'], evt_nbr=el['evt_nbr']) else: Modifiers += add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts']) elif digitizationFlags.dataRunNumber.get_Value(): if digitizationFlags.dataRunNumber.get_Value() < 0: raise SystemExit( "Given a negative Run Number - please use a real run number from data." ) #logDigitization_flags.info( 'Overriding run number to be: %s ', digitizationFlags.dataRunNumber.get_Value() ) myRunNumber = digitizationFlags.dataRunNumber.get_Value() myFirstLB = 1 ## Using event numbers to avoid "some very large number" setting from AthenaCommon.AthenaCommonFlags import athenaCommonFlags totalNumber = 1000000 if athenaCommonFlags.EvtMax( ) is not None and athenaCommonFlags.EvtMax() > 0: totalNumber = athenaCommonFlags.EvtMax() + 1 if athenaCommonFlags.SkipEvents( ) is not None and athenaCommonFlags.SkipEvents() > 0: totalNumber += athenaCommonFlags.SkipEvents() try: from RunDependentSimComps.RunDMCFlags import runDMCFlags myInitialTimeStamp = runDMCFlags.RunToTimestampDict.getTimestampForRun( myRunNumber) #print "FOUND TIMESTAMP ", str(myInitialTimeStamp) except KeyError: myInitialTimeStamp = 1 Modifiers += add_modifier(run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=totalNumber) return Modifiers
def initialize(self): import AtlasG4Eng from time import gmtime, strftime timestr = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) AtlasG4Eng.G4Eng.log.info('%s starting at (UTC): %s' % (self.name(), timestr)) AtlasG4Eng.G4Eng._app_profiler('%s begin of initialize' % self.name()) AtlasG4Eng.G4Eng.Dict['simu_skeleton']._do_All() AtlasG4Eng.G4Eng._init_Simulation() from G4AtlasApps.SimFlags import simFlags AtlasG4Eng.G4Eng._app_profiler('%s end of initialize' % self.name()) from AthenaCommon.AthenaCommonFlags import athenaCommonFlags if athenaCommonFlags.EvtMax.statusOn and theApp.EvtMax == -1: theApp.EvtMax = athenaCommonFlags.EvtMax() return True
if athenaCommonFlags.PoolESDOutput(): InDetKeys.OutputESDFileName = athenaCommonFlags.PoolESDOutput() if athenaCommonFlags.PoolAODOutput(): InDetKeys.OutputAODFileName = athenaCommonFlags.PoolAODOutput() #-------------------------------------------------------------- # load master joboptions file #-------------------------------------------------------------- include("InDetRecExample/InDetRec_all.py") #-------------------------------------------------------------- # Event related parameters and input files #-------------------------------------------------------------- # Number of events to be processed theApp.EvtMax = athenaCommonFlags.EvtMax() #ServiceMgr.EventSelector.SkipEvents = 2 #ServiceMgr.StoreGateSvc.Dump = True #ServiceMgr.PoolSvc.AttemptCatalogPatch=True # --- default SLHC test file from digit output #ServiceMgr.EventSelector.InputCollections = [ 'singleMuon_test_slhc_Digits.pool.root' ] # set the path variables consistently from InDetSLHC_Example.SLHC_Setup import SLHC_Setup SLHC_Setup = SLHC_Setup() if (rec.OutputFileNameForRecoStep() == 'RAWtoESD'): include("InDetSLHC_Example/postInclude.DigitalClustering.py")
v4Menus = True if 'v4MenuValidation' not in dir(): v4MenuValidation = False if 'EvtMax' not in dir(): athenaCommonFlags.EvtMax = 1 else: athenaCommonFlags.EvtMax = EvtMax del EvtMax # no longer needed and gives WARNING or ERROR from RecExCommon if 'Input' not in dir(): Input = 'T1' # a few specific OUTPUT levels if athenaCommonFlags.EvtMax() <= 100: ConfigOutputLevel = VERBOSE L2OutputLvl = INFO EFOutputLvl = VERBOSE TMEFOutputLvl = VERBOSE MGOutputLvl = VERBOSE elif athenaCommonFlags.EvtMax() <= 1000: ConfigOutputLevel = VERBOSE L2OutputLvl = INFO EFOutputLvl = VERBOSE TMEFOutputLvl = DEBUG MGOutputLvl = DEBUG else: ConfigOutputLevel = INFO L2OutputLvl = INFO EFOutputLvl = INFO
def configureRunNumberOverrides(): myRunNumber = 1 myFirstLB = 1 myInitialTimeStamp = 0 from G4AtlasApps.SimFlags import simFlags if hasattr(simFlags, "RunNumber") and simFlags.RunNumber.statusOn: myRunNumber = simFlags.RunNumber.get_Value() simMDlog.info('Found run number %d in sim flags.' % myRunNumber) ## Set event selector details based on evgen metadata ######update the run/event info for each event from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, 'EvtIdModifierSvc'): import AthenaServices.Configurables as asc ServiceMgr += asc.EvtIdModifierSvc(EvtStoreName="StoreGateSvc") from AthenaCommon.AppMgr import theApp theApp.CreateSvc += ["EvtIdModifierSvc"] else: simMDlog.warning( 'Will override the settings of the EvtIdModifierSvc that was previously set up!' ) #fix iov metadata if not hasattr(ServiceMgr.ToolSvc, 'IOVDbMetaDataTool'): from AthenaCommon import CfgMgr ServiceMgr.ToolSvc += CfgMgr.IOVDbMetaDataTool() ServiceMgr.ToolSvc.IOVDbMetaDataTool.MinMaxRunNumbers = [ myRunNumber, 2147483647 ] ## FIXME need to use maxRunNumber = 2147483647 for now to keep overlay working but in the future this should be set properly. # Using event numbers to avoid "some very large number" setting from AthenaCommon.AthenaCommonFlags import athenaCommonFlags totalNumber = 1000000 # TODO possibly get this from MetaReader?? if athenaCommonFlags.EvtMax( ) is not None and athenaCommonFlags.EvtMax() > 0: totalNumber = athenaCommonFlags.EvtMax() + 1 if athenaCommonFlags.SkipEvents( ) is not None and athenaCommonFlags.SkipEvents() > 0: totalNumber += athenaCommonFlags.SkipEvents() try: from RunDependentSimComps.RunDMCFlags import runDMCFlags myInitialTimeStamp = runDMCFlags.RunToTimestampDict.getTimestampForRun( myRunNumber) #print "FOUND TIMESTAMP ", str(myInitialTimeStamp) except: myInitialTimeStamp = 1 ServiceMgr.EvtIdModifierSvc.add_modifier(run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=totalNumber) if hasattr(ServiceMgr.EventSelector, 'OverrideRunNumberFromInput'): ServiceMgr.EventSelector.OverrideRunNumberFromInput = True elif metadata_lite is not None: # Get evgen run number and lumi block if len(metadata_lite['runNumbers']) > 0: myRunNumber = metadata_lite['runNumbers'][0] simMDlog.info('Found runNumbers %d in hits file metadata.' % myRunNumber) else: simMDlog.warning( 'Failed to find runNumbers in hits file metadata.') if metadata_lite['lumiBlockNumbers']: myFirstLB = metadata_lite['lumiBlockNumbers'][0] else: simMDlog.warning( 'Requires simFlags.RunNumber to be specified in this running mode.\ Using default value of 1 for RunNumber.') from AthenaCommon.AppMgr import ServiceMgr ServiceMgr.EventSelector.OverrideRunNumber = True ServiceMgr.EventSelector.RunNumber = myRunNumber ServiceMgr.EventSelector.FirstLB = myFirstLB # Necessary to avoid a crash ServiceMgr.EventSelector.InitialTimeStamp = myInitialTimeStamp