ATLAS Offline Software
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',
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 
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  arg = True
60  if flag in ['doJetTagMon', 'doMissingEtMon', 'doTauMon']:
61  arg = lambda x: x.DQ.DataType is not DQDataType.Cosmics and x.Reco.HIMode is not HIMode.HI # noqa: E731
62  if flag in [ 'doJetMon','doJetTagMon'] :
63  arg = lambda x: x.DQ.DataType is not DQDataType.Cosmics # noqa: E731
64  if flag == 'doHLTMon':
65  # new HLT monitoring not yet compatible with pre-Run 3 data
66  # disable HLT monitoring if input is data AOD as not all HLT collections in AOD - ATR-28781
67  arg = lambda x: x.Trigger.EDMVersion == 3 and x.DQ.Environment != 'AOD' # noqa: E731
68  if flag == 'LVL1Calo.doValidation':
69  arg = False
70 
71  acf.addFlag('DQ.Steering.' + flag, arg)
72 
73  # HLT steering ...
74  from PyUtils.moduleExists import moduleExists
75  if moduleExists ('TrigHLTMonitoring'):
76  from TrigHLTMonitoring.TrigHLTMonitorAlgorithm import createHLTDQConfigFlags
77  acf.join(createHLTDQConfigFlags())
78  return acf
79 
80 def getUseTrigger(flags):
81  from PyUtils.moduleExists import moduleExists
82  hlt_exists = moduleExists ('TrigHLTMonitoring')
83  return hlt_exists and flags.DQ.triggerDataAvailable
84 
85 def getDataType(flags):
86  from AthenaConfiguration.Enums import BeamType
87  if flags.Input.isMC:
88  return DQDataType.MC
89  elif flags.Reco.EnableHI:
90  return DQDataType.HeavyIon
91  elif flags.Beam.Type is BeamType.Cosmics:
92  return DQDataType.Cosmics
93  elif flags.Beam.Type is BeamType.Collisions:
94  return DQDataType.Collisions
95  elif flags.Beam.Type is BeamType.SingleBeam:
96  # historically, singlebeam treated as collisions
97  return DQDataType.Collisions
98  else:
99  from AthenaCommon.Logging import logging
100  local_logger = logging.getLogger('DQConfigFlags_getDataType')
101  local_logger.warning('Unable to figure out beam type for DQ; using "User"')
102  return DQDataType.User
103 
104 def getEnvironment(flags):
105  if flags.Common.isOnline:
106  return 'online'
107  else:
108  # this could use being rethought to properly encode input and output types perhaps ...
109  from AthenaConfiguration.Enums import Format
110  if flags.Input.Format is Format.BS:
111  if flags.Output.AODFileName:
112  return 'tier0'
113  else:
114  return 'tier0Raw'
115  elif 'StreamESD' in flags.Input.ProcessingTags:
116  return 'tier0ESD'
117  elif 'StreamAOD' in flags.Input.ProcessingTags:
118  return 'AOD'
119  elif 'StreamDAOD_PHYS' in flags.Input.ProcessingTags:
120  return 'DAOD_PHYS'
121  else:
122  from AthenaCommon.Logging import logging
123  local_logger = logging.getLogger('DQConfigFlags_getEnvironment')
124  local_logger.warning('Unable to figure out environment for DQ; using "tier0ESD"')
125  return 'tier0ESD'
126 
127 
129  for flag in _steeringFlags:
130  setattr(getattr(flags, 'DQ.Steering'), flag, False)
python.DQConfigFlags.getUseTrigger
def getUseTrigger(flags)
Definition: DQConfigFlags.py:80
TrigHLTMonitorAlgorithm.createHLTDQConfigFlags
def createHLTDQConfigFlags()
Definition: TrigHLTMonitorAlgorithm.py:19
python.DQConfigFlags.allSteeringFlagsOff
def allSteeringFlagsOff(flags)
Definition: DQConfigFlags.py:128
python.DQConfigFlags.getEnvironment
def getEnvironment(flags)
Definition: DQConfigFlags.py:104
python.DQConfigFlags.getDataType
def getDataType(flags)
Definition: DQConfigFlags.py:85
python.DQConfigFlags.createDQConfigFlags
def createDQConfigFlags()
Definition: DQConfigFlags.py:35
python.DQConfigFlags.DQDataType
Definition: DQConfigFlags.py:26