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"]
22 ioTest = self._root_file.Get(
"Indices")
29 if (self.
type ==
"DQMIO"):
35 indices = self._root_file.Get(
"Indices")
37 for y
in range(indices.GetEntries()):
41 if indices.Type == 1000:
47 t_tree = self._root_file.Get(object_type)
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):
58 directory = self._root_file.GetDirectory(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):
68 obj = self._root_file.Get(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)
96 self._root_file.Close()
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())
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)