3 from __future__
import print_function
4 from builtins
import range
10 Reader for DQM IO and DQM root files.
14 DQMIO_TYPES = [
"Ints",
"Floats",
"Strings",
15 "TH1Fs",
"TH1Ss",
"TH1Ds",
16 "TH2Fs",
"TH2Ss",
"TH2Ds",
17 "TH3Fs",
"TProfiles",
"TProfile2Ds",
"kNIndicies"]
29 if (self.
type ==
"DQMIO"):
37 for y
in range(indices.GetEntries()):
41 if indices.Type == 1000:
49 for i
in range(indices.FirstIndex, indices.LastIndex + 1):
52 fullname =
str(t_tree.FullName)
53 yield (fullname, t_tree.Value, )
56 xml_re = re.compile(
r"^<(.+)>(.+)=(.*)<\/\1>$")
57 def parse_directory(di):
59 for key
in directory.GetListOfKeys():
61 rtype = key.GetClassName()
62 fullpath =
"%s/%s" % (di, entry)
64 if (rtype ==
"TDirectoryFile"):
65 for k, v
in parse_directory(fullpath):
70 yield (fullpath, obj, )
73 m = xml_re.search(entry)
79 fp =
"%s/%s" % (di, name)
85 path_fix = re.compile(
r"^\/Run \d+")
86 for fullname, obj
in parse_directory(
""):
87 f = fullname.replace(
"/DQMData",
"")
88 f = f.replace(
"/Run summary",
"")
89 f = path_fix.sub(
r"", f)
98 if __name__ ==
'__main__':
101 parser = argparse.ArgumentParser()
102 parser.add_argument(
"-i",
"--input", help =
"Input DQMIO ROOT file")
103 args = parser.parse_args()
107 for (fn, v)
in reader.read_objects():
108 if (hasattr(v,
"ClassName")):
109 print(fn, v.ClassName())