ROOT 6.10/09 Reference Guide |
A TSimpleAnalysis object creates histograms from a TChain.
These histograms are stored to an output file. The histogrammed (TTreeFormula) expressions, their cuts, the input and output files are configured through a simple config file that allows comments starting with '#'. Here an example of configuration file:
It is possible to use the script rootdrawtree that allows to use the class just in command line through the bash shell.
Definition at line 33 of file TSimpleAnalysis.h.
Public Member Functions | |
TSimpleAnalysis (const std::string &file) | |
TSimpleAnalysis (const std::string &output, const std::vector< std::string > &inputFiles, const std::vector< std::string > &expressions, const std::string &treeName) | |
Constructor for the case of command line parsing arguments. More... | |
bool | Configure () |
This function has the aim of setting the arguments read from the input file. More... | |
bool | Run () |
Execute all the TChain::Draw() as configured and stores the output histograms. More... | |
Private Types | |
enum | EReadingWhat { kReadingOutput, kReadingTreeName, kReadingInput, kReadingExpressions } |
Private Member Functions | |
std::string | GetLine (int &numbLine) |
Skip subsequent empty lines read from fIn and returns the next not empty line. More... | |
std::string | HandleExpressionConfig (const std::string &line) |
Handle the expression lines of the input file in order to pass the elements to the members of the object. More... | |
bool | HandleInputFileNameConfig (const std::string &line) |
Returns false if not a tree name, otherwise sets the name of the tree. More... | |
bool | SetTreeName () |
Disambiguate tree name from first input file and set up fTreeName if it is empty. More... | |
Private Attributes | |
std::string | fConfigFile |
Name of the configuration file. More... | |
std::map< std::string, std::pair< std::string, std::string > > | fHists |
std::ifstream | fIn |
Stream for the input file. More... | |
std::vector< std::string > | fInputFiles |
.root input files More... | |
std::string | fOutputFile |
Output file in which are stored the histograms. More... | |
std::string | fTreeName |
Name of the input tree. More... | |
#include <TSimpleAnalysis.h>
|
private |
Definition at line 48 of file TSimpleAnalysis.h.
|
inline |
Definition at line 62 of file TSimpleAnalysis.h.
TSimpleAnalysis::TSimpleAnalysis | ( | const std::string & | output, |
const std::vector< std::string > & | inputFiles, | ||
const std::vector< std::string > & | expressions, | ||
const std::string & | treeName = "" |
||
) |
Constructor for the case of command line parsing arguments.
It sets the members of the object.
[in] | output | - name of the output file |
[in] | inputFiles | - name of the input .root files |
[in] | expressions | - what is shown in the histograms |
[in] | treeName | - name of the tree |
std::runtime_error | in case of ill-formed expressions |
Definition at line 156 of file TSimpleAnalysis.cxx.
bool TSimpleAnalysis::Configure | ( | ) |
This function has the aim of setting the arguments read from the input file.
Definition at line 416 of file TSimpleAnalysis.cxx.
|
private |
Skip subsequent empty lines read from fIn and returns the next not empty line.
param[in] numbLine - number of the input file line
Definition at line 400 of file TSimpleAnalysis.cxx.
|
private |
Handle the expression lines of the input file in order to pass the elements to the members of the object.
param[in] line - TTreeFormula expression, either read form the configuration file or passed as expression to the constructor
Definition at line 100 of file TSimpleAnalysis.cxx.
|
private |
Returns false if not a tree name, otherwise sets the name of the tree.
param[in] line - line read from the input file
Definition at line 386 of file TSimpleAnalysis.cxx.
bool TSimpleAnalysis::Run | ( | ) |
Execute all the TChain::Draw() as configured and stores the output histograms.
Returns true if the analysis succeeds.
Definition at line 266 of file TSimpleAnalysis.cxx.
|
private |
Disambiguate tree name from first input file and set up fTreeName if it is empty.
Definition at line 236 of file TSimpleAnalysis.cxx.
|
private |
Name of the configuration file.
Definition at line 36 of file TSimpleAnalysis.h.
|
private |
Definition at line 44 of file TSimpleAnalysis.h.
|
private |
Stream for the input file.
Definition at line 40 of file TSimpleAnalysis.h.
|
private |
.root input files
Definition at line 37 of file TSimpleAnalysis.h.
|
private |
Output file in which are stored the histograms.
Definition at line 38 of file TSimpleAnalysis.h.
|
private |
Name of the input tree.
Definition at line 39 of file TSimpleAnalysis.h.