Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
_tdirectoryfile.pyzdoc
Go to the documentation of this file.
1\pythondoc TDirectoryFile
2
3In the same way as for TDirectory, it is possible to inspect the content of a
4TDirectoryFile object from Python as if the subdirectories and objects it
5contains were its attributes. For more information, please refer to the
6TDirectory documentation.
7
8In addition to the attribute syntax, one can inspect a TDirectoryFile in Python
9via the `Get` method. In this case, the subdirectory/object name is specified
10as a string:
11\code{.py}
12# Access a subdirectory
13d.Get('subdir')
14
15# We can go further down in the hierarchy of directories
16d.Get('subdir/subsubdir')
17
18# Access an object (e.g. a histogram) in the directory
19d.Get('obj')
20
21# ... or in a subdirectory
22d.Get('subdir/obj')
23
24# Wrong attribute: returns null
25x = d.Get('wrongAttr') # x points to null
26\endcode
27
28Furthermore, TDirectoryFile inherits a `WriteObject` Python method from
29TDirectory. Such method allows to write an object into a TDirectoryFile
30with the following syntax:
31\code{.py}
32# Write object obj with identifier 'keyName'
33d.WriteObject(obj, 'keyName')
34\endcode
35
36\endpythondoc
#define d(i)
Definition RSha256.hxx:102
#define a(i)
Definition RSha256.hxx:99
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
char name[80]
Definition TGX11.cxx:110
A ROOT file is structured in Directories (like a file system).
Describe directory structure in memory.
Definition TDirectory.h:45
std::enable_if_t<!std::is_base_of< TObject, T >::value, Int_t > WriteObject(const T *obj, const char *name, Option_t *option="", Int_t bufsize=0)
Write an object with proper type checking.
Definition TDirectory.h:282
Double_t x[n]
Definition legend1.C:17
TString as(SEXP s)
Definition RExports.h:86