3 from AthenaCommon.Logging
import logging
4 from AthenaConfiguration.Enums
import FlagEnum, ProductionStep
5 from AthenaKernel.EventIdOverrideConfig
import getMinMaxRunNumbers
7 folderName =
"/Simulation/Parameters"
11 simMDlog = logging.getLogger(
'Sim_Metadata')
15 for flag
in sorted(flags._flagdict):
16 if flag.startswith(
"Sim."):
17 if "GenerationConfiguration" in flag:
20 if "Twiss" in flag
and not flags.Detector.GeometryForward:
23 if "UseShadowEvent" in flag
and not flags.Sim.UseShadowEvent:
26 if "VertexTimeWidth" in flag
and not flags.Sim.VertexTimeSmearing:
29 if "RunOnGPU" in flag
and not flags.Sim.ISF.Simulator.usesFastCaloSim():
32 if "FastCalo.ParamsInputFilename" in flag
and not flags.Sim.ISF.Simulator.usesFastCaloSim():
35 if "SimplifiedGeoPath" in flag
and not flags.Sim.SimplifiedGeoPath:
38 if "FastCalo.doEMECFCS" in flag
and not flags.Sim.FastCalo.doEMECFCS:
42 key = flag.split(
".")[-1]
43 value = flags._get(flag)
44 if isinstance(value, FlagEnum):
46 if not isinstance(value, str):
48 dbFiller.addSimParam(key, value)
49 simMDlog.info(
'SimulationMetaData: setting "%s" to be %s', key, value)
51 dbFiller.addSimParam(
'G4Version', flags.Sim.G4Version)
52 dbFiller.addSimParam(
'RunType',
'atlas')
53 dbFiller.addSimParam(
'beamType', flags.Beam.Type.value)
54 dbFiller.addSimParam(
'SimLayout', flags.GeoModel.AtlasVersion)
55 dbFiller.addSimParam(
'MagneticField',
'AtlasFieldSvc')
59 from AthenaConfiguration.DetectorConfigFlags
import getEnabledDetectors
61 simMDlog.info(
"Setting 'SimulatedDetectors' = %r", simDets)
62 dbFiller.addSimParam(
'SimulatedDetectors',
repr(simDets))
65 dbFiller.addSimParam(
'hitFileMagicNumber',
'0')
68 dbFiller.addSimParam(
'Simulator', flags.Sim.ISF.Simulator.value)
69 dbFiller.addSimParam(
'SimulationFlavour', flags.Sim.ISF.Simulator.value.replace(
'MT',
''))
72 dbFiller.addSimParam(
'Simulator',
'AtlasG4')
73 dbFiller.addSimParam(
'SimulationFlavour',
'AtlasG4')
77 simMDlog = logging.getLogger(
'Sim_Metadata')
78 from IOVDbMetaDataTools
import ParameterDbFiller
81 simMDlog.debug(
'ParameterDbFiller BeginRun = %s',
str(myRunNumber) )
82 dbFiller.setBeginRun(myRunNumber)
83 simMDlog.debug(
'ParameterDbFiller EndRun = %s',
str(myEndRunNumber) )
84 dbFiller.setEndRun(myEndRunNumber)
97 """Read digitization parameters metadata"""
98 from IOVDbSvc.IOVDbSvcConfig
import addFolders
99 if flags.Common.ProductionStep
not in [ProductionStep.Simulation, ProductionStep.FastChain]:
100 return addFolders(flags, folderName, className=
"AthenaAttributeList", tag=
"HEAD")
105 return addFolders(flags, folderName, detDb=
"SimParams.db", db=
"SIMPARAM", className=
"AthenaAttributeList")
109 """Write digitization parameters metadata"""
110 from IOVDbSvc.IOVDbSvcConfig
import IOVDbSvcCfg, addFolders
111 acc =
IOVDbSvcCfg(flags, FoldersToMetaData=[folderName])
112 acc.merge(
addFolders(flags, folderName, detDb=
"SimParams.db", db=
"SIMPARAM"))