8 from AthenaConfiguration.ComponentFactory
import CompFactory
9 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
10 from AthenaConfiguration.Enums
import BeamType
11 from IOVDbSvc.IOVDbSvcConfig
import addFolders
12 from AthenaCommon.Logging
import logging
13 from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
14 from AthenaConfiguration.Enums
import ProductionStep
23 log = logging.getLogger (
'LuminosityCondAlgCfg')
24 name =
'LuminosityCondAlg'
27 if suffix
is None: suffix =
''
28 if useOnlineLumi
is not None and suffix
is None:
29 log.warning(
'useOnlineLumi argument is provided but not a suffix for the lumi object name. Is this really intended?')
32 kwargs = luminosityCondAlgMCCfg (flags, name, result)
33 elif ((useOnlineLumi
is None and flags.Common.useOnlineLumi)
34 or (useOnlineLumi
is not None and useOnlineLumi)):
35 kwargs = luminosityCondAlgOnlineCfg (flags, name, result)
36 elif flags.IOVDb.DatabaseInstance ==
'COMP200':
37 kwargs = luminosityCondAlgRun1Cfg (flags, name, result)
38 elif flags.IOVDb.DatabaseInstance ==
'CONDBR2':
39 kwargs = luminosityCondAlgRun2Cfg (flags, name, result)
42 log.warning (
"LuminosityCondAlgCfg can't resolve database instance = %s, assume Run2!" % flags.IOVDb.DatabaseInstance)
43 kwargs = luminosityCondAlgRun2Cfg (flags, name, result)
45 if flags.Common.ProductionStep
is ProductionStep.PileUpPretracking:
46 kwargs.setdefault(
"EventInfoKey", flags.Overlay.BkgPrefix +
"EventInfo")
47 kwargs.setdefault(
"actualMuKey", flags.Overlay.BkgPrefix +
"EventInfo.actualInteractionsPerCrossing")
48 kwargs.setdefault(
"averageMuKey", flags.Overlay.BkgPrefix +
"EventInfo.averageInteractionsPerCrossing")
50 LuminosityCondAlg=CompFactory.LuminosityCondAlg
52 alg = LuminosityCondAlg (name,
53 LuminosityOutputKey =
'LuminosityCondData' + suffix,
56 result.addCondAlgo (alg)
61 from DigitizationConfig.DigitizationParametersConfig
import readDigitizationParameters
63 return {
'LuminosityFolderInputKey' :
'',
64 'DigitizationFolderInputKey' :
'/Digitization/Parameters',
65 'OnlineLumiCalibrationInputKey' :
'',
66 'BunchLumisInputKey' :
'',
67 'BunchGroupInputKey' :
'',
68 'FillParamsInputKey' :
'',
74 log = logging.getLogger(name)
79 if flags.Common.doExpressProcessing:
80 lumiFolder =
"/TRIGGER/LUMI/OnlPrefLumi"
81 result.merge (addFolders (flags, lumiFolder,
'TRIGGER_ONL',
82 className =
'CondAttrListCollection'))
85 lumiFolder =
"/TRIGGER/OFLLUMI/OflPrefLumi"
86 result.merge (addFolders (flags, lumiFolder,
'TRIGGER_OFL',
87 className =
'CondAttrListCollection'))
89 log.info (
"luminosityCondAlgRun2Config requested %s", lumiFolder)
90 kwargs[
'LuminosityFolderInputKey'] = lumiFolder
92 log.info (
"Created Run2 %s using folder %s" % (name, lumiFolder))
95 from CoolLumiUtilities.OnlineLumiCalibrationCondAlgConfig \
96 import OnlineLumiCalibrationCondAlgCfg
98 olalg = result.getCondAlgo (
'OnlineLumiCalibrationCondAlg')
99 kwargs[
'OnlineLumiCalibrationInputKey'] = olalg.LumiCalibOutputKey
102 kwargs[
'BunchLumisInputKey'] =
''
103 kwargs[
'BunchGroupInputKey'] =
''
104 kwargs[
'FillParamsInputKey'] =
''
107 if flags.Beam.Type
is BeamType.Cosmics:
108 kwargs[
'ExpectInvalid'] =
True
115 log = logging.getLogger(name)
120 if flags.Common.doExpressProcessing:
121 lumiFolder =
"/TRIGGER/LUMI/LBLESTONL"
122 result.merge (addFolders (flags, lumiFolder,
'TRIGGER_ONL',
123 className =
'CondAttrListCollection'))
126 lumiFolder =
"/TRIGGER/OFLLUMI/LBLESTOFL"
127 result.merge (addFolders (flags, lumiFolder,
'TRIGGER_OFL',
128 className =
'CondAttrListCollection'))
130 log.info (
"configureLuminosityCondAlgRun1 requested %s", lumiFolder)
131 kwargs[
'LuminosityFolderInputKey'] = lumiFolder
134 from CoolLumiUtilities.FillParamsCondAlgConfig \
135 import FillParamsCondAlgCfg
136 result.merge (FillParamsCondAlgCfg (flags))
137 fpalg = result.getCondAlgo (
'FillParamsCondAlg')
138 kwargs[
'FillParamsInputKey'] = fpalg.FillParamsOutputKey
140 from CoolLumiUtilities.BunchLumisCondAlgConfig \
141 import BunchLumisCondAlgCfg
142 result.merge (BunchLumisCondAlgCfg (flags))
143 blalg = result.getCondAlgo (
'BunchLumisCondAlg')
144 kwargs[
'BunchLumisInputKey'] = blalg.BunchLumisOutputKey
146 from CoolLumiUtilities.BunchGroupCondAlgConfig \
147 import BunchGroupCondAlgCfg
148 result.merge (BunchGroupCondAlgCfg (flags))
149 bgalg = result.getCondAlgo (
'BunchGroupCondAlg')
150 kwargs[
'BunchGroupInputKey'] = bgalg.BunchGroupOutputKey
152 from CoolLumiUtilities.OnlineLumiCalibrationCondAlgConfig \
153 import OnlineLumiCalibrationCondAlgCfg
154 result.merge (OnlineLumiCalibrationCondAlgCfg (flags))
155 olalg = result.getCondAlgo (
'OnlineLumiCalibrationCondAlg')
156 kwargs[
'OnlineLumiCalibrationInputKey'] = olalg.LumiCalibOutputKey
164 log = logging.getLogger(name)
169 kwargs[
'SkipInvalid'] =
False
171 if flags.IOVDb.DatabaseInstance ==
'COMP200':
172 folder =
"/TRIGGER/LUMI/LBLESTONL"
173 result.merge (addFolders (flags, folder,
'TRIGGER_ONL',
174 className =
'CondAttrListCollection'))
177 if flags.IOVDb.DatabaseInstance !=
'CONDBR2':
178 log.warning(
"LuminosityCondAlgOnlineCfg can't resolve DatabaseInstance = %s, assuming CONDBR2!", flags.IOVDb.DatabaseInstance)
180 folder =
"/TRIGGER/LUMI/HLTPrefLumi"
181 result.merge (addFolders (flags, folder,
'TRIGGER_ONL',
182 className =
'CondAttrListCollection',
183 extensible = flags.Trigger.doHLT
and flags.Trigger.Online.isPartition))
185 kwargs[
'LuminosityFolderInputKey'] = folder
186 log.info (
"Created online %s using folder %s" % (name, folder))
189 from CoolLumiUtilities.OnlineLumiCalibrationCondAlgConfig \
190 import OnlineLumiCalibrationCondAlgCfg
192 olalg = result.getCondAlgo (
'OnlineLumiCalibrationCondAlg')
193 kwargs[
'OnlineLumiCalibrationInputKey'] = olalg.LumiCalibOutputKey
196 kwargs[
'BunchLumisInputKey'] =
''
197 kwargs[
'BunchGroupInputKey'] =
''
198 kwargs[
'FillParamsInputKey'] =
''
203 if __name__ ==
"__main__":
204 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
205 from AthenaConfiguration.TestDefaults
import defaultTestFiles
209 flags1.Input.Files = defaultTestFiles.RAW_RUN2
211 acc1 = LuminosityCondAlgCfg (flags1)
212 acc1.printCondAlgs(summariseProps=
True)
213 print (
'IOVDbSvc:', acc1.getService(
'IOVDbSvc').Folders)
216 print (
'--- run2/express')
218 flags2.Input.Files = defaultTestFiles.RAW_RUN2
219 flags2.Common.doExpressProcessing =
True
221 acc2 = LuminosityCondAlgCfg (flags2)
222 acc2.printCondAlgs(summariseProps=
True)
223 print (
'IOVDbSvc:', acc2.getService(
'IOVDbSvc').Folders)
228 flags3.Input.Files = defaultTestFiles.RAW_RUN2
229 flags3.Input.ProjectName =
'data12_8TeV'
231 acc3 = LuminosityCondAlgCfg (flags3)
232 acc3.printCondAlgs(summariseProps=
True)
233 print (
'IOVDbSvc:', acc3.getService(
'IOVDbSvc').Folders)
236 print (
'--- run1/express')
238 flags4.Input.Files = defaultTestFiles.RAW_RUN2
239 flags4.Input.ProjectName =
'data12_8TeV'
240 flags4.Common.doExpressProcessing =
True
242 acc4 = LuminosityCondAlgCfg (flags4)
243 acc4.printCondAlgs(summariseProps=
True)
244 print (
'IOVDbSvc:', acc4.getService(
'IOVDbSvc').Folders)
249 flags5.Input.Files = defaultTestFiles.ESD
251 acc5 = LuminosityCondAlgCfg (flags5)
252 acc5.printCondAlgs(summariseProps=
True)
257 flags6.Input.Files = defaultTestFiles.RAW_RUN2
258 flags6.Common.useOnlineLumi =
True
260 acc6 = LuminosityCondAlgCfg (flags6)
261 acc6.printCondAlgs(summariseProps=
True)
264 print (
'--- forced online')
266 flags7.Input.Files = defaultTestFiles.RAW_RUN2
268 acc7 = LuminosityCondAlgCfg (flags7, useOnlineLumi=
True, suffix=
'Online')
269 acc7.printCondAlgs(summariseProps=
True)