ATLAS Offline Software
Sequence_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 
6 from TrigCostAnalysis.TableConstructorBase import TableConstructorBase, Column
7 from AthenaCommon.Logging import logging
8 log = logging.getLogger('Sequence_HLT')
9 
10 '''
11 @file Sequence_HLT_TableConstructor.py
12 @brief Contains TableConstructor classes per Sequence_HLT table. Defines what
13  should be saved in table and fills them
14 '''
15 
16 # TODO Uncomment values after fixing Time_perCall histogram
17 class Sequence_HLT_TableConstructor(TableConstructorBase):
18  ''' @brief Class representing Sequence_HLT table
19  '''
20  def __init__(self, tableObj, underflowThreshold, overflowThreshold):
21  super(). __init__(tableObj, underflowThreshold, overflowThreshold)
22  self.expectedHistograms = ["Sequence_perEvent",
23  "AlgCalls_perEvent",
24  "Time_perCall",
25  "Time_perEvent",
26  "Request_perEvent",
27  "NetworkRequest_perEvent",
28  "CachedROBSize_perEvent",
29  "NetworkROBSize_perEvent",
30  "RequestTime_perEvent"]
31 
32 
33  def defineColumns(self):
34  self.columns["name"] = Column("Name", "Sequence name")
35  self.columns["events"] = Column("Raw Active Events", "Raw underlying statistics on how many events in which this sequence was executed.")
36  self.columns["eventsWeighted"] = Column("Active Events", "How many events in which this sequence was executed.")
37  self.columns["callsPerEvent"] = Column("Calls/Event", "Total number of calls made to this sequence.")
38  self.columns["callsSlow"] = Column("Calls > 1000 ms", "Number of sequence executions which were particularly slow.")
39  self.columns["eventRate"] = Column("Event Rate [Hz]", "Rate in this run range of events with at least one execution of this sequence.", True)
40  self.columns["callRate"] = Column("Call Rate [Hz]", "Rate in this run range of calls to this sequence.", True)
41  self.columns["totalTimeSec"] = Column("Sequence Total Time [s]", "Total time for this sequence")
42  self.columns["totalTimePerc"] = Column("Sequence Total Time [%]", "Total time for this sequence as a percentage of all sequence executions in this run range")
43  self.columns["timePerCall"] = Column("Sequence Total Time/Call [ms]", "Average execution time per sequence call in this run range.")
44  self.columns["timePerEvent"] = Column("Sequence Total Time/Event [ms]", "Mean weighted alg time. Normalised to all events with one or more alg calls")
45  self.columns["algsPerEvent"] = Column("Run Algs/Event", "Total number of algorithms executed by this sequence.")
46  self.columns["requestTimePerEvent"] = Column("ROS Data Request Time/Event [ms]", "Average time waiting for ROS data per event for events with at least one execution in this run range")
47  self.columns["dataRate"] = Column("Data Request Rate [Hz]", "Rate of calls to the ROS from algorithms in this sequence in this run range", True)
48  self.columns["retrievedDataRate"] = Column("Retrieved ROB Rate [Hz]", "Rate of ROB retrievals from algorithms in this sequence in this run range", True)
49  self.columns["cachedDataSizeRate"] = Column("Cached ROB Rate [kB/s]", "Average size of cached ROB data fetches for algorithms in this sequence in this run range", True)
50  self.columns["retrievedDataSizeRate"] = Column("Retrieved ROB Rate [kB/s]", "Average size of retrieved ROB data fetches for algorithms in this sequence in this run range")
51 
52 
53  def fillColumns(self, itemName):
54  weightedEvents = self.getHistogram("Sequence_perEvent").Integral()
55  weightedCalls = self.getXWeightedIntegral("Sequence_perEvent", isLog=False)
56  slowCalls = self.getHistogram("Time_perCall").Integral(self.getHistogram("Time_perCall").FindBin(1000.), self.getHistogram("Time_perCall").GetNbinsX())
57 
58  self.columns["name"].addValue(itemName)
59  self.columns["events"].addValue(self.getHistogram("Sequence_perEvent").GetEntries())
60  self.columns["eventsWeighted"].addValue(weightedEvents)
61  self.columns["callsPerEvent"].addValue(self.getHistogram("Sequence_perEvent").GetMean())
62  self.columns["callsSlow"].addValue(slowCalls)
63  self.columns["eventRate"].addValue(weightedEvents)
64  self.columns["callRate"].addValue(weightedCalls)
65  self.columns["totalTimeSec"].addValue(self.getXWeightedIntegral("Time_perCall", isLog=True) * 1e-3)
66  #self.columns["totalTimePerc"] in post processing
67  self.columns["timePerCall"].addValue((self.getHistogram("Time_perCall").GetMean()))
68  self.columns["timePerEvent"].addValue(self.getHistogram("Time_perEvent").GetMean())
69  self.columns["algsPerEvent"].addValue(self.getHistogram("AlgCalls_perEvent").GetMean())
70  self.columns["requestTimePerEvent"].addValue(self.getHistogram("RequestTime_perEvent").GetMean())
71  self.columns["dataRate"].addValue(self.getXWeightedIntegral("Request_perEvent", isLog=False))
72  self.columns["retrievedDataRate"].addValue(self.getXWeightedIntegral("NetworkRequest_perEvent", isLog=False))
73  self.columns["cachedDataSizeRate"].addValue(self.getXWeightedIntegral("CachedROBSize_perEvent", isLog=False))
74  self.columns["retrievedDataSizeRate"].addValue(self.getXWeightedIntegral("NetworkROBSize_perEvent", isLog=False))
75 
76 
77  def postProcessing(self):
78  totalTimeEntries = self.columns["totalTimeSec"].content
79  totalTime = sum(totalTimeEntries)
80 
81  if (totalTime == 0):
82  log.error("No histograms for the Sequence HLT summary were found")
83  raise ValueError
84 
85  for entry in totalTimeEntries:
86  self.columns["totalTimePerc"].addValue(100 * entry / totalTime)
Sequence_HLT_TableConstructor.Sequence_HLT_TableConstructor
Definition: Sequence_HLT_TableConstructor.py:17
RootHelpers::FindBin
Int_t FindBin(const TAxis *axis, const double x)
Definition: RootHelpers.cxx:14
Sequence_HLT_TableConstructor.Sequence_HLT_TableConstructor.defineColumns
def defineColumns(self)
Definition: Sequence_HLT_TableConstructor.py:33
Sequence_HLT_TableConstructor.Sequence_HLT_TableConstructor.expectedHistograms
expectedHistograms
Definition: Sequence_HLT_TableConstructor.py:22
GetMean
TGraphErrors * GetMean(TH2F *histo)
Definition: TRTCalib_makeplots.cxx:3907
GetEntries
TGraphErrors * GetEntries(TH2F *histo)
Definition: TRTCalib_makeplots.cxx:4019
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
Sequence_HLT_TableConstructor.Sequence_HLT_TableConstructor.postProcessing
def postProcessing(self)
Definition: Sequence_HLT_TableConstructor.py:77
Sequence_HLT_TableConstructor.Sequence_HLT_TableConstructor.fillColumns
def fillColumns(self, itemName)
Definition: Sequence_HLT_TableConstructor.py:53
Sequence_HLT_TableConstructor.Sequence_HLT_TableConstructor.__init__
def __init__(self, tableObj, underflowThreshold, overflowThreshold)
Definition: Sequence_HLT_TableConstructor.py:20