def _loadBasicIOVDb(): """Loads the basic services for IOVDbSvc""" ## make sure we have been -at least- minimally correctly configured import AthenaCommon.AtlasUnixStandardJob from AthenaCommon.Logging import logging from AthenaCommon.AppMgr import ServiceMgr as svcMgr msg = logging.getLogger('loadBasicIOVDb') msg.debug("Loading basic services for IOVDbSvc...") # Load IOVDbSvc from IOVDbSvc.IOVDbSvcConf import IOVDbSvc svcMgr += IOVDbSvc() # Set IOVDbSvc as proxy provider from AthenaCommon.ConfigurableDb import getConfigurable svcMgr += getConfigurable("ProxyProviderSvc")() svcMgr.ProxyProviderSvc.ProviderNames += ["IOVDbSvc"] # Load IOVSvc from IOVSvc.IOVSvcConf import IOVSvc svcMgr += IOVSvc() # Load EventInfoMgt import EventInfoMgt.EventInfoMgtInit # add in /TagInfo to be read from File meta data svcMgr.IOVDbSvc.Folders += ["/TagInfo<metaOnly/>"] msg.debug("Loading basic services for IOVDb... [DONE]") return
def getStandardCalibTool(doAtlfastII=False): # define here name of H1 calib tool finder = 'Cone' mainparam = '4' input = 'H1Topo' if (doAtlfastII): input = input + "AtlfastII" tname = finder + mainparam + input # tname = Cone4H1Topo cellcalibtool = H1WeightToolCSC12Generic("H1Weight" + tname) # load DB services from IOVDbSvc.CondDB import conddb from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() IOVDbSvc = ServiceMgr.IOVDbSvc # now build database info : check calibdic in Jet/JetRec/python/JetCalibrationConfig.py input = input.replace('H1', '') # old names convention if mainparam == '4': mainparam = '' calibtype = finder + mainparam + input # calibtype = 'ConeTopo' correspond to Cone4H1Topo key = 'H1Weights' + calibtype folder = '/CALO/H1Weights/' + key key = folder # the same as foldr tag = None from JetRec.JetRecFlags import jetFlags DB_tag = jetFlags.JetCalibrationDBTag() if DB_tag != "": tag = "CaloH1WeightsConeTopo-" + DB_tag # check in calibdic the right tag corresponding to calibtype else: tag = "CaloH1WeightsConeTopo-00-000" # check in calibdic the right tag corresponding to calibtype if (doAtlfastII): tag = "CaloH1WeightsConeTopoAtlfastII-00-000" cellcalibtool.DBHandleKey = key conddb.addFolder("CALO", folder + ' <tag>' + tag + '</tag>', className='CaloRec::ToolConstants') # checking.... # print (' tname is ',tname ) # print (' input is ', input ) # print (' tag is ', tag ) # print (' name is', cellcalibtool.name() ) # print (' key is ', key ) # print (' folder is ', folder ) return cellcalibtool
def loadCaloFolder(folder,tag,isMC=False): from IOVDbSvc.CondDB import conddb from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() IOVDbSvc = ServiceMgr.IOVDbSvc if isMC: dbString="CALO_OFL" else: dbString="CALO" if (folder,tag) not in H1Calibration.loaded_folder: if H1Calibration.overrideFolder(): conddb.addFolder(dbString,folder+'<tag>'+tag+'</tag>') else: conddb.addFolder(dbString,folder) H1Calibration.loaded_folder.append( (folder,tag) )
import sys import string from AtlasGeoModel import SetGeometryVersion from AtlasGeoModel import GeoModelInit from AtlasGeoModel import SetupRecoGeometry include("CaloConditions/CaloConditions_jobOptions.py") include("TileIdCnv/TileIdCnv_jobOptions.py") from GeoModelSvc.GeoModelSvcConf import GeoModelSvc ServiceMgr += GeoModelSvc() theApp.CreateSvc += ["GeoModelSvc"] from AtlasGeoModel import LArGM from AtlasGeoModel import TileGM from IOVDbSvc.IOVDbSvcConf import IOVDbSvc IOVDbSvc().GlobalTag = 'OFLCOND-SDR-BS14T-IBL-06' from AthenaPython import PyAthena from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() TILE = PyAthena.CaloCell_ID.TILE LARFCAL = PyAthena.CaloCell_ID.LARFCAL def toiter(range): beg = range.begin() end = range.end() while beg != end: yield beg.__deref__() beg.__preinc__()
import ROOT import math import cppyy from AtlasGeoModel import SetGeometryVersion from AtlasGeoModel import GeoModelInit from AtlasGeoModel import SetupRecoGeometry include("CaloIdCnv/CaloIdCnv_joboptions.py") cppyy.loadDict("libxAODTrigL1CaloDict") from GeoModelSvc.GeoModelSvcConf import GeoModelSvc ServiceMgr += GeoModelSvc() theApp.CreateSvc += ["GeoModelSvc"] from AtlasGeoModel import LArGM from IOVDbSvc.IOVDbSvcConf import IOVDbSvc IOVDbSvc().GlobalTag = 'OFLCOND-RUN12-SDR-35' include('LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py') include('LArConditionsCommon/LArIdMap_MC_jobOptions.py') from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() theApp.EvtMax = 2 from LArCellRec.LArCellDeadOTXCorrToolDefault import LArCellDeadOTXCorrToolDefault from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # barrel_ec, pos_neg, feedthrough, slot
globalflags.DetGeo = 'commis' else: globalflags.DetGeo = 'atlas' ## At this point we can set the global job properties flag globalflags.DetDescrVersion = simFlags.SimLayout.get_Value() # Switch off GeoModel Release in the case of parameterization if simFlags.LArParameterization.get_Value() > 0 and simFlags.ReleaseGeoModel(): simFlags.ReleaseGeoModel = False ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!! from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() if not hasattr(globalflags, "ConditionsTag") or not globalflags.ConditionsTag.get_Value(): raise SystemExit( "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set") if not hasattr(ServiceMgr.IOVDbSvc, 'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag: ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value() ## Enable floating point exception handling ## FIXME! This seems to cause the jobs to crash in the FpeControlSvc, so commenting this out for now... #from AthenaCommon.AthenaCommonFlags import athenaCommonFlags #athenaCommonFlags.RuntimeStrictness = 'abort' if not simFlags.ISFRun: from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata
FSMStateValue="READY") from PixelConditionsTools.PixelConditionsToolsConf import PixelDCSTestReadWrite job += PixelDCSTestReadWrite(OutputLevel=MyOutPut, Write=True) from IOVDbSvc.IOVDbSvcConf import IOVDbSvc #MYIOVDbSvc = IOVDbSvc(dbConnection = "impl=cool;techno=sqlite;schema=mytest.db;X:TESTCOOL", GlobalTag = "DEFAULTCOND") #MYIOVDbSvc = IOVDbSvc(dbConnection = "impl=cool;techno=sqlite;schema=mytest.db;X:TESTCOOL") #MYIOVDbSvc = IOVDbSvc(dbConnection = "sqlite://X;schema=mytest.db;dbname=TESTCOOL") #MYIOVDbSvc = IOVDbSvc(dbConnection = "impl=cool;techno=oracle;schema=ATLAS_COOL_AAD;DEVDB10:DCSDEC:ATLAS_COOL_AAD") #MYIOVDbSvc = IOVDbSvc(dbConnection = "oracle://DEVDB10;schema=ATLAS_COOL_AAD;dbname=DCSTEST4") #MYIOVDbSvc = IOVDbSvc(dbConnection = "oracle://ATLAS_COOLWRITE;schema=ATLAS_COOLOFL_DCS;dbname=OFLP200") # atlas simulation #MYIOVDbSvc = IOVDbSvc(dbConnection = "oracle://ATLAS_COOLWRITE;schema=ATLAS_COOLOFL_DCS;dbname=COMP200") # cosmics MYIOVDbSvc = IOVDbSvc( dbConnection="sqlite://X;schema=mytest.db;dbname=OFLP200") IOVDbSvc.GlobalTag = "DEFAULTCOND" ServiceMgr += MYIOVDbSvc #theApp.Dlls += [ "RegistrationServices" ] ## include ( "RegistrationServices/RegistrationServices_jobOptions.py" ) from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc MYIOVRegistrationSvc = IOVRegistrationSvc(IOVDbTimeStamp=TRUE) MYIOVRegistrationSvc.OverrideNames += ['FSM_state', 'FSM_status'] MYIOVRegistrationSvc.OverrideTypes += ['String255', 'String255'] ServiceMgr += MYIOVRegistrationSvc ## include ( "RegistrationServices/IOVRegistrationSvc_jobOptions.py" ) import AthenaCommon.AtlasUnixGeneratorJob
def _do_jobproperties(self): """ Place to handle JobProperties. """ ## Import extra flags if it hasn't already been done from G4AtlasApps.SimFlags import simFlags if "atlas_flags" not in simFlags.extra_flags: simFlags.load_atlas_flags() if jobproperties.Beam.beamType( ) == "cosmics" and "cosmics_flags" not in simFlags.extra_flags: simFlags.load_cosmics_flags() AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_jobproperties :: starting') ## Tidy up DBM DetFlags: temporary measure DetFlags.DBM_setOff() from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff() if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff() if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff() ## Switch off tasks DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.digitize.all_setOff() if not simFlags.IsEventOverlayInputSim(): DetFlags.overlay.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.writeRDOPool.all_setOff() ## Global flags needed by externals from AthenaCommon.GlobalFlags import globalflags globalflags.DataSource = 'geant4' if jobproperties.Beam.beamType() == 'cosmics': globalflags.DetGeo = 'commis' else: globalflags.DetGeo = 'atlas' ## At this point we can set the global job properties flag globalflags.DetDescrVersion = simFlags.SimLayout.get_Value() # Switch off GeoModel Release in the case of parameterization if simFlags.LArParameterization.get_Value( ) > 0 and simFlags.ReleaseGeoModel(): AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: Running parameterization - switching off GeoModel release!' ) simFlags.ReleaseGeoModel = False ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!! from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() if not hasattr( globalflags, "ConditionsTag") or not globalflags.ConditionsTag.get_Value(): msg = "AtlasSimSkeleton._do_jobproperties :: conditions tag has not been set and is no longer guessed by SimAtlasKernel. " msg += "You must set the globaltags.ConditionsTag flag in your job options." AtlasG4Eng.G4Eng.log.error(msg) raise SystemExit( "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set" ) if not hasattr(ServiceMgr.IOVDbSvc, 'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag: ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value( ) ## Enable floating point exception handling ## FIXME! This seems to cause the jobs to crash in the FpeControlSvc, so commenting this out for now... #from AthenaCommon.AthenaCommonFlags import athenaCommonFlags #athenaCommonFlags.RuntimeStrictness = 'abort' #AtlasG4Eng.G4Eng.log.debug('AtlasSimSkeleton._do_jobproperties :: Enabled floating point exceptions') if not simFlags.ISFRun: from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata checkForSpecialConfigurationMetadata() ## Print flags if AtlasG4Eng.G4Eng.log.getEffectiveLevel() < 40: AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: printing detector flags DetFlags' ) DetFlags.Print() AtlasG4Eng.G4Eng.log.info( 'AtlasSimSkeleton._do_jobproperties :: printing simulation flags simFlags' ) jobproperties.print_JobProperties('tree&value') # Lock the job properties if not running ISF. if not simFlags.ISFRun: jobproperties.lock_JobProperties() AtlasG4Eng.G4Eng.log.verbose( 'AtlasSimSkeleton._do_jobproperties :: done')
def _do_jobproperties(self): """ Place to handle JobProperties . """ AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties starting') ## Import extra flags if it hasn't already been done from G4AtlasApps.SimFlags import simFlags if not simFlags.extra_flags: simFlags.load_ctb_flags() # - switch off tasks DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.digitize.all_setOff() DetFlags.overlay.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.writeRDOPool.all_setOff() # - see if there are beam-conditions if (simFlags.BeamConditions.statusOn and simFlags.BeamConditions.get_Value()): try: AtlasG4Eng.G4Eng.log.info(' SimCtbKernel: '+\ ' loading CTB beam-conditions from the'+\ ' CTB run-condition file !!') BeamCond = __import__(modulepath, globals(), locals(), prepath).BeamCond beam_cond_obj = BeamCond.retrieve_Run( simFlags.RunNumber.get_Value()) beam_cond_obj._map() except: AtlasG4Eng.G4Eng.log.warning(' SimCtbKernel: '+ 'No particular beam conditions found for the run '+\ str(simFlags.RunNumber.get_Value())) # - switch off non-existing detectors DetFlags.FCal_setOff() DetFlags.HEC_setOff() # - Muons off for 13.0.0 release DetFlags.Muon_setOff() AtlasG4Eng.G4Eng.log.info( 'SimCtbKernel : Muons are not supported in releases >= 13.0.0') # - photon runs under run-conditions. For all the photon runs with # run number > 2860 SCT and Pixel were not at the beam # -- LAr material studies if (simFlags.SimLayout.get_Value() == 'ctbh8_lar-material'): DetFlags.SCT_setOff() DetFlags.Muon_setOff() if (simFlags.SimLayout.get_Value() == 'ctbh8_calodata'): DetFlags.ID_setOff() DetFlags.Muon_setOff() # # Note: for combined runs tag 04 in IDET # photon runs tag 08 # larmaterial runs tag 01 if simFlags.SimLayout.get_Value( ) == 'ctbh8_combined' and not simFlags.IdetOracleTag.statusOn: simFlags.IdetOracleTag = "InnerDetector-CTB-04-01" elif simFlags.SimLayout.get_Value( ) == 'ctbh8_phothon' and not simFlags.IdetOracleTag.statusOn: simFlags.IdetOracleTag = "InnerDetector-CTB-08-01" elif simFlags.SimLayout.get_Value( ) == 'ctbh8_lar-material' and not simFlags.IdetOracleTag.statusOn: simFlags.IdetOracleTag = "InnerDetector-CTB-01-01" else: simFlags.IdetOracleTag.set_On() # globalflags.DataSource = "geant4" globalflags.DetGeo = "ctbh8" ## mgallas this is a hack! needed for GeoModel and IOVDbSvc # TODO: Wow! Is this really still needed? import __main__ __main__.DetDescrVersion = 'CTB' __main__.globalflags = globalflags globalflags.DetDescrVersion = 'CTB' ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!! from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() if not hasattr( globalflags, "ConditionsTag") or not globalflags.ConditionsTag.get_Value(): msg = "AtlasSimSkeleton._do_jobproperties :: conditions tag has not been set and is no longer guessed by SimAtlasKernel. " msg += "You must set the globaltags.ConditionsTag flag in your job options." AtlasG4Eng.G4Eng.log.error(msg) raise SystemExit( "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set" ) if not hasattr(ServiceMgr.IOVDbSvc, 'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag: ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value( ) if not simFlags.ISFRun: from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata checkForSpecialConfigurationMetadata() ## Print out flags if AtlasG4Eng.G4Eng.log.getEffectiveLevel() < 40: AtlasG4Eng.G4Eng.log.info( 'SimCtbKernel : printing detector flags DetFlags') DetFlags.Print() AtlasG4Eng.G4Eng.log.info( 'SimCtbKernel : printing simulation flags simFlags') jobproperties.print_JobProperties('tree&value') jobproperties.lock_JobProperties() AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties done')
def _do_jobproperties(self): """ Place to handle JobProperties . """ AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties starting') ## Import extra flags if it hasn't already been done from G4AtlasApps.SimFlags import simFlags if not simFlags.extra_flags: simFlags.load_tbLArH6_flags() # - switch off tasks DetFlags.pileup.all_setOff() DetFlags.simulateLVL1.all_setOff() DetFlags.overlay.all_setOff() DetFlags.digitize.all_setOff() DetFlags.readRDOPool.all_setOff() DetFlags.makeRIO.all_setOff() DetFlags.writeBS.all_setOff() DetFlags.readRDOBS.all_setOff() DetFlags.readRIOBS.all_setOff() DetFlags.readRIOPool.all_setOff() DetFlags.writeRIOPool.all_setOff() DetFlags.writeRDOPool.all_setOff() DetFlags.ID_setOff() DetFlags.Muon_setOff() DetFlags.Tile_setOff() globalflags.DataSource = "geant4" globalflags.DetGeo = "ctbh6" # mgallas this is a hack! needed for GeoModel and IOVDbSvc # TODO: Wow! Is this really still needed? import __main__ __main__.globalflags = globalflags if simFlags.SimLayout.get_Value() == "tb_LArH6_2003": globalflags.DetDescrVersion = 'ATLAS-H6-2003-02' __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value() elif simFlags.SimLayout.get_Value() == "tb_LArH6_2002": globalflags.DetDescrVersion = 'ATLAS-H6-2002-01' __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value() elif simFlags.SimLayout.get_Value() == "tb_LArH6EC_2002": globalflags.DetDescrVersion = 'ATLAS-TBEC-01' __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value() elif simFlags.SimLayout.get_Value() == "tb_LArH6_2004": globalflags.DetDescrVersion = 'ATLAS-H6-2004-00' __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value() ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!! from AthenaCommon.AppMgr import ServiceMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc ServiceMgr += IOVDbSvc() if not hasattr( globalflags, "ConditionsTag") or not globalflags.ConditionsTag.get_Value(): msg = "AtlasSimSkeleton._do_jobproperties :: conditions tag has not been set and is no longer guessed by SimAtlasKernel. " msg += "You must set the globaltags.ConditionsTag flag in your job options." AtlasG4Eng.G4Eng.log.error(msg) raise SystemExit( "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set" ) if not hasattr(ServiceMgr.IOVDbSvc, 'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag: ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value( ) if not simFlags.ISFRun: from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata checkForSpecialConfigurationMetadata() ## Print flags if AtlasG4Eng.G4Eng.log.getEffectiveLevel() < 40: AtlasG4Eng.G4Eng.log.info( 'SimCtbKernel : printing detector flags DetFlags') DetFlags.Print() AtlasG4Eng.G4Eng.log.info( 'SimCtbKernel : printing simulation flags simFlags') jobproperties.print_JobProperties('tree&value') jobproperties.lock_JobProperties() AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties done')
from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += InDetBeamSpotFinder() InDetBeamSpotFinder = InDetBeamSpotFinder(OutputLevel=INFO, DoHists=doHists, WriteDb=True) InDetBeamSpotFinder.LumiRange = 5 if useVertex: InDetBeamSpotFinder.BeamSpotTool = InDetBeamSpotVertex else: InDetBeamSpotFinder.BeamSpotTool = InDetBeamSpotTrackChi2 # Call the histogramming service if doHists: # produce ROOT ntuple using THistSvc from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, 'THistSvc'): from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() ServiceMgr.THistSvc.Output += [ "INDETBEAMSPOTFINDER DATAFILE='beamspot.root' OPT='RECREATE'" ] # Write database to a sqlite file from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ServiceMgr as svcMgr from IOVDbSvc.IOVDbSvcConf import IOVDbSvc svcMgr += IOVDbSvc() #IOVDbSvc.dbConnection = "impl=cool;techno=sqlite;schema=beamspot.db;X:TESTCOOL" IOVDbSvc.dbConnection = "sqlite://;schema=beamspot.db;dbname=BEAMSPOT"