9 from optparse
import OptionParser
11 from TrigValTools.TrigRootUtils
import lsroot
15 error = hist.GetMeanError()
16 if hist.GetEntries() == 0:
19 overflow = hist.GetBinContent(hist.GetNbinsX()+1)
23 return mean_plus_err +
"\tOverflow: " +
str(overflow)
27 regex = re.compile(
".*" + pattern +
".*")
29 regex_exclude = re.compile(
".*" + exclude +
".*")
33 if "TIME" not in name:
34 if "TotalTime" not in name:
36 if not regex.match(name):
39 if regex_exclude.match(name):
41 hist = myFile.Get(name)
42 if not hist.IsA().InheritsFrom(
"TH1" ):
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()
58 myFile = ROOT.TFile(arg)
61 pattern = options.pattern
62 get_matches(pattern, options.exclude, options.noSkip, myFile)
65 if __name__ ==
"__main__":