ATLAS Offline Software
AthenaMonitoringCfg.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from .AthenaMonitoringAODRecoCfg import AthenaMonitoringAODRecoCfg
5 from AthenaConfiguration.Enums import LHCPeriod
6 
7 def AthenaMonitoringCfg(flags):
8  import logging
9  local_logger = logging.getLogger('AthenaMonitoringCfg')
10  info = local_logger.info
11  debug = local_logger.debug
12  warning = local_logger.warning
13  error = local_logger.error
14  result = ComponentAccumulator()
15 
16  result.merge(AthenaMonitoringAODRecoCfg(flags))
17 
18  if flags.DQ.Steering.doPixelMon and flags.GeoModel.Run is not LHCPeriod.Run1:
19  # Not run for Run-1 (see ATR-25274)
20  info('Set up Pixel monitoring')
21  from PixelMonitoring.PixelMonitoringConfig import PixelMonitoringConfig
22  result.merge(PixelMonitoringConfig(flags))
23 
24  if flags.DQ.Steering.doSCTMon:
25  info('Set up SCT monitoring')
26  from SCT_Monitoring.SCTMonitoringConfig import SCTMonitoringConfig
27  result.merge(SCTMonitoringConfig(flags))
28 
29  if flags.DQ.Steering.doTRTMon:
30  info('Set up TRT monitoring')
31  from TRTMonitoringRun3.TRTMonitoringRun3Config import TRTMonitoringRun3Cfg
32  result.merge(TRTMonitoringRun3Cfg(flags))
33 
34  if flags.DQ.Steering.doInDetMon:
35  if flags.DQ.Steering.InDet.doGlobalMon:
36  info('Set up InDet Global monitoring')
37  from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConfig import InDetGlobalMonitoringRun3TestConfig
38  result.merge(InDetGlobalMonitoringRun3TestConfig(flags))
39  if flags.DQ.Steering.InDet.doAlignMon:
40  info('Set up Alignment monitoring')
41  from InDetAlignmentMonitoringRun3.InDetAlignmentMonitoringRun3Config import InDetAlignmentMonitoringRun3Config
42  result.merge(InDetAlignmentMonitoringRun3Config(flags))
43 
44  if flags.DQ.Steering.doLArMon:
45  info('Set up LAr monitoring')
46  from LArConfiguration.LArMonitoringConfig import LArMonitoringConfig
47  result.merge(LArMonitoringConfig(flags))
48 
49  if flags.DQ.Steering.doTileMon:
50  info('Set up Tile monitoring')
51  from TileMonitoring.TileMonitoringConfig import TileMonitoringCfg
52  result.merge(TileMonitoringCfg(flags))
53 
54  if flags.DQ.Steering.doCaloGlobalMon:
55  info('Set up Calo monitoring')
56  from CaloMonitoring.CaloMonitoringConfig import CaloMonitoringCfg
57  result.merge(CaloMonitoringCfg(flags))
58 
59  if flags.DQ.Steering.doMuonMon:
60  info('Set up Muon monitoring')
61  from MuonDQAMonitoring.MuonDQAMonitoringConfig import MuonDQAMonitoringConfig
62  result.merge(MuonDQAMonitoringConfig(flags))
63 
64  if flags.DQ.Steering.doHLTMon:
65  info('Set up HLT monitoring')
66  if flags.DQ.Environment == 'AOD':
67  warning("HLT Monitoring enabled on AOD: this might cause issues as not all HLT collections are written to standard AOD!")
68  from TrigHLTMonitoring.TrigHLTMonitorAlgorithm import TrigHLTMonTopConfig
69  result.merge(TrigHLTMonTopConfig(flags))
70 
71  if flags.DQ.Steering.doJetTagMon:
72  info('Set up JetTagging monitoring')
73  from JetTagMonitoring.JetTagMonitorAlgorithm import JetTagMonitorConfig
74  result.merge(JetTagMonitorConfig(flags))
75 
76  if flags.DQ.Steering.doEgammaMon:
77  info('Set up Egamma monitoring')
78  from egammaPerformance.egammaMonitoringConfig import egammaMonitoringConfig
79  result.merge(egammaMonitoringConfig(flags))
80 
81  if flags.DQ.Steering.doJetMon:
82  info('Set up Jet monitoring')
83  from JetMonitoring.JetMonitoringStandard import standardJetMonitoring
84  result.merge(standardJetMonitoring(flags))
85  #Need to create links between global FE, created in jet finding, and other objects
86  #MET monitoring will need these in some workflows (but not in tier0ESD)
87  if flags.DQ.Environment != 'tier0ESD':
88  # Only run PFlow linking for ion runs in UPC mode
89  if not flags.Reco.EnableHI or (flags.Reco.EnableHI and flags.Tracking.doUPC) :
90  from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
91  result.merge(PFGlobalFlowElementLinkingCfg(flags))
92 
93  if flags.DQ.Steering.doJetInputsMon:
94  info('Set up Jet Inputs monitoring')
95  from JetInputsMonitoring.ClusterMonitorAlgorithm import ClusterMonitoringConfig
96  result.merge(ClusterMonitoringConfig(flags))
97  from JetInputsMonitoring.PFOMonitorAlgorithm import PFOMonitoringConfig
98  result.merge(PFOMonitoringConfig(flags))
99 
100  if flags.DQ.Steering.doMissingEtMon:
101  info('Set up MET monitoring')
102  from MissingETMonitoring.METMonitorAlgorithm import METMonitoringConfig
103  result.merge(METMonitoringConfig(flags))
104 
105  if flags.DQ.Steering.doDataFlowMon:
106  info('Set up Data Flow monitoring')
107  from DataQualityTools.DQTDataFlowMonAlg import DQTDataFlowMonAlgConfig
108  result.merge(DQTDataFlowMonAlgConfig(flags))
109 
110  if flags.DQ.Steering.doGlobalMon:
111  info('Set up Global monitoring')
112  from DataQualityTools.DataQualityToolsConfig import DataQualityToolsConfig
113  result.merge(DataQualityToolsConfig(flags))
114 
115  if flags.DQ.Steering.doTauMon:
116  info('Set up Tau monitoring')
117  from tauMonitoring.TauMonitoringConfig import TauMonitoringConfig
118  result.merge(TauMonitoringConfig(flags))
119 
120  if flags.DQ.Steering.doAFPMon:
121  info('Set up AFP monitoring')
122  from Run3AFPMonitoring.Run3AFPExampleMonitorAlgorithm import Run3AFPExampleMonitoringConfig
123  result.merge(Run3AFPExampleMonitoringConfig(flags))
124 
125  if flags.DQ.Steering.doZDCMon and not flags.Input.isMC and flags.GeoModel.Run > LHCPeriod.Run2:
126  info('Set up ZDC monitoring')
127  from ZdcMonitoring.ZdcMonitorAlgorithm import ZdcMonitoringConfig
128  result.merge(ZdcMonitoringConfig(flags))
129 
130  #According to ATR-25910, LV1CaloMon should not be run on run 1 data
131  if flags.DQ.Steering.doLVL1CaloMon and flags.GeoModel.Run > LHCPeriod.Run1:
132  info('Set up LVL1Calo monitoring')
133  from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import LVL1CaloMonitoringConfig
134  result.merge(LVL1CaloMonitoringConfig(flags))
135  if flags.DQ.Steering.doLVL1InterfacesMon:
136  info('Set up LVL1Interfaces monitoring')
137  from TrigT1Monitoring.LVL1InterfacesMonitoringCfg import LVL1InterfacesMonitoringCfg
138  result.merge(LVL1InterfacesMonitoringCfg(flags))
139 
140  if flags.DQ.Steering.doCTPMon:
141  info('Set up CTP monitoring')
142  from TrigT1CTMonitoring.CTPMonitoringConfig import CTPMonitoringConfig
143  result.merge(CTPMonitoringConfig(flags))
144 
145  # Check for potentially duplicated histogram definitions
146  definedhists = {}
147  for algo in result.getEventAlgos():
148  import os.path, json
149  if hasattr(algo, 'GMTools'):
150  for t in algo.GMTools:
151  for h in t.Histograms:
152  ho = json.loads(h)
153  fullpath = os.path.join(t.HistPath, ho['path'], ho['alias']) + ':' + ho['convention']
154  if fullpath in definedhists:
155  previous = definedhists[fullpath]
156  # allow for multiple definitions as long as definitions match perfectly
157  # use case is to have multiple monitoring algs fill the same histogram (such as a summary hist)
158  if previous[2]==ho:
159  info(f'Multiple matching definition of histogram {fullpath} by:\n\t{algo.getName()}/{t.getName()} ({ho}) and\n\t{previous[0]}/{previous[1]}')
160  else:
161  error(f'Multiple differing definition of histogram {fullpath} by:\n\t{algo.getName()}/{t.getName()} ({ho}) and\n\t{previous[0]}/{previous[1]} ({previous[2]})')
162  raise ValueError()
163  definedhists[fullpath] = (algo.getName(), t.getName(), ho)
164 
165  debug('Passed histogram duplication check')
166 
167  return result
168 
170  result = ComponentAccumulator()
171  from DataQualityUtils.DQPostProcessingAlg import DQPostProcessingAlg
172  ppa = DQPostProcessingAlg("DQPostProcessingAlg")
173  ppa.ExtraInputs = {( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )}
174  ppa.Interval = flags.DQ.postProcessingInterval
175  if flags.Common.isOnline:
176  ppa.FileKey = ((flags.DQ.FileKey + '/') if not flags.DQ.FileKey.endswith('/')
177  else flags.DQ.FileKey)
178  result.addEventAlgo(ppa)
179  return result
grepfile.info
info
Definition: grepfile.py:38
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
PixelMonitoringConfig
Definition: PixelMonitoringConfig.py:1
Run3AFPExampleMonitorAlgorithm.Run3AFPExampleMonitoringConfig
def Run3AFPExampleMonitoringConfig(inputFlags)
Definition: Run3AFPExampleMonitorAlgorithm.py:11
LVL1CaloMonitoringConfig
Definition: LVL1CaloMonitoringConfig.py:1
InDetGlobalMonitoringRun3TestConfig
Definition: InDetGlobalMonitoringRun3TestConfig.py:1
SCTMonitoringConfig
Definition: SCTMonitoringConfig.py:1
egammaMonitoringConfig
Definition: egammaPerformance/python/egammaMonitoringConfig.py:1
ClusterMonitorAlgorithm.ClusterMonitoringConfig
def ClusterMonitoringConfig(inputFlags)
Definition: ClusterMonitorAlgorithm.py:11
python.AthenaMonitoringCfg.AthenaMonitoringCfg
def AthenaMonitoringCfg(flags)
Definition: AthenaMonitoringCfg.py:7
LVL1InterfacesMonitoringCfg
Definition: LVL1InterfacesMonitoringCfg.py:1
CTPMonitoringConfig
Definition: CTPMonitoringConfig.py:1
python.LArMonitoringConfig.LArMonitoringConfig
def LArMonitoringConfig(inputFlags)
Definition: LArMonitoringConfig.py:5
JetMonitoringStandard.standardJetMonitoring
def standardJetMonitoring(inputFlags)
Definition: JetMonitoringStandard.py:216
InDetAlignmentMonitoringRun3Config
Definition: InDetAlignmentMonitoringRun3Config.py:1
CaloMonitoringConfig.CaloMonitoringCfg
def CaloMonitoringCfg(flags)
Definition: CaloMonitoringConfig.py:10
TrigHLTMonitorAlgorithm.TrigHLTMonTopConfig
def TrigHLTMonTopConfig(inputFlags)
Definition: TrigHLTMonitorAlgorithm.py:48
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
JetTagMonitorAlgorithm.JetTagMonitorConfig
def JetTagMonitorConfig(inputFlags)
Definition: JetTagMonitorAlgorithm.py:14
TileMonitoringConfig.TileMonitoringCfg
def TileMonitoringCfg(flags)
Definition: TileMonitoringConfig.py:10
MuonDQAMonitoringConfig
Definition: MuonDQAMonitoringConfig.py:1
METMonitorAlgorithm.METMonitoringConfig
def METMonitoringConfig(inputFlags)
Definition: METMonitorAlgorithm.py:49
DataQualityToolsConfig
Definition: DataQualityToolsConfig.py:1
ZdcMonitorAlgorithm.ZdcMonitoringConfig
def ZdcMonitoringConfig(inputFlags)
Definition: ZdcMonitorAlgorithm.py:87
TauMonitoringConfig
Definition: TauMonitoringConfig.py:1
DQTDataFlowMonAlg.DQTDataFlowMonAlgConfig
def DQTDataFlowMonAlgConfig(flags)
Definition: DQTDataFlowMonAlg.py:5
TRTMonitoringRun3Config.TRTMonitoringRun3Cfg
def TRTMonitoringRun3Cfg(flags)
Definition: TRTMonitoringRun3Config.py:5
python.AthenaMonitoringAODRecoCfg.AthenaMonitoringAODRecoCfg
def AthenaMonitoringAODRecoCfg(flags)
Definition: AthenaMonitoringAODRecoCfg.py:5
error
Definition: IImpactPoint3dEstimator.h:70
PFCfg.PFGlobalFlowElementLinkingCfg
def PFGlobalFlowElementLinkingCfg(inputFlags, **kwargs)
Definition: PFCfg.py:472
python.AthenaMonitoringCfg.AthenaMonitoringPostprocessingCfg
def AthenaMonitoringPostprocessingCfg(flags)
Definition: AthenaMonitoringCfg.py:169
PFOMonitorAlgorithm.PFOMonitoringConfig
def PFOMonitoringConfig(inputFlags)
Definition: PFOMonitorAlgorithm.py:11