ROOT
v6-28
Reference Guide
Loading...
Searching...
No Matches
_tdirectoryfile.pyzdoc
Go to the documentation of this file.
1
/**
2
\class TDirectoryFile
3
\brief \parblock \endparblock
4
\htmlonly
5
<div class="pyrootbox">
6
\endhtmlonly
7
## PyROOT
8
9
In the same way as for TDirectory, it is possible to inspect the content of a
10
TDirectoryFile object from Python as if the subdirectories and objects it
11
contains were its attributes. For more information, please refer to the
12
TDirectory documentation.
13
14
In addition to the attribute syntax, one can inspect a TDirectoryFile in Python
15
via the `Get` method. In this case, the subdirectory/object name is specified
16
as a string:
17
\code{.py}
18
# Access a subdirectory
19
d.Get('subdir')
20
21
# We can go further down in the hierarchy of directories
22
d.Get('subdir/subsubdir')
23
24
# Access an object (e.g. a histogram) in the directory
25
d.Get('obj')
26
27
# ... or in a subdirectory
28
d.Get('subdir/obj')
29
30
# Wrong attribute: returns null
31
x = d.Get('wrongAttr') # x points to null
32
\endcode
33
34
Furthermore, TDirectoryFile inherits a `WriteObject` Python method from
35
TDirectory. Such method allows to write an object into a TDirectoryFile
36
with the following syntax:
37
\code{.py}
38
# Write object obj with identifier 'keyName'
39
d.WriteObject(obj, 'keyName')
40
\endcode
41
\htmlonly
42
</div>
43
\endhtmlonly
44
*/
v628_TMP
pyzdoc
_tdirectoryfile.pyzdoc
ROOT v6-28 - Reference Guide Generated on Thu Oct 24 2024 01:50:05 (GVA Time) using Doxygen 1.9.8