ATLAS Offline Software
L1CaloCondConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 import sys
4 
5 
6 def L1CaloCondAlgCfg(flags, readTest=False, Physics=True, Calib1=False, Calib2=False):
7  # The three flags: Physics, Calib1, Calib2 are the timing regimes that should or should not be supported
8  # i.e. should the required necessary folders be loaded for these regimes or not.
9  # default is only the Physics timing regime is loaded. If Calib1 or Calib2 are found in the DerivedRunPars
10  # then this will lead to error unless Calib1 and/or Calib2 is True.
11 
12  L1CaloFolders = {} # will use this dict to populate condalg properties below
13 
14  # both data and mc have this folder
15  L1CaloFolders['PhysicsKeys'] = ['/TRIGGER/L1Calo/V2/Calibration/Physics/PprChanCalib']
16 
17  if not flags.Input.isMC:
18  # folders only existing or used if running on data
19  if Physics:
20  L1CaloFolders['PhysicsKeys'] += ['/TRIGGER/L1Calo/V2/Calibration/Physics/PprChanCommon',
21  '/TRIGGER/L1Calo/V2/Calibration/Physics/PprChanHighMu',
22  '/TRIGGER/L1Calo/V2/Calibration/Physics/PprChanLowMu']
23  if Calib1:
24  L1CaloFolders['Calib1Keys'] = ['/TRIGGER/L1Calo/V2/Calibration/Calib1/PprChanCalib',
25  '/TRIGGER/L1Calo/V2/Calibration/Calib1/PprChanCommon',
26  '/TRIGGER/L1Calo/V2/Calibration/Calib1/PprChanHighMu',
27  '/TRIGGER/L1Calo/V2/Calibration/Calib1/PprChanLowMu']
28  if Calib2:
29  L1CaloFolders['Calib2Keys'] = ['/TRIGGER/L1Calo/V2/Calibration/Calib2/PprChanCalib',
30  '/TRIGGER/L1Calo/V2/Calibration/Calib2/PprChanCommon',
31  '/TRIGGER/L1Calo/V2/Calibration/Calib2/PprChanHighMu',
32  '/TRIGGER/L1Calo/V2/Calibration/Calib2/PprChanLowMu']
33 
34  L1CaloFolders['ReadoutConfig'] = "/TRIGGER/L1Calo/V2/Configuration/ReadoutConfig"
35  L1CaloFolders['ReadoutConfigJSON'] = "/TRIGGER/L1Calo/V2/Configuration/ReadoutConfigJSON"
36  L1CaloFolders['PprChanStrategy'] = "/TRIGGER/L1Calo/V2/Configuration/PprChanStrategy"
37  L1CaloFolders['PpmFineTimeRefs'] = "/TRIGGER/L1Calo/V1/References/FineTimeReferences"
38  L1CaloFolders['RunParameters'] = "/TRIGGER/L1Calo/V1/Conditions/RunParameters"
39  L1CaloFolders['DerivedRunPars'] = '/TRIGGER/L1Calo/V1/Conditions/DerivedRunPars'
40 
41 
42  L1CaloFolders['PprChanDefaults'] = '/TRIGGER/L1Calo/V2/Configuration/PprChanDefaults'
43  # Different folders for data and MC
44  ver = 'V2' if flags.Input.isMC else 'V1'
45  L1CaloFolders['DisabledTowers'] = f'/TRIGGER/L1Calo/{ver}/Conditions/DisabledTowers'
46  L1CaloFolders['PpmDeadChannels'] = f'/TRIGGER/L1Calo/{ver}/Calibration/PpmDeadChannels'
47 
48 
49  from IOVDbSvc.IOVDbSvcConfig import addFolders
50  db = 'TRIGGER_ONL' if not flags.Input.isMC else 'TRIGGER_OFL'
51  result = addFolders(flags,[xx for x in L1CaloFolders.values() if isinstance(x,list) for xx in x if xx!=""] +
52  [x for x in L1CaloFolders.values() if not isinstance(x,list)], db, className='CondAttrListCollection')
53 
54  from AthenaConfiguration.ComponentFactory import CompFactory
55 
56  alg = CompFactory.L1CaloCondAlg(UsePhysicsRegime = Physics,
57  UseCalib1Regime = Calib1,
58  UseCalib2Regime = Calib2)
59  for k,v in L1CaloFolders.items(): setattr(alg,k,v)
60 
61  if flags.Input.isMC:
62  # some conditions containers are not created for MC
63  alg.OutputKeyDerRunsPars = ""
64  alg.OutputKeyTimeRefs = ""
65  alg.OutputKeyRunParameters = ""
66  alg.OutputKeyPprChanStrategy = ""
67  alg.OutputKeyPprConditionsRun2 = ""
68  alg.OutputKeyReadoutConfig = ""
69  alg.OutputKeyReadoutConfigJSON = ""
70 
71  result.addCondAlgo(alg)
72 
73  if readTest:
74  # Set True for test L1CaloCondAlg and print condition container parameters
75  L1CaloCondReader = CompFactory.L1CaloCondAlgReader()
76  result.addEventAlgo(L1CaloCondReader, 'AthAlgSeq')
77 
78 
79  return result
80 
81 
82 if __name__=="__main__":
83 
84  from AthenaConfiguration.AllConfigFlags import initConfigFlags
85  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
86 
87  flags = initConfigFlags()
88  flags.Input.Files = defaultTestFiles.RAW_RUN2
89  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
90  flags.Exec.MaxEvents = 1
91  flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2022-02'
92  flags.Trigger.enableL1CaloLegacy = True
93  flags.fillFromArgs()
94  flags.lock()
95 
96  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
97  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
98  from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamDecoderCfg
99  from TrigT1CaloByteStream.LVL1CaloRun2ByteStreamConfig import LVL1CaloRun2ReadBSCfg
100 
101 
102  acc = MainServicesCfg(flags)
103  acc.merge( ByteStreamReadCfg(flags) )
104  acc.merge( L1TriggerByteStreamDecoderCfg(flags) )
105  acc.merge( LVL1CaloRun2ReadBSCfg(flags))
106 
107 
112  acc.merge(L1CaloCondAlgCfg(flags, Physics=True, Calib1=False, Calib2=False))
113 
114  #Example ...
115  #acc.merge(L1CaloCondAlgCfg(flags,readTest=True, Physics=True, Calib1=False, Calib2=False))
116  #acc.getCondAlgo('L1CaloCondAlg').OutputLevel = 2
117  #acc.getCondAlgo('L1CaloCondAlg').timingRegime = "Calib2"
118  #acc.getCondAlgo('L1CaloCondAlg').strategy = "LowMu"
119 
120 
121 
122 
123 
124  sys.exit(acc.run().isFailure())
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
LVL1CaloRun2ByteStreamConfig.LVL1CaloRun2ReadBSCfg
def LVL1CaloRun2ReadBSCfg(flags, forRoIBResultToxAOD=False)
Definition: LVL1CaloRun2ByteStreamConfig.py:121
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
L1CaloCondConfig.L1CaloCondAlgCfg
def L1CaloCondAlgCfg(flags, readTest=False, Physics=True, Calib1=False, Calib2=False)
Definition: L1CaloCondConfig.py:6
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
TrigT1ResultByteStreamConfig.L1TriggerByteStreamDecoderCfg
def L1TriggerByteStreamDecoderCfg(flags, returnEDM=False)
Definition: TrigT1ResultByteStreamConfig.py:132