ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaMonitoring
python
DQConfigFlags.py
Go to the documentation of this file.
1
#
2
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
#
4
5
from
AthenaConfiguration.AthConfigFlags
import
AthConfigFlags
6
from
AthenaConfiguration.Enums
import
FlagEnum,HIMode
7
8
_steeringFlags = [
'doGlobalMon'
,
'doLVL1CaloMon'
,
'doLVL1InterfacesMon'
,
'doCTPMon'
,
'doHLTMon'
,
9
'doPixelMon'
,
'doSCTMon'
,
'doTRTMon'
,
'doInDetMon'
,
10
'doLArMon'
,
'doTileMon'
,
11
'doCaloGlobalMon'
,
'doMuonMon'
,
12
'doLucidMon'
,
'doAFPMon'
,
'doZDCMon'
,
13
'doHIMon'
,
'doEgammaMon'
,
'doJetMon'
,
'doMissingEtMon'
,
14
'doJetInputsMon'
,
15
'doTauMon'
,
'doJetTagMon'
,
'doDataFlowMon'
]
16
17
_lowLevelSteeringFlags = [
'InDet.doGlobalMon'
,
'InDet.doAlignMon'
,
18
'InDet.doPerfMon'
,
'Muon.doRawMon'
,
19
'Muon.doTrackMon'
,
'Muon.doAlignMon'
,
20
'Muon.doSegmentMon'
,
21
'Muon.doPhysicsMon'
,
'Muon.doTrkPhysMon'
,
22
'Muon.doCombinedMon'
,
'LVL1Calo.doValidation'
23
]
24
25
26
class
DQDataType
(FlagEnum):
27
"""Flag values for DQ.DataType"""
28
Collisions =
'collisions'
29
Cosmics =
'cosmics'
30
HeavyIon =
'heavyioncollisions'
31
MC =
'monteCarlo'
32
User =
'user'
33
34
35
def
createDQConfigFlags
():
36
acf=AthConfigFlags()
37
acf.addFlag(
'DQ.doMonitoring'
,
False
)
38
acf.addFlag(
'DQ.doStreamAwareMon'
,
True
)
39
acf.addFlag(
'DQ.disableAtlasReadyFilter'
,
False
)
40
acf.addFlag(
'DQ.disableFilledBunchFilter'
,
False
)
41
acf.addFlag(
'DQ.enableLumiAccess'
,
True
)
42
acf.addFlag(
'DQ.FileKey'
,
'CombinedMonitoring'
)
43
# two flags here, with different meaning.
44
# triggerDataAvailable determines whether we expect trigger objects in the event store
45
acf.addFlag(
'DQ.triggerDataAvailable'
,
True
)
46
# useTrigger determines whether we should use TrigDecisionTool
47
acf.addFlag(
'DQ.useTrigger'
, getUseTrigger)
48
49
# computed
50
acf.addFlag(
'DQ.Environment'
, getEnvironment )
51
acf.addFlag(
'DQ.DataType'
, getDataType, type=DQDataType )
52
53
# for in-Athena histogram postprocessing
54
acf.addFlag(
'DQ.doPostProcessing'
,
False
)
55
acf.addFlag(
'DQ.postProcessingInterval'
, 100)
56
57
# steering ...
58
for
flag
in
_steeringFlags + _lowLevelSteeringFlags:
59
if
flag ==
'doLVL1CaloMon'
:
60
continue
61
arg =
True
62
if
flag
in
[
'doJetTagMon'
,
'doMissingEtMon'
,
'doTauMon'
]:
63
arg =
lambda
x: x.DQ.DataType
is
not
DQDataType.Cosmics
and
x.Reco.HIMode
is
not
HIMode.HI
# noqa: E731
64
if
flag
in
[
'doJetMon'
,
'doJetTagMon'
] :
65
arg =
lambda
x: x.DQ.DataType
is
not
DQDataType.Cosmics
# noqa: E731
66
if
flag ==
'doHLTMon'
:
67
# new HLT monitoring not yet compatible with pre-Run 3 data
68
# disable HLT monitoring if input is data AOD as not all HLT collections in AOD - ATR-28781
69
arg =
lambda
x: x.Trigger.EDMVersion == 3
and
x.DQ.Environment !=
'AOD'
# noqa: E731
70
if
flag ==
'LVL1Calo.doValidation'
:
71
arg =
False
72
if
flag ==
'doZDCMon'
:
73
arg=
lambda
x: (x.Reco.EnableZDC
is
True
)
# noqa: E731
74
acf.addFlag(
'DQ.Steering.'
+ flag, arg)
75
76
# special protection for L1Calo monitoring : check L1Calo is indeed in
77
acf.addFlag(
'DQ.Steering.doLVL1CaloMon'
, _hasL1Calo)
78
79
# HLT steering ...
80
from
PyUtils.moduleExists
import
moduleExists
81
if
moduleExists (
'TrigHLTMonitoring'
):
82
from
TrigHLTMonitoring.TrigHLTMonitorAlgorithm
import
createHLTDQConfigFlags
83
acf.join(createHLTDQConfigFlags())
84
return
acf
85
86
def
getUseTrigger
(flags):
87
from
PyUtils.moduleExists
import
moduleExists
88
hlt_exists = moduleExists (
'TrigHLTMonitoring'
)
89
return
hlt_exists
and
flags.DQ.triggerDataAvailable
90
91
def
getDataType
(flags):
92
from
AthenaConfiguration.Enums
import
BeamType
93
if
flags.Input.isMC:
94
return
DQDataType.MC
95
elif
flags.Reco.EnableHI:
96
return
DQDataType.HeavyIon
97
elif
flags.Beam.Type
is
BeamType.Cosmics:
98
return
DQDataType.Cosmics
99
elif
flags.Beam.Type
is
BeamType.Collisions:
100
return
DQDataType.Collisions
101
elif
flags.Beam.Type
is
BeamType.SingleBeam:
102
# historically, singlebeam treated as collisions
103
return
DQDataType.Collisions
104
else
:
105
from
AthenaCommon.Logging
import
logging
106
local_logger = logging.getLogger(
'DQConfigFlags_getDataType'
)
107
local_logger.warning(
'Unable to figure out beam type for DQ; using "User"'
)
108
return
DQDataType.User
109
110
def
getEnvironment
(flags):
111
if
flags.Common.isOnline:
112
return
'online'
113
else
:
114
# this could use being rethought to properly encode input and output types perhaps ...
115
from
AthenaConfiguration.Enums
import
Format
116
if
flags.Input.Format
is
Format.BS:
117
if
flags.Output.AODFileName:
118
return
'tier0'
119
else
:
120
return
'tier0Raw'
121
elif
'StreamESD'
in
flags.Input.ProcessingTags:
122
return
'tier0ESD'
123
elif
'StreamAOD'
in
flags.Input.ProcessingTags:
124
return
'AOD'
125
elif
'StreamDAOD_PHYS'
in
flags.Input.ProcessingTags:
126
return
'DAOD_PHYS'
127
else
:
128
from
AthenaCommon.Logging
import
logging
129
local_logger = logging.getLogger(
'DQConfigFlags_getEnvironment'
)
130
local_logger.warning(
'Unable to figure out environment for DQ; using "tier0ESD"'
)
131
return
'tier0ESD'
132
133
def
_hasL1Calo
(flags):
134
from
AthenaConfiguration.AutoConfigFlags
import
GetFileMD
135
md = GetFileMD(flags.Input.Files)
136
import
eformat
137
detMask = eformat.helper.DetectorMask(f
'{md.get("detectorMask",[0x0])[0]:032x}'
)
138
isEnabled = any([
139
detMask.is_set(eformat.helper.SubDetector.TDAQ_CALO_PREPROC),
140
detMask.is_set(eformat.helper.SubDetector.TDAQ_CALO_TOPO_PROC),
141
detMask.is_set(eformat.helper.SubDetector.TDAQ_CALO_FEAT_EXTRACT_DAQ),
142
detMask.is_set(eformat.helper.SubDetector.TDAQ_CALO_FEAT_EXTRACT_ROI)])
143
return
isEnabled
144
145
def
allSteeringFlagsOff
(flags):
146
for
flag
in
_steeringFlags:
147
setattr(getattr(flags,
'DQ.Steering'
), flag,
False
)
python.DQConfigFlags.DQDataType
Definition
DQConfigFlags.py:26
python.DQConfigFlags._hasL1Calo
_hasL1Calo(flags)
Definition
DQConfigFlags.py:133
python.DQConfigFlags.createDQConfigFlags
createDQConfigFlags()
Definition
DQConfigFlags.py:35
python.DQConfigFlags.allSteeringFlagsOff
allSteeringFlagsOff(flags)
Definition
DQConfigFlags.py:145
python.DQConfigFlags.getDataType
getDataType(flags)
Definition
DQConfigFlags.py:91
python.DQConfigFlags.getUseTrigger
getUseTrigger(flags)
Definition
DQConfigFlags.py:86
python.DQConfigFlags.getEnvironment
getEnvironment(flags)
Definition
DQConfigFlags.py:110
Generated on
for ATLAS Offline Software by
1.17.0