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['PprChanStrategy'] = '/TRIGGER/Receivers/Conditions/Strategy'
40  L1CaloFolders['DerivedRunPars'] = '/TRIGGER/L1Calo/V1/Conditions/DerivedRunPars'
41 
42 
43  L1CaloFolders['PprChanDefaults'] = '/TRIGGER/L1Calo/V2/Configuration/PprChanDefaults'
44  # Different folders for data and MC
45  ver = 'V2' if flags.Input.isMC else 'V1'
46  L1CaloFolders['DisabledTowers'] = f'/TRIGGER/L1Calo/{ver}/Conditions/DisabledTowers'
47  L1CaloFolders['PpmDeadChannels'] = f'/TRIGGER/L1Calo/{ver}/Calibration/PpmDeadChannels'
48 
49 
50  from IOVDbSvc.IOVDbSvcConfig import addFolders
51  db = 'TRIGGER_ONL' if not flags.Input.isMC else 'TRIGGER_OFL'
52  result = addFolders(flags,[xx for x in L1CaloFolders.values() if isinstance(x,list) for xx in x if xx!=""] +
53  [x for x in L1CaloFolders.values() if not isinstance(x,list)], db, className='CondAttrListCollection')
54 
55  from AthenaConfiguration.ComponentFactory import CompFactory
56 
57  alg = CompFactory.L1CaloCondAlg(UsePhysicsRegime = Physics,
58  UseCalib1Regime = Calib1,
59  UseCalib2Regime = Calib2)
60  for k,v in L1CaloFolders.items(): setattr(alg,k,v)
61 
62  if flags.Input.isMC:
63  # some conditions containers are not created for MC
64  alg.OutputKeyDerRunsPars = ""
65  alg.OutputKeyTimeRefs = ""
66  alg.OutputKeyRunParameters = ""
67  alg.OutputKeyPprChanStrategy = ""
68  alg.OutputKeyPprConditionsRun2 = ""
69  alg.OutputKeyReadoutConfig = ""
70  alg.OutputKeyReadoutConfigJSON = ""
71 
72  result.addCondAlgo(alg)
73 
74  if readTest:
75  # Set True for test L1CaloCondAlg and print condition container parameters
76  L1CaloCondReader = CompFactory.L1CaloCondAlgReader()
77  result.addEventAlgo(L1CaloCondReader, 'AthAlgSeq')
78 
79 
80  return result
81 
82 
83 if __name__=="__main__":
84 
85  from AthenaConfiguration.AllConfigFlags import initConfigFlags
86  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
87 
88  flags = initConfigFlags()
89  flags.Input.Files = defaultTestFiles.RAW_RUN2
90  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
91  flags.Exec.MaxEvents = 1
92  flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2022-02'
93  flags.Trigger.enableL1CaloLegacy = True
94  flags.fillFromArgs()
95  flags.lock()
96 
97  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
98  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
99  from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamDecoderCfg
100  from TrigT1CaloByteStream.LVL1CaloRun2ByteStreamConfig import LVL1CaloRun2ReadBSCfg
101 
102 
103  acc = MainServicesCfg(flags)
104  acc.merge( ByteStreamReadCfg(flags) )
105  acc.merge( L1TriggerByteStreamDecoderCfg(flags) )
106  acc.merge( LVL1CaloRun2ReadBSCfg(flags))
107 
108 
113  acc.merge(L1CaloCondAlgCfg(flags, Physics=True, Calib1=False, Calib2=False))
114 
115  #Example ...
116  #acc.merge(L1CaloCondAlgCfg(flags,readTest=True, Physics=True, Calib1=False, Calib2=False))
117  #acc.getCondAlgo('L1CaloCondAlg').OutputLevel = 2
118  #acc.getCondAlgo('L1CaloCondAlg').timingRegime = "Calib2"
119  #acc.getCondAlgo('L1CaloCondAlg').strategy = "LowMu"
120 
121 
122 
123 
124 
125  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