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  # use L1Calo's special MonitoringCfgHelper
15  from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
16  helper = L1CaloMonitorCfgHelper(inputFlags,CompFactory.OverviewMonitorAlgorithm,'OverviewMonAlg')
17 
18  # get any algorithms
19  OverviewMonAlg = helper.alg
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  # flag for online - different duration options required
26  isOnline=inputFlags.Trigger.Online.isPartition and inputFlags.Input.Format is Format.BS
27 
28  # histogram path
29  histPath_exp = 'Expert/PpmTrex/Overview/'
30  histPath_det = 'Expert/PpmTrex/Overview/detail'
31 
32  # number of processed events
33  global_labels = ["Processed Events"]
34  helper.defineHistogram('n_processed;l1calo_1d_NumberOfEvents',
35  fillGroup=groupName,
36  title='Number of processed events',
37  type='TH1I',
38  path=histPath_det,
39  hanConfig={
40  "description": "Number of processed events."
41  },
42  xbins=1,xmin=0,xmax=1, xlabels=global_labels)
43 
44 
45  # global overview
46  NumberOfGlobalErrors=15
47  globalStatus_xlabels = [
48  "PPMDataStatus",
49  "PPMDataError",
50  "SubStatus",
51  "Parity",
52  "LinkDown",
53  "Transmission",
54  "Simulation",
55  "CMXSubStatus",
56  "CMXParity",
57  "CMXTransmission",
58  "CMXSimulation",
59  "RODStatus",
60  "RODMissing",
61  "ROBStatus",
62  "Unpacking"]
63 
64  globalStatus_ylabels = []
65  for crate in range(14):
66  cr = crate
67  if cr >= 12:
68  cr -= 12
69  if cr >= 8:
70  cr -= 8
71  type = "PP " if (crate < 8) else "CP " if (crate < 12) else "JEP "
72  globalStatus_ylabels.append(type)
73 
74  helper.defineHistogram('globalOverviewX,globalOverviewY;l1calo_2d_GlobalOverview',
75  title='L1Calo Global Error Overview;;',
76  fillGroup=groupName,
77  type='TH2I',
78  path=histPath_exp,
79  hanConfig={
80  "algorithm" : "Histogram_Empty",
81  "display" : "SetPalette(1),SetGridx,SetGridy",
82  "description" : "L1Calo Global Error Overview."
83  },
84  xbins=NumberOfGlobalErrors,xmin=0.,xmax=NumberOfGlobalErrors,
85  ybins=14,ymin=0.,ymax=14,
86  xlabels=globalStatus_xlabels, ylabels=globalStatus_ylabels,
87  opt='kAlwaysCreate')
88 
89  if isOnline:
90  helper.defineHistogram('globalOverviewX,globalOverviewY;l1calo_2d_GlobalOverviewRecent',
91  title='L1Calo Global Error Overview Last 10 LumiBlocks;;',
92  fillGroup=groupName,
93  type='TH2I',
94  path=histPath_exp,
95  hanConfig={
96  "algorithm" : "Histogram_Empty",
97  "display" : "SetPalette(1),SetGridx,SetGridy",
98  "description": "L1Calo Global Error Overview Last 10 LumiBlocks."
99  },
100  xbins=NumberOfGlobalErrors,xmin=0.,xmax=NumberOfGlobalErrors,
101  ybins=14,ymin=0.,ymax=14,
102  xlabels=globalStatus_xlabels, ylabels=globalStatus_ylabels,
103  opt='kLBNHistoryDepth=10,kAlwaysCreate')
104 
105 
106  helper.defineHistogram('lb_errors;l1calo_1d_ErrorsByLumiblock',
107  title='Events with Errors by Lumiblock;Lumi Block;Number of Events;',
108  fillGroup=groupName,
109  type='TH1I',
110  path=histPath_det,
111  hanConfig={
112  "description": "Events with Errors by Lumiblock."
113  },
114  xbins=3000,xmin=0,xmax=3000,
115  weight='n_lb_errors',
116  opt='kAlwaysCreate')
117 
118  acc = helper.result()
119  result.merge(acc)
120  return result
121 
122 
123 if __name__=='__main__':
124  # set input file and config options
125  from AthenaConfiguration.AllConfigFlags import initConfigFlags
126  import glob
127 
128  #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')
129  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')
130 
131  flags = initConfigFlags()
132  flags.Input.Files = inputs
133  flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root'
134 
135  flags.lock()
136  flags.dump() # print all the configs
137 
138  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
139  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
140  cfg = MainServicesCfg(flags)
141  cfg.merge(PoolReadCfg(flags))
142 
143  OverviewMonitorCfg = OverviewMonitoringConfig(flags)
144  cfg.merge(OverviewMonitorCfg)
145 
146  # message level for algorithm
147  OverviewMonitorCfg.getEventAlgo('OverviewMonAlg').OutputLevel = 2 # 1/2 INFO/DEBUG
148  # options - print all details of algorithms, very short summary
149  cfg.printConfig(withDetails=False, summariseProps = True)
150 
151  nevents=-1
152  cfg.run(nevents)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:71
OverviewMonitorAlgorithm.OverviewMonitoringConfig
def OverviewMonitoringConfig(inputFlags)
Definition: OverviewMonitorAlgorithm.py:4