3 from AthenaCommon.Logging
import logging
4 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
5 from AthenaConfiguration.Enums
import FlagEnum
6 from AthenaKernel.EventIdOverrideConfig
import getMinMaxRunNumbers
8 folderName =
"/Digitization/Parameters"
12 from IOVDbMetaDataTools
import ParameterDbFiller
15 logDigitizationWriteMetadata = logging.getLogger(
'DigitizationParametersConfig' )
16 logDigitizationWriteMetadata.debug(
'ParameterDbFiller BeginRun = %s',
str(myRunNumber) )
17 dbFiller.setBeginRun(myRunNumber)
18 logDigitizationWriteMetadata.debug(
'ParameterDbFiller EndRun = %s',
str(myEndRunNumber) )
19 dbFiller.setEndRun(myEndRunNumber)
24 digitMetaDataKeys = {
'doInDetNoise' :
'Digitization.DoInnerDetectorNoise',
25 'doCaloNoise' :
'Digitization.DoCaloNoise',
26 'bunchSpacing' :
'Beam.BunchSpacing',
27 'beamType' :
'Beam.Type',
28 'IOVDbGlobalTag' :
'IOVDb.GlobalTag',
29 'DetDescrVersion' :
'GeoModel.AtlasVersion',
30 'finalBunchCrossing' :
'Digitization.PU.FinalBunchCrossing',
31 'initialBunchCrossing' :
'Digitization.PU.InitialBunchCrossing',
32 'physicsList' :
'Sim.PhysicsList',
33 'digiSteeringConf' :
'Digitization.DigiSteeringConf',
34 'pileUp' :
'Digitization.PileUp',
36 logDigitizationWriteMetadata.info(
'Filling Digitization MetaData')
37 for testKey, testFlag
in digitMetaDataKeys.items():
38 if flags.hasFlag(testFlag):
39 testValue = flags._get(testFlag)
40 if isinstance(testValue, FlagEnum):
41 testValue = testValue.value
42 if not isinstance(testValue, str):
43 testValue =
str(testValue)
44 dbFiller.addDigitParam(testKey, testValue)
45 logDigitizationWriteMetadata.info(
'DigitizationMetaData: setting "%s" to be %s', testKey, testValue)
47 logDigitizationWriteMetadata.debug(
'DigitizationMetaData: ConfigFlags.%s is not available.', testFlag)
51 testKey =
"doMuonNoise"
52 testValue =
str(
not flags.Common.isOverlay)
53 dbFiller.addDigitParam(testKey, testValue)
54 logDigitizationWriteMetadata.info(
'DigitizationMetaData: setting "%s" to be %s', testKey, testValue)
57 testKey =
"BeamIntensityPattern"
58 if flags.Digitization.PileUp:
59 testValue =
str(flags.Digitization.PU.BeamIntensityPattern)
62 logDigitizationWriteMetadata.info(
'DigitizationMetaData: setting "%s" to be %s', testKey, testValue)
63 dbFiller.addDigitParam64(testKey, testValue)
66 testKey =
"intraTrainBunchSpacing"
68 dbFiller.addDigitParam(testKey, testValue)
69 logDigitizationWriteMetadata.info(
'DigitizationMetaData: setting "%s" to be %s', testKey, testValue)
72 from AthenaConfiguration.DetectorConfigFlags
import getEnabledDetectors
74 logDigitizationWriteMetadata.info(
"Setting 'DigitizedDetectors' = %s" ,
repr(digiDets))
75 dbFiller.addDigitParam(
'DigitizedDetectors',
repr(digiDets))
86 """Read digitization parameters metadata"""
87 from IOVDbSvc.IOVDbSvcConfig
import addFolders
88 if flags.Digitization.ReadParametersFromDB:
92 return addFolders(flags, folderName, detDb=
"DigitParams.db", db=
"DIGPARAM", className=
"AthenaAttributeList")
93 return addFolders(flags, folderName, className=
"AthenaAttributeList", tag=
"HEAD")
97 """Write digitization parameters metadata"""
98 if flags.Overlay.DataOverlay:
101 from IOVDbSvc.IOVDbSvcConfig
import IOVDbSvcCfg, addFolders
102 acc =
IOVDbSvcCfg(flags, FoldersToMetaData=[folderName])
103 acc.merge(
addFolders(flags, folderName, detDb=
"DigitParams.db", db=
"DIGPARAM"))