ATLAS Offline Software
Functions
trigDumpTimers Namespace Reference

Functions

def timing (hist)
 
def get_matches (pattern, exclude, noSkip, myFile)
 
def main ()
 

Function Documentation

◆ get_matches()

def trigDumpTimers.get_matches (   pattern,
  exclude,
  noSkip,
  myFile 
)

Definition at line 25 of file trigDumpTimers.py.

25 def get_matches(pattern, exclude, noSkip, myFile):
26  names=lsroot(myFile)
27  regex = re.compile(".*" + pattern + ".*")
28  if exclude:
29  regex_exclude = re.compile(".*" + exclude + ".*")
30  for name in names:
31  if not noSkip:
32  #Run-3 timers always contain TIME or TotalTime
33  if "TIME" not in name:
34  if "TotalTime" not in name:
35  continue
36  if not regex.match(name):
37  continue
38  if exclude:
39  if regex_exclude.match(name):
40  continue
41  hist = myFile.Get(name)
42  if not hist.IsA().InheritsFrom( "TH1" ):
43  continue
44  print(name + " " + timing(hist))
45 

◆ main()

def trigDumpTimers.main ( )

Definition at line 46 of file trigDumpTimers.py.

46 def main():
47  parser = OptionParser()
48  parser.add_option("-p", "--pattern", dest="pattern", type = "string", default = None,
49  help="Pattern to match histogram to")
50  parser.add_option("-x", "--exclude", dest="exclude", type = "string", default = None,
51  help="Pattern to exclude histogram from matching")
52  parser.add_option("-n", "--noSkip", dest="noSkip", action = "store_true",
53  help="Match all histograms (not just trigger timers)")
54  (options, args) = parser.parse_args()
55 
56  for arg in args:
57  print(arg)
58  myFile = ROOT.TFile(arg)
59  pattern = ".*"
60  if (options.pattern):
61  pattern = options.pattern
62  get_matches(pattern, options.exclude, options.noSkip, myFile)
63 
64 

◆ timing()

def trigDumpTimers.timing (   hist)

Definition at line 13 of file trigDumpTimers.py.

13 def timing(hist):
14  mean = hist.GetMean()
15  error = hist.GetMeanError()
16  if hist.GetEntries() == 0:
17  return "0"
18  mean_plus_err = str(round(mean,3)) + " +/- " + str(round(error,3))
19  overflow = hist.GetBinContent(hist.GetNbinsX()+1)
20  if overflow == 0.0:
21  return mean_plus_err
22  else:
23  return mean_plus_err + "\tOverflow: " + str(overflow)
24 
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
trigDumpTimers.get_matches
def get_matches(pattern, exclude, noSkip, myFile)
Definition: trigDumpTimers.py:25
python.TrigRootUtils.lsroot
def lsroot(dir)
Definition: TrigRootUtils.py:6
trigDumpTimers.timing
def timing(hist)
Definition: trigDumpTimers.py:13
str
Definition: BTagTrackIpAccessor.cxx:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
trigDumpTimers.main
def main()
Definition: trigDumpTimers.py:46