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  flagsWithFile.lock()
35  result.merge(BunchGroupCondAlgCfg(flagsWithFile))
36  bgkey = 'L1BunchGroup'
37  else: # trust that we can use the in-file metadata
38  bgkey = ''
39  else:
40  from TrigConfigSvc.TrigConfigSvcCfg import BunchGroupCondAlgCfg
41  result.merge(BunchGroupCondAlgCfg(flags))
42  bgkey = 'L1BunchGroup'
43  elif flags.Beam.BunchStructureSource == BunchStructureSource.Lumi:
44  from .LuminosityCondAlgConfig import LuminosityCondAlgCfg
45  result.merge(LuminosityCondAlgCfg(flags))
46 
47  alg = CompFactory.BunchCrossingCondAlg('BunchCrossingCondAlgDefault',
48  Run1=run1,
49  FillParamsFolderKey=folder,
50  Mode=flags.Beam.BunchStructureSource.value,
51  TrigConfigSvc=cfgsvc,
52  L1BunchGroupCondData=bgkey)
53 
54  result.addCondAlgo(alg)
55 
56  return result
57 
58 
59 
60 if __name__=="__main__":
61  from AthenaConfiguration.AllConfigFlags import initConfigFlags
62  flags = initConfigFlags()
63  flags.Input.Files = []
64  flags.Input.isMC=False
65  flags.IOVDb.DatabaseInstance="CONDBR2"
66  flags.IOVDb.GlobalTag="CONDBR2-BLKPA-2017-05"
67  flags.lock()
68 
69  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
70  result=MainServicesCfg(flags)
71 
72  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
73  result.merge(McEventSelectorCfg(flags,
74  RunNumber=330470,
75  EventsPerRun=1,
76  FirstEvent=1183722158,
77  FirstLB=310,
78  EventsPerLB=1,
79  InitialTimeStamp=1500867637,
80  TimeStampInterval=1))
81 
82  result.merge(BunchCrossingCondAlgCfg(flags))
83 
84  BunchCrossingCondTest=CompFactory.BunchCrossingCondTest
85  result.addEventAlgo(BunchCrossingCondTest(FileName="BCData1.txt"))
86 
87  result.run(1)
88 
89  #f=open("test.pkl","wb")
90  #result.store(f)
91  #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:260
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