ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TriggerCommon
TriggerJobOpts
python
PostExec.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
#
3
# This module contains postExec commands that can be used with the CA-based
4
# runHLT in athena(EF).
5
#
6
# Assumptions:
7
# - the final ComponentAccumulator instance is called 'cfg'
8
# - the ConfigFlags instance is called 'flags'
9
#
10
# Example usage:
11
# athenaEF -C 'from TriggerJobOpts import PostExec; PostExec.foo([args])' ... TriggerJobOpts.runHLT
12
# athena --postExec 'from TriggerJobOpts import PostExec; PostExec.foo([args])' TriggerJobOpts/runHLT.py
13
#
14
15
from
AthenaCommon.Logging
import
logging
16
log = logging.getLogger(
'TriggerJobOpts.PostExec'
)
17
18
# For convenience we provide access to the CA of the calling frame.
19
# This is where the `exec` of the post-commmand happens in athena or athenaEF.
20
cfg =
None
21
22
import
inspect
23
__postExec_frame = next(filter(
lambda
f : (
'TrigPSCPythonCASetup.py'
in
f.filename
or
24
'athenaEF.py'
in
f.filename
or
25
'runHLT.py'
in
f.filename), inspect.stack()),
None
)
26
if
__postExec_frame
is
not
None
:
27
__frame_members = dict(inspect.getmembers(__postExec_frame[0]))
28
# in athenaEF we find the CA in the locals() otherwise globals()
29
cfg = __frame_members[
'f_globals'
].
get
(
'cfg'
)
or
__frame_members[
'f_locals'
].
get
(
'cfg'
)
30
31
32
#
33
# PostExec functions
34
#
35
36
def
forceConditions
(run, lb, timestamp=None, iovDbSvc=None):
37
"""Force all conditions (except prescales) to match the given run and LB number, a timestamp can also be provided for MC"""
38
39
log.info(forceConditions.__doc__)
40
41
if
iovDbSvc
is
None
:
42
iovDbSvc = cfg.getService(
'IOVDbSvc'
)
43
44
# Do not override these folders:
45
ignore = [
'/TRIGGER/HLT/PrescaleKey'
]
# see ATR-22143
46
47
# All time-based folders (from IOVDbSvc DEBUG message, see athena!38274)
48
timebased = [
'/TDAQ/OLC/CALIBRATIONS'
,
49
'/TDAQ/Resources/ATLAS/SCT/Robins'
,
50
'/SCT/DAQ/Config/ChipSlim'
,
51
'/SCT/DAQ/Config/Geog'
,
52
'/SCT/DAQ/Config/MUR'
,
53
'/SCT/DAQ/Config/Module'
,
54
'/SCT/DAQ/Config/ROD'
,
55
'/SCT/DAQ/Config/RODMUR'
,
56
'/SCT/HLT/DCS/HV'
,
57
'/SCT/HLT/DCS/MODTEMP'
,
58
'/MUONALIGN/Onl/MDT/BARREL'
,
59
'/MUONALIGN/Onl/MDT/ENDCAP/SIDEA'
,
60
'/MUONALIGN/Onl/MDT/ENDCAP/SIDEC'
,
61
'/MUONALIGN/Onl/TGC/SIDEA'
,
62
'/MUONALIGN/Onl/TGC/SIDEC'
,
63
'/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts'
,
64
'/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib'
,
65
'/TRIGGER/L1Calo/V1/Calibration/JfexModuleSettings'
,
66
'/TRIGGER/L1Calo/V1/Calibration/JfexNoiseCuts'
,
67
'/TRIGGER/L1Calo/V1/Calibration/JfexSystemSettings'
,
68
'/TRIGGER/L1Calo/V1/Calibration/GfexModuleSettings'
]
69
70
if
timestamp
is
None
:
71
from
TrigCommon.AthHLT
import
get_sor_params
72
sor = get_sor_params(run)
73
timestamp = sor[
'SORTime'
] // int(1e9)
74
75
for
i,f
in
enumerate(iovDbSvc.Folders):
76
if
any(name
in
f
for
name
in
ignore):
77
continue
78
if
any(name
in
f
for
name
in
timebased):
79
iovDbSvc.Folders[i] += f
'<forceTimestamp>{timestamp:d}</forceTimestamp>'
80
else
:
81
iovDbSvc.Folders[i] += f
'<forceRunNumber>{run:d}</forceRunNumber> <forceLumiblockNumber>{lb:d}</forceLumiblockNumber>'
82
83
84
def
reverseViews
():
85
"""Process views in reverse order"""
86
87
log.info(reverseViews.__doc__)
88
89
from TriggerJobOpts.TriggerConfig import collectViewMakers
90
viewMakers = collectViewMakers( cfg.getSequence() )
91
for alg in viewMakers:
92
alg.ReverseViewsDebug = True
93
94
95
def dbmod_BFieldAutoConfig(): # DB modifier for debug recovery when using an online SMK
96
"""
Use DCS currents to configure magnetic field"""
97
98
log.info(dbmod_BFieldAutoConfig.__doc__)
99
100
from GaudiPython.Bindings import iProperty
101
# Add the DCS folder
102
f = '<db>COOLOFL_DCS/CONDBR2</db> /EXT/DCS/MAGNETS/SENSORDATA'
103
iProperty('IOVDbSvc').Folders += [f]
104
iProperty('CondInputLoader').Load.add(('CondAttrListCollection','/EXT/DCS/MAGNETS/SENSORDATA'))
105
# Configure CondAlgs
106
iProperty('AtlasFieldCacheCondAlg').UseDCS = True
107
iProperty('AtlasFieldMapCondAlg').LoadMapOnStart = False
108
iProperty('AtlasFieldMapCondAlg').UseMapsFromCOOL = True
109
iProperty('HltEventLoopMgr').setMagFieldFromPtree = False
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition
hcg.cxx:132
python.PostExec.reverseViews
reverseViews()
Definition
PostExec.py:84
python.PostExec.forceConditions
forceConditions(run, lb, timestamp=None, iovDbSvc=None)
Definition
PostExec.py:36
Generated on
for ATLAS Offline Software by
1.17.0