ATLAS Offline Software
BunchCrossingCondAlgConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.Enums import BunchStructureSource
6 
7 
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  folder = '/Digitization/Parameters'
18  from DigitizationConfig.DigitizationParametersConfig import readDigitizationParameters
19  result.merge(readDigitizationParameters(flags))
20  elif flags.Beam.BunchStructureSource == BunchStructureSource.FILLPARAMS:
21  folder = '/TDAQ/OLC/LHC/FILLPARAMS'
22  from IOVDbSvc.IOVDbSvcConfig import addFolders
23  result.merge(addFolders(flags,folder,'TDAQ',className = 'AthenaAttributeList',tag='HEAD'))
24  elif flags.Beam.BunchStructureSource == BunchStructureSource.TrigConf:
25  from TrigConfxAOD.TrigConfxAODConfig import getxAODConfigSvc
26  cfgsvc = result.getPrimaryAndMerge(getxAODConfigSvc(flags))
27  if cfgsvc.UseInFileMetadata:
28  if 'TriggerMenuJson_BG' not in flags.Input.MetadataItems:
29  # this is for when we need to configure the BunchGroupCondAlg with info extracted from converted JSON
30  # in this case avoid using the xAODConfigSvc, because it will be set up incorrectly
31  from TrigConfigSvc.TrigConfigSvcCfg import BunchGroupCondAlgCfg
32  flagsWithFile = flags.clone()
33  flagsWithFile.Trigger.triggerConfig = 'FILE'
34  result.merge(BunchGroupCondAlgCfg(flagsWithFile))
35  bgkey = 'L1BunchGroup'
36  else: # trust that we can use the in-file metadata
37  bgkey = ''
38  else:
39  from TrigConfigSvc.TrigConfigSvcCfg import BunchGroupCondAlgCfg
40  result.merge(BunchGroupCondAlgCfg(flags))
41  bgkey = 'L1BunchGroup'
42  elif flags.Beam.BunchStructureSource == BunchStructureSource.Lumi:
43  from .LuminosityCondAlgConfig import LuminosityCondAlgCfg
44  result.merge(LuminosityCondAlgCfg(flags))
45 
46  alg = CompFactory.BunchCrossingCondAlg('BunchCrossingCondAlgDefault',
47  Run1=run1,
48  FillParamsFolderKey=folder,
49  Mode=flags.Beam.BunchStructureSource.value,
50  TrigConfigSvc=cfgsvc,
51  L1BunchGroupCondData=bgkey)
52 
53  result.addCondAlgo(alg)
54 
55  return result
56 
57 
58 
59 if __name__=="__main__":
60  from AthenaConfiguration.AllConfigFlags import initConfigFlags
61  flags = initConfigFlags()
62  flags.Input.Files = []
63  flags.Input.isMC=False
64  flags.IOVDb.DatabaseInstance="CONDBR2"
65  flags.IOVDb.GlobalTag="CONDBR2-BLKPA-2017-05"
66  flags.lock()
67 
68  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
69  result=MainServicesCfg(flags)
70 
71  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
72  result.merge(McEventSelectorCfg(flags,
73  RunNumber=330470,
74  EventsPerRun=1,
75  FirstEvent=1183722158,
76  FirstLB=310,
77  EventsPerLB=1,
78  InitialTimeStamp=1500867637,
79  TimeStampInterval=1))
80 
81  result.merge(BunchCrossingCondAlgCfg(flags))
82 
83  BunchCrossingCondTest=CompFactory.BunchCrossingCondTest
84  result.addEventAlgo(BunchCrossingCondTest(FileName="BCData1.txt"))
85 
86  result.run(1)
87 
88  #f=open("test.pkl","wb")
89  #result.store(f)
90  #f.close()
python.DigitizationParametersConfig.readDigitizationParameters
def readDigitizationParameters(flags)
Definition: DigitizationParametersConfig.py:85
python.LuminosityCondAlgConfig.LuminosityCondAlgCfg
def LuminosityCondAlgCfg(flags, useOnlineLumi=None, suffix=None)
Definition: LuminosityCondAlgConfig.py:17
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TrigConfxAODConfig.getxAODConfigSvc
def getxAODConfigSvc(flags)
Definition: TrigConfxAODConfig.py:5
python.BunchGroupCondAlgConfig.BunchGroupCondAlgCfg
def BunchGroupCondAlgCfg(flags)
Definition: BunchGroupCondAlgConfig.py:14
python.BunchCrossingCondAlgConfig.BunchCrossingCondAlgCfg
def BunchCrossingCondAlgCfg(flags)
Definition: BunchCrossingCondAlgConfig.py:8
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
BunchCrossingCondTest
Definition: BunchCrossingCondTest.h:18
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19