75   std::size_t comment = 
line.find(
'#');
 
 
  100   static const std::string 
kCutIntr = 
" if ";
 
  102   std::size_t equal = 
line.find(
'=');
 
  103   if (equal == std::string::npos)
 
  104      return "Error: missing '='";
 
  107   std::string histName = 
line.substr(0, equal);
 
  109   if (histName.empty())
 
  110      return "Error: no histName found";
 
  115   if (
cutPos == std::string::npos)
 
  121      return "Error: no expression found";
 
  125   if (
cutPos != std::string::npos) {
 
  129         return "Error: missing cut expression after 'if'";
 
  135   auto check = 
fHists.insert(std::make_pair((
const std::string&)histName,
 
  140      return "Duplicate histogram name";
 
 
  208   static const char* 
errors[] {
 
  211         "invalid entry number", 
 
  212         "cannot open the file", 
 
  221      if (
chEl->GetLoadResult() < 0) {
 
  222         ::Error(
"TSimpleAnalysis::Run", 
"Load failure in file %s: %s",
 
 
  243         if (!
probe->IsZombie()) {
 
 
  271   if (
ofile.IsZombie()) {
 
  286      for (
const auto &histo : 
fHists) {
 
  287         const std::string& 
expr = histo.second.first;
 
  288         const std::string& 
histoName = histo.first;
 
  289         const std::string& cut = histo.second.second;
 
  296            return std::vector<TH1F *>();
 
  314   std::vector<std::pair<TChain*, TDirectory*>> 
vChains;
 
  341   for (
unsigned j = 0; 
j < 
fHists.size(); 
j++) {
 
  370   for (
auto histo: 
vHisto) {
 
 
  386   if (
line.find(
'=') == std::string::npos) {
 
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Int_t gErrorIgnoreLevel
Error handling routines.
static void DeleteCommentsAndSpaces(std::string &line)
Delete comments, leading and trailing white spaces in a string.
static bool CheckChainLoadResult(TChain *chain)
Returns true if there are no errors in TChain::LoadTree()
bool RunSimpleAnalysis(const char *configurationFile)
Function that allows to create the TSimpleAnalysis object and execute its Configure and Analyze funct...
static std::string ExtractTreeName(std::string &firstInputFile)
Extract the name of the tree from the first input file when the tree name isn't in the configuration ...
This class provides a simple interface to execute the same task multiple times in parallel threads,...
A TChainElement describes a component of a TChain.
A chain is a collection of files containing TTree objects.
virtual Int_t Add(TChain *chain)
Add all files referenced by the passed chain to this chain.
TClass instances represent classes, structs and namespaces in the ROOT type system.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Describe directory structure in memory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a float per channel (see TH1 documentation)
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
A TSimpleAnalysis object creates histograms from a TChain.
std::string fConfigFile
Name of the configuration file.
std::vector< std::string > fInputFiles
.root input files
std::string GetLine(int &numbLine)
Skip subsequent empty lines read from fIn and returns the next not empty line.
@ kReadingInput
Reading the name of the .root input files.
@ kReadingOutput
Reading the name of the output file.
@ kReadingTreeName
Reading the name of the tree.
@ kReadingExpressions
Reading the expressions.
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 obj...
std::ifstream fIn
Stream for the input file.
TSimpleAnalysis(const std::string &file)
bool Run()
Execute all the TChain::Draw() as configured and stores the output histograms.
std::string fOutputFile
Output file in which are stored the histograms.
bool HandleInputFileNameConfig(const std::string &line)
Returns false if not a tree name, otherwise sets the name of the tree.
bool SetTreeName()
Disambiguate tree name from first input file and set up fTreeName if it is empty.
bool Configure()
This function has the aim of setting the arguments read from the input file.
std::map< std::string, std::pair< std::string, std::string > > fHists
The map contains in the first part the names of the histograms written in the output file,...
std::string fTreeName
Name of the input tree.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void EnableThreadSafety()
Enable support for multi-threading within the ROOT code in particular, enables the global mutex to ma...