![]() |
Belle II Software
release-05-01-25
|
Functions | |
def | root_walk (tdirectory) |
def | root_open (tfile_or_file_path, tfile_options=None) |
def | root_cd (tdirectory) |
def | root_save_name (name) |
def | root_browse (tobject) |
def | root_ls (obj) |
def | __ (filename) |
Various functions to interact with ROOT objects and the runtime environment
def __ | ( | tTree | ) |
Overloaded function for root_ls for filenames (e.g. opens the file and ls its content).
Overloaded function for root_ls for ROOT directories (e.g. list the keys in the directory).
Overloaded function for root_ls for trees and ntuples (e.g. list the keys in the tuple/tree).
Definition at line 181 of file root_utils.py.
def tracking.root_utils.root_browse | ( | tobject | ) |
Open a browser and show the given object. Parameters ---------- tobject : ROOT.TObject The object to be shown Returns ------- ROOT.TBrowser The new TBrowser used to show the object.
Definition at line 141 of file root_utils.py.
def tracking.root_utils.root_cd | ( | tdirectory | ) |
Context manager that temporarily switches the current global ROOT directory while in the context. If a string as the name of a directory is given as the argument try to switch to the directory with that name in the current ROOT folder. If it is not present create it. Parameters ---------- tdirectory : ROOT.TDirectory or str ROOT directory to switch to or name of a folder to switch. Returns ------- ROOT.TDirectory The new current ROOT directory.
Definition at line 72 of file root_utils.py.
def tracking.root_utils.root_ls | ( | obj | ) |
Returns a list of names that are contained in the given obj. This is a convinience function to invesitigate the content of ROOT objects, that dispatches on to object type and retieves different things depending on the type. If the obj is a string it is interpreted as a filename.
Definition at line 170 of file root_utils.py.
def tracking.root_utils.root_open | ( | tfile_or_file_path, | |
tfile_options = None |
|||
) |
Context manager to open a TFile. If a file path is given open the TFile and close it after the context is left. If an already opened TFile is received simply return it and do not close on exit. Parameters ---------- tfile_or_file_path : str or ROOT.TFile Path to the file or the TFile that should be activated. tfile_options : str Option string forwarded to the ROOT.TFile constructor Typical options as "RECREATE", "READ" or "UPDATE".
Definition at line 38 of file root_utils.py.
def tracking.root_utils.root_save_name | ( | name | ) |
Strips all meta characters that might be unsafe to use as a ROOT name. Parameters ---------- name : str A name that should be transformed Returns ------- str Name with potentially harmful characters deleted / replaced.
Definition at line 123 of file root_utils.py.
def tracking.root_utils.root_walk | ( | tdirectory | ) |
Walks the content of a TDirectory similar to os.walk. Yields 3-tuples of current TDirectories, contained TObjects and contained TDirectories for each of the directories nested inside the given TDirectory in a depth first manner. Yields ------ (TDirectory, list(TObject), list(TDirectory))
Definition at line 8 of file root_utils.py.