13from typing
import Optional, List
16pp = pprint.PrettyPrinter(depth=6, indent=1, width=80)
24 Wraps a ROOT object (either a histogram or an n-tuple) together
with the
25 available meta-information about it.
26 Storing the information
in a dictionary
is necessary to make the objects
27 searchable, i.e. implement a function that can
return for example all
28 objects
from a certain revision.
30 @var data: A dict
with all information about the Root-object
31 @cvar revision: The revision to which the object belongs to
32 @var package: The package to which the object belongs to
33 @var rootfile: The root file to which the object belongs to
34 @var key: The key (more precisely: the name of the key) which the object
35 has within the root file
36 @cvar object: The root object itself
37 @var type: The type, i.e. whether its a histogram
or an n-tuple
38 @cvar description: The description, what the histogram/n-tuple contains
39 @cvar check: A brief description how the histogram
or the values should
41 @var contact: A contact person
for this histogram/n-tuple
42 @cvar date: The date of the object (identical
with the date of its rootfile)
43 @cvar is_reference: Boolean value
if it
is an object
from a reference file
54 root_object_type: str,
59 metaoptions: List[str],
63 The constructor. Sets the element up and store the information
in a
64 dict, but also sets up object variables
for simplified access.
66 @param revision: The revision of the object, e.g.
'release-00-04-01'
67 @param package: The package of the object, e.g.
'analysis'
68 @param rootfile: The absolute path to the ROOT file that contains
70 @param key: The key of the object, which
is basically its name.
71 Example:
'P_Eff_k_e'. For each revision, there should be one
72 object
with the same key.
73 @param root_object: The ROOT object itself. Storing works only
for
75 @param root_object_type: The type of the object. Possible values are
76 'TH1' (1D histogram),
'TH2' (2D histogram),
and 'TNtuple'
77 @param date: The date when the containing revision folder was last
78 modified. Important to find the most recent object.
79 @param description: A short description of what
is displayed
in the
80 plot. May also contain LaTeX-Code (enclosed
in $...$),
81 which will later be parsed by MathJax
82 @param check: A short description of how the data
in the plot should
83 look like, i.e.
for example the target location of a peak etc.
84 @param contact: A name
or preferably an e-mail address of the person
85 who
is responsible
for this plot
and may be contacted
in case
87 @param metaoptions: Meta-options
for the plot, e.g.
'colz' for histo-
88 grams,
or log-scale
for the axes, etc.
89 @param is_reference: A boolean value telling
if an object
is a
90 reference object
or a normal plot/n-tuple object
from a
91 revision. Possible Values:
True for reference objects,
92 False for revision objects.
101 "rootfile": rootfile,
103 "object": root_object,
104 "type": root_object_type,
106 "description": description,
109 "metaoptions": metaoptions,
110 "is_reference": is_reference,
118 """ The revision to which the object belongs to """
119 return self.data[
"revision"]
123 """ The package to which the object belongs to"""
124 return self.data[
"package"]
128 """ The root file to which the object belongs to"""
129 return self.data[
"rootfile"]
133 """ The key (more precisely: the name of they) which the object has
136 return self.data[
"key"]
140 """ The root object itself """
141 return self.data[
"object"]
145 """ The type, i.e. whether its a histogram or an n-tuple """
146 return self.data[
"type"]
149 def description(self):
150 """ The description, what the histogram/n-tuple contains """
151 return self.data[
"description"]
155 """ A brief description how the histogram or the values should look
156 like (e.g. characteristic peaks etc.) """
157 return self.data[
"check"]
161 """ A contact person for this histogram/n-tuple """
162 return self.data[
"contact"]
166 """ The date of the object (identical with the date of its rootfile) """
167 return self.data[
"date"]
171 """ Meta-options for the object, e.g. colz or log-scale for the axes """
172 return self.data[
"metaoptions"]
175 def is_reference(self):
176 """ Boolean value if it is an object from a reference file or not """
177 return self.data[
"is_reference"]
180 return str(self.data)
184 Allows to print out all information about a RootObject to the command
185 line (
for debugging purposes).