JG ROOT Tools libraries
version 5.0 - august 2014
|
#include "RRootFilesFunctions.hh"
#include "RBaseFunctions.hh"
#include <TSystem.h>
#include <TFile.h>
#include <TKey.h>
Functions | |
TH1 * | RGetFileHisto (const char file_name[], const char histo_name[]) |
TH1 * | RGetFileHisto (TDirectory *dir, const char histo_name[], bool recur) |
Int_t | RGetHistoNames (const char file_name[], string *&histo_names, Int_t *&histo_dim, Int_t dmin, Int_t dmax) |
Int_t | RGetHistoNames (const char file_name[], string *&histo_names, Int_t dmin, Int_t dmax) |
bool | RCheckDirObjects (TDirectory *dir, const string &obj_class, bool recur) |
u_int | RCountDirObjects (TDirectory *dir, const string &obj_class, bool recur) |
RTreeBranchTObject * | RGetObjectTree (TDirectory *dir, const string &obj_class) |
RTreeBranchTObject * | RGetHistoTree (TDirectory *dir, bool local) |
Source file for functions related to ROOT files.
TH1* RGetFileHisto | ( | const char | file_name[], |
const char | histo_name[] | ||
) |
Read an histogram in a ROOT file, and return a pointer to the histogram. The histogram is taken to "local" directory. This function should replace RReadHisto that may not be used anymore.
file_name | ROOT file name |
histo_name | histogram name |
References RGetFileHisto().
Referenced by RGetFileHisto().
TH1* RGetFileHisto | ( | TDirectory * | dir, |
const char | histo_name[], | ||
bool | recur | ||
) |
Read an histogram in a ROOT directory, and return a pointer to the histogram. The histogram is taken to "local" directory. If the histogram is not found in the directory, it may be searched for in sub-directories.
dir | ROOT directory |
histo_name | histogram name* |
recur | whether to search recursively in sub-directories |
References RGetFileHisto().
Int_t RGetHistoNames | ( | const char | file_name[], |
string *& | histo_names, | ||
Int_t *& | histo_dim, | ||
Int_t | dmin, | ||
Int_t | dmax | ||
) |
This function creates (allocates) a table of histogram names and a table of histogram dimensions from a ROOT file. It only considers the last version of each histogram (highest cycle number). It returns a positive value if some histograms have been found, corresponding to the number of histograms (the tables must then be deleted by calling program). It returns 0 if no histogram was found, and a negative value in case of error.
file_name | ROOT file name |
histo_names | allocated array of histogram names |
histo_dim | allocated array of histogram dimensions |
dmin | minimum dimension (1, 2 or 3) |
dmax | maximum dimension (1, 2 or 3) |
Referenced by RGetHistoNames(), and RGHistoTools::SetFile().
Int_t RGetHistoNames | ( | const char | file_name[], |
string *& | histo_names, | ||
Int_t | dmin, | ||
Int_t | dmax | ||
) |
This function creates (allocates) a table of histogram names from a ROOT file. It only considers the last version of each histogram (highest cycle number). It returns a positive value if some histograms have been found, corresponding to the number of histograms (the tables must then be deleted by calling program). It returns 0 if no histogram was found, and a negative value in case of error.
file_name | ROOT file name |
histo_names | allocated array of histogram names |
dmin | minimum dimension (1, 2 or 3) |
dmax | maximum dimension (1, 2 or 3) |
References RGetHistoNames().
bool RCheckDirObjects | ( | TDirectory * | dir, |
const string & | obj_class, | ||
bool | recur | ||
) |
This function returns "true" if the ROOT directory contains one or more ROOT objects inheriting from the class name given as argument.
dir | ROOT directory |
obj_class | ROOT objects class name |
recur | recursive search in sub-directories |
References RCheckDirObjects().
Referenced by RCheckDirHisto(), RCheckDirObjects(), and RGetObjectTree().
u_int RCountDirObjects | ( | TDirectory * | dir, |
const string & | obj_class, | ||
bool | recur | ||
) |
This function returns the number of ROOT objects inheriting from the class name given as argument in the directory. If several versions of the objects exist, they are counted only once.
dir | ROOT directory |
obj_class | ROOT objects class name |
recur | recursive search in sub-directories |
References RCountDirObjects().
Referenced by RCountDirHisto(), and RCountDirObjects().
RTreeBranchTObject* RGetObjectTree | ( | TDirectory * | dir, |
const string & | obj_class | ||
) |
Function creating a tree structure with pointers (RObject) on object from class given as argument in the ROOT directory.
dir | ROOT directory |
obj_class | class name of the objects to extract |
References RCheckDirObjects(), and RGetObjectTree().
Referenced by RGetHistoTree(), and RGetObjectTree().
RTreeBranchTObject* RGetHistoTree | ( | TDirectory * | dir, |
bool | local | ||
) |
Function creating a tree structure with pointers (RObject) on histograms from the ROOT directory.
dir | ROOT directory pointer |
local | if true, the histograms are set in local directory (0) |
References RGetObjectTree().