ATLAS Offline Software
Loading...
Searching...
No Matches
Chain_HLT_TableConstructor.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4#
5
6from TrigCostAnalysis.TableConstructorBase import TableConstructorBase, Column
7from AthenaCommon.Logging import logging
8log = logging.getLogger('Chain_HLT')
9
10'''
11@file Chain_HLT_TableConstructor.py
12@brief Contains TableConstructor classes per Chain_HLT table. Defines what
13 should be saved in table and fills them
14'''
15
16
17class Chain_HLT_TableConstructor(TableConstructorBase):
18 ''' @brief Class representing Chain_HLT table
19 '''
20 def __init__(self, tableObj, underflowThreshold, overflowThreshold):
21 super(). __init__(tableObj, underflowThreshold, overflowThreshold)
22 self.totalTime = 0 # Total time of algoirthms execution
23 self.expectedHistograms = ["Group_perCall",
24 "Chain_perEvent",
25 "AlgCalls_perEvent",
26 "Time_perEvent",
27 "Time_perCall",
28 "UniqueTime_perCall",
29 "ChainPassed_perEvent",
30 "Request_perEvent"]
31
32 def defineColumns(self):
33 self.columns['name'] = Column("Name", "Chain name")
34 self.columns['group'] = Column("Group", "Bandwidth group this chain is associated to")
35 self.columns['events'] = Column("Raw Active Events", "Raw underlying statistics on the number of events in which this ROS was accessed")
36 self.columns['eventsWeighted'] = Column("Active Events", "How many events in which this sequence was executed")
37 self.columns['time'] = Column("Time Per Event [ms]", "Average execution time of this chain per event")
38 self.columns['chainRate'] = Column("Execute Rate [Hz]", "Number of chain executions normalised to the wall time for this run range", True)
39 self.columns['passFraction'] = Column("Pass Fraction [%]", "What percentage of events pass events are kept")
40 self.columns["callsSlow"] = Column("Calls > 1000 ms", "Number of algorithm executions which were particularly slow")
41 self.columns['totalTime'] = Column("Total Chain Time [s]", "Total time used by this chain for this run range")
42 self.columns['totalTimeFrac'] = Column("Total Chain Time [%]", "Total chain time as a percentage of the total time of all chains in this run range")
43 self.columns["totalUniqTime"] = Column("Total Unique Time [s]", "Total time used by algorithms for this chain for this run range")
44 self.columns['totalUniqTimeFrac'] = Column("Total Unique Time [%]", "Total unique chain time as a percentage of the total time of all chains in this run range")
45 self.columns['algPerEvent'] = Column("Run Algs/Event", "Total number of algorithms executed by this chain")
46 self.columns["dataRate"] = Column("Data Request Rate [Hz]", "Rate of data requests to ROSes (one request can be to many ROSes) from this chain in this run range", True)
47 self.columns["retrievedDataRate"] = Column("Retrieved Data Request Rate [Hz]", "Rate of data request with at least one network ROS request from this chain in this run range", True)
48 self.columns["cachedDataSizeRate"] = Column("Cached ROB Rate [kB/s]", "Average size of cached ROB data fetches from this algorithm in this run range", True)
49 self.columns["retrievedDataSizeRate"] = Column("Retrieved ROB Rate [kB/s]", "Average size of retrieved ROB data fetches for this algorithm in this run range")
50
51
52 def fillColumns(self, itemName):
53 slowCalls = self.getHistogram("Time_perCall").Integral(self.getHistogram("Time_perCall").FindBin(1000.), self.getHistogram("Time_perCall").GetNbinsX())
54
55 self.columns["name"].addValue(itemName)
56 self.columns["events"].addValue(self.getHistogram("Chain_perEvent").GetEntries())
57 self.columns["eventsWeighted"].addValue(self.getHistogram("Chain_perEvent").Integral())
58 self.columns["time"].addValue(self.getHistogram("Time_perEvent").GetMean())
59 self.columns["chainRate"].addValue(self.getHistogram("Chain_perEvent").Integral())
60 self.columns['passFraction'].addValue(self.getHistogram("ChainPassed_perEvent").Integral())
61 self.columns["callsSlow"].addValue(slowCalls)
62 self.columns['totalTime'].addValue(self.getXWeightedIntegral("Time_perCall", isLog=True) * 1e-3)
63 #self.columns['totalTimeFrac'] in postprocessing
64 self.columns['totalUniqTime'].addValue(self.getXWeightedIntegral("UniqueTime_perCall", isLog=True) * 1e-3)
65 #self.columns['totalUniqueTimeFrac'] in postprocessing
66 self.columns["algPerEvent"].addValue(self.getHistogram("AlgCalls_perEvent").GetMean())
67 self.columns["dataRate"].addValue(self.getXWeightedIntegral("Request_perEvent", isLog=False))
68
69 groups = ""
70 for i in range (1, self.getHistogram("Group_perCall").GetNbinsX()):
71 label = self.getHistogram("Group_perCall").GetXaxis().GetBinLabel(i)
72 if not label: break
73
74 groups += label + ", "
75
76 self.columns['group'].addValue(groups)
77
78 def postProcessing(self):
79 totalTimeEntries = self.columns["totalTime"].content
80 if (sum(totalTimeEntries) == 0):
81 log.error("No histograms for the Chain HLT summary were found")
82 raise ValueError
83
84 for entry in totalTimeEntries:
85 self.columns["totalTimeFrac"].addValue(100 * entry / self.totalTime)
86
87 totalUniqTimeEntries = self.columns["totalUniqTime"].content
88
89 for entry in totalUniqTimeEntries:
90 self.columns["totalUniqTimeFrac"].addValue(100 * entry / self.totalTime)
91
92 passChainEntries = self.columns["passFraction"].content
93 totalChains = self.columns["eventsWeighted"].content
94
95 for i in range(0, len(passChainEntries)):
96 passFrac = 0 if totalChains[i] == 0 else 100 * passChainEntries[i] / totalChains[i]
97 self.columns["passFraction"].content[i] = passFrac
TGraphErrors * GetMean(TH2F *histo)
TGraphErrors * GetEntries(TH2F *histo)
__init__(self, tableObj, underflowThreshold, overflowThreshold)