ATLAS Offline Software
Loading...
Searching...
No Matches
trigDumpTimers Namespace Reference

Functions

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

Function Documentation

◆ get_matches()

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

Definition at line 25 of file trigDumpTimers.py.

25def 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
void print(char *figname, TCanvas *c1)

◆ main()

trigDumpTimers.main ( )

Definition at line 46 of file trigDumpTimers.py.

46def 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
int main()
Definition hello.cxx:18

◆ timing()

trigDumpTimers.timing ( hist)

Definition at line 13 of file trigDumpTimers.py.

13def 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