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