8def BunchCrossingCondAlgCfg(flags):
9 result=ComponentAccumulator()
10
11 run1 = flags.IOVDb.DatabaseInstance == 'COMP200'
12 cfgsvc = None
13 folder = ''
14 bgkey = ''
15
16 if flags.Beam.BunchStructureSource == BunchStructureSource.MC:
17
18
19 from AthenaConfiguration.Enums import Format
20
21 if flags.Input.Format != Format.BS or not flags.Input.Files:
22 folder = '/Digitization/Parameters'
23 from DigitizationConfig.DigitizationParametersConfig import readDigitizationParameters
24 result.merge(readDigitizationParameters(flags))
25 else:
26
27 folder = ''
28 elif flags.Beam.BunchStructureSource == BunchStructureSource.FILLPARAMS:
29 folder = '/TDAQ/OLC/LHC/FILLPARAMS'
30 from IOVDbSvc.IOVDbSvcConfig import addFolders
31 result.merge(addFolders(flags,folder,'TDAQ',className = 'AthenaAttributeList',tag='HEAD'))
32 elif flags.Beam.BunchStructureSource == BunchStructureSource.TrigConf:
33 from TrigConfxAOD.TrigConfxAODConfig import getxAODConfigSvc
34 cfgsvc = result.getPrimaryAndMerge(getxAODConfigSvc(flags))
35 if cfgsvc.UseInFileMetadata:
36 if 'TriggerMenuJson_BG' not in flags.Input.MetadataItems:
37
38
39 from TrigConfigSvc.TrigConfigSvcCfg import BunchGroupCondAlgCfg
40 flagsWithFile = flags.clone()
41 flagsWithFile.Trigger.triggerConfig = 'FILE'
42 flagsWithFile.lock()
43 result.merge(BunchGroupCondAlgCfg(flagsWithFile))
44 bgkey = 'L1BunchGroup'
45 else:
46 bgkey = ''
47 else:
48 from TrigConfigSvc.TrigConfigSvcCfg import BunchGroupCondAlgCfg
49 result.merge(BunchGroupCondAlgCfg(flags))
50 bgkey = 'L1BunchGroup'
51 elif flags.Beam.BunchStructureSource == BunchStructureSource.Lumi:
52 from .LuminosityCondAlgConfig import LuminosityCondAlgCfg
53 result.merge(LuminosityCondAlgCfg(flags))
54
55 alg = CompFactory.BunchCrossingCondAlg('BunchCrossingCondAlgDefault',
56 Run1=run1,
57 FillParamsFolderKey=folder,
58 Mode=flags.Beam.BunchStructureSource.value,
59 TrigConfigSvc=cfgsvc,
60 L1BunchGroupCondData=bgkey)
61
62 result.addCondAlgo(alg)
63
64 return result
65
66
67