ATLAS Offline Software
OverviewMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
4 def OverviewMonitoringConfig(inputFlags):
5  '''Function to configure LVL1 Overview algorithm in the monitoring system.'''
6 
7  from AthenaConfiguration.Enums import Format
8 
9  # get the component factory - used for getting the algorithms
10  from AthenaConfiguration.ComponentFactory import CompFactory
11  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
12  result = ComponentAccumulator()
13 
14  # make the athena monitoring helper
15  from AthenaMonitoring import AthMonitorCfgHelper
16  helper = AthMonitorCfgHelper(inputFlags,'OverviewMonitoringCfg')
17 
18  # get any algorithms
19  OverviewMonAlg = helper.addAlgorithm(CompFactory.OverviewMonitorAlgorithm,'OverviewMonAlg')
20 
21  # add any steering
22  groupName = 'OverviewMonitor' # the monitoring group name is also used for the package name
23  OverviewMonAlg.PackageName = groupName
24 
25  mainDir = 'L1Calo'
26 
27  # add monitoring algorithm to group, with group name and main directory
28  myGroup = helper.addGroup(OverviewMonAlg, groupName , mainDir)
29 
30  # flag for online - different duration options required
31  isOnline=inputFlags.Trigger.Online.isPartition and inputFlags.Input.Format is Format.BS
32 
33  # number of processed events
34  global_labels = ["Processed Events"]
35  myGroup.defineHistogram('n_processed;l1calo_1d_NumberOfEvents',
36  title='Number of processed events',
37  type='TH1I',
38  path='Overview/',
39  xbins=1,xmin=0,xmax=1, xlabels=global_labels)
40 
41 
42  # global overview
43  trigPath = 'Overview/Errors/'
44  NumberOfGlobalErrors=15
45  globalStatus_xlabels = [
46  "PPMDataStatus",
47  "PPMDataError",
48  "SubStatus",
49  "Parity",
50  "LinkDown",
51  "Transmission",
52  "Simulation",
53  "CMXSubStatus",
54  "CMXParity",
55  "CMXTransmission",
56  "CMXSimulation",
57  "RODStatus",
58  "RODMissing",
59  "ROBStatus",
60  "Unpacking"]
61 
62  globalStatus_ylabels = []
63  for crate in range(14):
64  cr = crate
65  if cr >= 12:
66  cr -= 12
67  if cr >= 8:
68  cr -= 8
69  type = "PP " if (crate < 8) else "CP " if (crate < 12) else "JEP "
70  globalStatus_ylabels.append(type)
71 
72  myGroup.defineHistogram('globalOverviewX,globalOverviewY;l1calo_2d_GlobalOverview',title='L1Calo Global Error Overview;;',
73  type='TH2I',
74  path=trigPath,
75  xbins=NumberOfGlobalErrors,xmin=0.,xmax=NumberOfGlobalErrors,
76  ybins=14,ymin=0.,ymax=14, xlabels=globalStatus_xlabels, ylabels=globalStatus_ylabels,
77  duration='' if isOnline else 'lb',
78  opt='kAlwaysCreate')
79 
80  if isOnline:
81  myGroup.defineHistogram('globalOverviewX,globalOverviewY;l1calo_2d_GlobalOverviewRecent',
82  title='L1Calo Global Error Overview Last 10 LumiBlocks;;',
83  type='TH2I',
84  path=trigPath,
85  xbins=NumberOfGlobalErrors,xmin=0.,xmax=NumberOfGlobalErrors,
86  ybins=14,ymin=0.,ymax=14, xlabels=globalStatus_xlabels, ylabels=globalStatus_ylabels,
87  opt='kLBNHistoryDepth=10,kAlwaysCreate')
88 
89 
90  myGroup.defineHistogram('lb_errors;l1calo_1d_ErrorsByLumiblock',
91  title='Events with Errors by Lumiblock;Lumi Block;Number of Events;',
92  type='TH1I',
93  path=trigPath,
94  xbins=3000,xmin=0,xmax=3000,
95  weight='n_lb_errors',
96  opt='kAlwaysCreate')
97 
98 
99  acc = helper.result()
100  result.merge(acc)
101  return result
102 
103 
104 if __name__=='__main__':
105  # set input file and config options
106  from AthenaConfiguration.AllConfigFlags import initConfigFlags
107  import glob
108 
109  #inputs = glob.glob('/eos/atlas/atlastier0/rucio/data18_13TeV/physics_Main/00357750/data18_13TeV.00357750.physics_Main.recon.ESD.f1072/data18_13TeV.00357750.physics_Main.recon.ESD.f1072._lb0117._SFO-1._0201.1')
110  inputs = glob.glob('/eos/atlas/atlastier0/rucio/data18_13TeV/physics_Main/00354311/data18_13TeV.00354311.physics_Main.recon.ESD.f1129/data18_13TeV.00354311.physics_Main.recon.ESD.f1129._lb0013._SFO-8._0001.1')
111 
112  flags = initConfigFlags()
113  flags.Input.Files = inputs
114  flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root'
115 
116  flags.lock()
117  flags.dump() # print all the configs
118 
119  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
120  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
121  cfg = MainServicesCfg(flags)
122  cfg.merge(PoolReadCfg(flags))
123 
124  OverviewMonitorCfg = OverviewMonitoringConfig(flags)
125  cfg.merge(OverviewMonitorCfg)
126 
127  # message level for algorithm
128  OverviewMonitorCfg.getEventAlgo('OverviewMonAlg').OutputLevel = 2 # 1/2 INFO/DEBUG
129  # options - print all details of algorithms, very short summary
130  cfg.printConfig(withDetails=False, summariseProps = True)
131 
132  nevents=-1
133  cfg.run(nevents)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
OverviewMonitorAlgorithm.OverviewMonitoringConfig
def OverviewMonitoringConfig(inputFlags)
Definition: OverviewMonitorAlgorithm.py:4