HighLAND
Public Types | Public Member Functions | Protected Attributes | List of all members
OutputManager Class Reference

#include <OutputManager.hxx>

Inheritance diagram for OutputManager:
TreeManager SimpleLoopBase CreateFlatTree CreateMiniTree

Public Types

enum  enumStandardMicroTrees_OutputManager { NTOYS =0, toy_weight, toy_index, enumStandardMicroTreesLast_OutputManager }
 
enum  enumSpecialTrees {
  config =0, header, truth, NRooTrackerVtx,
  GRooTrackerVtx, RooTrackerVtx, enumSpecialTreesLast
}
 

Public Member Functions

virtual bool Initialize ()
 
virtual bool InitializeEntry ()
 
virtual void Finalize ()
 
void InitializeTrees (bool iniVars=true)
 
void InitializeTree (Int_t tree_index, bool iniVars=true)
 
void InitializeTree ()
 
std::string GetString (int a)
 
std::string GetSize (const std::string &counter_name, unsigned int size)
 
const std::string & GetVarName (Int_t tree_index, Int_t var_index) const
 Returns the variable name.
 
const std::string & GetVarName (Int_t var_index) const
 
const std::string & GetCounterName (Int_t tree_index, Int_t counter_index) const
 Returns the counter name.
 
const std::string & GetCounterName (Int_t counter_index) const
 
void AddCounter (Int_t tree_index, Int_t index, Int_t counter_index, const std::string &counter_name, int size=-1)
 
void AddCounter (Int_t tree_index, Int_t counter_index, const std::string &counter_name, int size=-1)
 
void InitializeCounter (Int_t tree_name, Int_t counter_index)
 
void InitializeCounter (Int_t counter_index)
 
void ResizeCounter (Int_t tree_index, Int_t counter_index, Int_t size)
 
void ResizeCounter (Int_t counter_index, int size)
 
bool HasCounter (Int_t tree_name, Int_t counter_index)
 
bool CheckCounterType (Int_t counter_index, Int_t indx, Int_t var_index)
 
void IncrementCounter (Int_t counter_index)
 
void IncrementCounterForVar (Int_t index)
 
Int_t GetCounterIndexForVar (Int_t index)
 
Int_t GetCounterValue (Int_t counter_index)
 
Int_t GetCounterValue (Int_t tree_index, Int_t counter_index)
 
Int_t GetCounterValueForVar (Int_t index)
 
Int_t GetCounterValueForVar (Int_t tree_index, Int_t index)
 
bool GetFirstIndexFromCounter (Int_t index, Int_t &indx1)
 
void DeleteVar (Int_t tree_index, Int_t index)
 
void AddVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, double ini=-9999)
 Add a single variable to all trees.
 
void AddVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, double ini=-9999)
 Add a single variable to a specific tree.
 
void AddVectorVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, Int_t size=-MAXVECTORSIZE)
 Add a vector variable to all trees.
 
void AddVectorVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, Int_t size=-MAXVECTORSIZE)
 Add a vector variable to a specific tree.
 
void AddVectorVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, const int size)
 Add a vector variable to all trees.
 
void AddVectorVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, const int size)
 Add a vector variable to a specific tree.
 
void AddMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to all trees.
 
void AddMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to a specific tree.
 
void AddMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to all trees.
 
void AddMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to a specific tree.
 
void Add3DMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1, int size3=-1)
 Add a 3D matrix variable to all trees.
 
void Add3DMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1, int size3=-1)
 Add a 3D matrix variable to a specific tree.
 
void AddToyVar (Int_t index, const std::string &name, const std::string &type, const std::string &docstring)
 Add a single analysis variable to all trees.
 
void AddToyVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &docstring)
 Add a single analysis variable to a specific tree.
 
void AddToyVectorVar (Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp)
 Add a vector analysis variable to all trees.
 
void AddToyVectorVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp)
 Add a vector analysis variable to a specific tree.
 
void AddToyMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp1, int ncomp2)
 Add a matrix analysis variable to all trees.
 
void AddToyMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp1, int ncomp2)
 Add a matrix analysis variable to a specific tree.
 
void InitializeVar (Int_t index, Double_t ini)
 
void InitializeVectorVar (Int_t index, Double_t ini)
 
void InitializeMatrixVar (Int_t index, Double_t ini)
 
void FillVar (Int_t index, Float_t var)
 Fill a single variable.
 
void FillVar (Int_t index, Double_t var)
 
void FillVar (Int_t index, Int_t var)
 
void FillVar (Int_t index, const std::string &var)
 
Float_t GetVarValueF (Int_t index)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetVarValueD (Int_t index)
 
Int_t GetVarValueI (Int_t index)
 
void FillVectorVar (Int_t index, Float_t var, Int_t indx=-1)
 Fill a vector variable.
 
void FillVectorVar (Int_t index, Int_t var, Int_t indx=-1)
 
void FillVectorVar (Int_t index, Double_t var, Int_t indx=-1)
 
void FillVectorVar (Int_t index, const std::string &var, Int_t indx=-1)
 
void FillVectorVarFromArray (Int_t index, const Double_t var[], UInt_t size)
 Fill a vector variable from array.
 
void FillVectorVarFromArray (Int_t index, const Float_t var[], UInt_t size)
 
void FillVectorVarFromArray (Int_t index, const Int_t var[], UInt_t size)
 
void FillVectorVarFromArray (Int_t index, const std::string var[], UInt_t size)
 
Float_t GetVectorVarValueF (Int_t index, Int_t i1)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetVectorVarValueD (Int_t index, Int_t i1)
 
Int_t GetVectorVarValueI (Int_t index, Int_t i1)
 
void FillMatrixVar (Int_t index, Float_t var, Int_t indx1, Int_t indx2)
 Fill a matrix variable.
 
void FillMatrixVar (Int_t index, Int_t var, Int_t indx1, Int_t indx2)
 
void FillMatrixVar (Int_t index, Double_t var, Int_t indx1, Int_t indx2)
 
void FillMatrixVarFromArray (Int_t index, const Double_t var[], Int_t indx1, UInt_t size)
 Fill a matrix variable from array.
 
void FillMatrixVarFromArray (Int_t index, const Float_t var[], Int_t indx1, UInt_t size)
 
void FillMatrixVarFromArray (Int_t index, const Int_t var[], Int_t indx1, UInt_t size)
 
void FillMatrixVarFromArray (Int_t index, const Double_t var[], UInt_t size)
 Fill a matrix variable from array.
 
void FillMatrixVarFromArray (Int_t index, const Float_t var[], UInt_t size)
 
void FillMatrixVarFromArray (Int_t index, const Int_t var[], UInt_t size)
 
Float_t GetMatrixVarValueF (Int_t index, Int_t i1, Int_t i2)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetMatrixVarValueD (Int_t index, Int_t i1, Int_t i2)
 
Int_t GetMatrixVarValueI (Int_t index, Int_t i1, Int_t i2)
 
void Fill3DMatrixVar (Int_t index, Float_t var, Int_t indx1, Int_t indx2, Int_t indx3)
 Fill a 3D matrix variable.
 
void Fill3DMatrixVar (Int_t index, Int_t var, Int_t indx1, Int_t indx2, Int_t indx3)
 
void Fill3DMatrixVar (Int_t index, Double_t var, Int_t indx1, Int_t indx2, Int_t indx3)
 
void Fill3DMatrixVarFromArray (Int_t index, const Double_t var[], Int_t indx1, Int_t indx2, UInt_t size)
 Fill a 3D matrix variable from array.
 
void Fill3DMatrixVarFromArray (Int_t index, const Float_t var[], Int_t indx1, Int_t indx2, UInt_t size)
 
void Fill3DMatrixVarFromArray (Int_t index, const Int_t var[], Int_t indx1, Int_t indx2, UInt_t size)
 
void FillToyVar (Int_t index, Int_t var)
 Fill a single analysis variable.
 
void FillToyVar (Int_t index, Float_t var)
 
void FillToyVar (Int_t index, Double_t var)
 
Float_t GetToyVarValueF (Int_t index)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetToyVarValueD (Int_t index)
 
Int_t GetToyVarValueI (Int_t index)
 
void FillToyVectorVar (Int_t index, Int_t var, Int_t comp)
 Fill a vector analysis variable.
 
void FillToyVectorVar (Int_t index, Float_t var, Int_t comp)
 
void FillToyVectorVar (Int_t index, Double_t var, Int_t comp)
 
Float_t GetToyVectorVarValueF (Int_t index, Int_t i1)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetToyVectorVarValueD (Int_t index, Int_t i1)
 
Int_t GetToyVectorVarValueI (Int_t index, Int_t i1)
 
void FillToyMatrixVar (Int_t index, Int_t var, Int_t comp1, Int_t comp2)
 Fill a matrix analysis variable.
 
void FillToyMatrixVar (Int_t index, Float_t var, Int_t comp1, Int_t comp2)
 
void FillToyMatrixVar (Int_t index, Double_t var, Int_t comp1, Int_t comp2)
 
void InitializeAnalysisVar (Int_t index, Double_t ini)
 
void InitializeAnalysisVectorVar (Int_t index, Double_t ini)
 
void FillTree (Int_t tree_index)
 Fill a specific tree.
 
void FillTree ()
 Fill the current tree.
 
void WriteTree (const std::string &file, const std::string &conf)
 Write a specific tree into a file.
 
void WriteTrees (const std::string &file)
 Write all trees into a file.
 
void AddTreeWithName (Int_t tree_index, const std::string &tree_name, TTree *tree=NULL)
 Add a tree provided its index and name.
 
bool OpenOutputFile (const std::string &file)
 open the output file
 
void CloseOutputFile ()
 close the output file
 
bool ValidateVarNameAndIndex (Int_t tree_index, Int_t var_index, const std::string &var_name)
 
bool IsSpecialTree (Int_t tree_index)
 
void SetToyIndex (Int_t index)
 Set and gets the index of the current toy experiment.
 
Int_t GetToyIndex ()
 
void SetNToys (Int_t tree_index, int ntoys)
 Sets and gets the number of toy experiments for a given configuration.
 
UInt_t GetNToys (Int_t tree_index)
 Get the number of toys for a given tree.
 
UInt_t GetNToys ()
 Get the number of toys for the current tree.
 
void AddToyWeight (Double_t w)
 
void FillMicroTrees ()
 
void SetFillSingleTree (Int_t tree_index)
 
void SetFillAllTrees ()
 
void CheckVariableType (Int_t index, const std::string &dim, const std::string &type, Bool_t exist)
 
void SetDocStringManager (DocStringManager *doc)
 
DocStringManagerdocstrings ()
 
- Public Member Functions inherited from TreeManager
std::vector< TTree *> & GetTrees ()
 Returns the map of trees.
 
TTree * GetTree (Int_t index)
 Returns the a tree with a given index.
 
TTree * GetTree (const std::string &name)
 Returns the a tree with a given name.
 
TTree * GetTree ()
 Returns the a tree set as current.
 
void ReadTree (const std::string &file, Int_t index)
 Read a tree from a file provided the index.
 
void ReadTree (const std::string &file, const std::string &name)
 Read a tree from a file provided the name.
 
void ReadFile (const std::string &file)
 Read all trees from a file.
 
Int_t GetTreeIndex (const std::string &tree_name)
 Retuns the tree index provided the name.
 
std::string GetTreeName (Int_t index)
 Retuns the tree name provided the index.
 
Int_t GetCurrentTree () const
 Retuns the current tree index.
 
std::string GetCurrentTreeName ()
 Retuns the current tree name.
 
void SetCurrentTree (Int_t index)
 Sets the current tree provided the index.
 
void SetCurrentTree (const std::string &tree_name)
 Sets the current tree provided the name.
 
bool HasTree (Int_t index)
 Check the existence of a tree provided the index.
 
bool HasTree (const std::string &tree_name)
 Check the existence of a tree provided the name.
 

Protected Attributes

std::string _default_docstring
 
DocStringManager_doc
 
std::vector< Double_t > _toyWeights
 
int _toy_index
 current toy experiment index
 
Int_t _single_tree_fill
 
std::vector< std::vector< std::string > > _tree_vars_all_vars
 The names of all variables added.
 
std::vector< std::vector< std::string > > _tree_vars_all_counters
 The names of all counters added.
 
std::vector< std::vector< Int_t > > _link_var_to_counter
 Correspondece between a variable index and the counter index.
 
std::vector< std::vector< Int_t > > _tree_vars_counter_size
 The size of the counter: 0 for variable size vectors, >0 for fix size vectors.
 
std::vector< std::vector< Int_t > > _tree_vars_counter
 The counter it self.
 
std::vector< std::vector< Int_t > > _tree_vars_int
 Single variables.
 
std::vector< std::vector< Float_t > > _tree_vars_float
 
std::vector< std::vector< Double_t > > _tree_vars_double
 
std::vector< std::vector< achar > > _tree_vars_char
 
std::vector< std::vector< int_vector *> > _tree_vars_int_vector
 Vector variables (1 index)
 
std::vector< std::vector< float_vector *> > _tree_vars_float_vector
 
std::vector< std::vector< double_vector *> > _tree_vars_double_vector
 
std::vector< std::vector< char_vector *> > _tree_vars_char_vector
 
std::vector< std::vector< int_matrix *> > _tree_vars_int_matrix
 Matrix variables (2 indices)
 
std::vector< std::vector< float_matrix *> > _tree_vars_float_matrix
 
std::vector< std::vector< double_matrix *> > _tree_vars_double_matrix
 
std::vector< std::vector< char_matrix *> > _tree_vars_char_matrix
 
std::vector< std::vector< int_3Dmatrix *> > _tree_vars_int_3Dmatrix
 3D matrix variables (3 indices)
 
std::vector< std::vector< float_3Dmatrix *> > _tree_vars_float_3Dmatrix
 
std::vector< std::vector< double_3Dmatrix *> > _tree_vars_double_3Dmatrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_counter
 The counter it self.
 
std::vector< std::vector< Int_t > > _tree_vars_used_int
 Single variables.
 
std::vector< std::vector< Int_t > > _tree_vars_used_float
 
std::vector< std::vector< Int_t > > _tree_vars_used_double
 
std::vector< std::vector< Int_t > > _tree_vars_used_char
 
std::vector< std::vector< Int_t > > _tree_vars_used_int_vector
 Vector variables (1 index)
 
std::vector< std::vector< Int_t > > _tree_vars_used_float_vector
 
std::vector< std::vector< Int_t > > _tree_vars_used_double_vector
 
std::vector< std::vector< Int_t > > _tree_vars_used_char_vector
 
std::vector< std::vector< Int_t > > _tree_vars_used_int_matrix
 Matrix variables (2 indices)
 
std::vector< std::vector< Int_t > > _tree_vars_used_float_matrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_double_matrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_char_matrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_int_3Dmatrix
 3D matrix variables (3 indices)
 
std::vector< std::vector< Int_t > > _tree_vars_used_float_3Dmatrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_double_3Dmatrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int
 –— Vectors containing whether a given index is used or not More...
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_char
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int_vector
 Vector variables (1 index)
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float_vector
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double_vector
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_char_vector
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int_matrix
 Matrix variables (2 indices)
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float_matrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double_matrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_char_matrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int_3Dmatrix
 3D matrix variables (3 indices)
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float_3Dmatrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double_3Dmatrix
 
- Protected Attributes inherited from TreeManager
TFile * _file
 Root input or output file.
 
std::vector< TTree *> _trees
 Vector of trees.
 
std::vector< TTree *> _trees_nonull
 Vector of non NULL trees.
 
std::vector< Int_t > _trees_indices
 Vector of indices for the non NULL TTree in previous vector.
 
Int_t _current_tree
 The current tree.
 

Detailed Description

This class is an easy interfice ROOT's TTree functionality. It allows adding single variables to a tree, vectors, matrices, etc.

TODO: This class needs to be documented properly.

Definition at line 486 of file OutputManager.hxx.

Member Function Documentation

§ IsSpecialTree()

bool OutputManager::IsSpecialTree ( Int_t  tree_index)

Whether the given tree name (conf) is "special" or not. Special trees aren't the normal micro-trees, and contain meta information, like the header or config info, or RooTracker information.

Definition at line 255 of file OutputManager.cxx.

255  {
256 //**************************************************
257 
258  return (tree_index < (Int_t)NMAXSPECIALTREES);
259 }

§ ValidateVarNameAndIndex()

bool OutputManager::ValidateVarNameAndIndex ( Int_t  tree_index,
Int_t  var_index,
const std::string &  var_name 
)

Ensure that the variable 'name' hasn't been added to the tree with index tree_index already. Keeps a record of names that it's seen in _tree_vars_all_vars.

Definition at line 566 of file OutputManager.cxx.

566  {
567 //********************************************************************
568 
569  if (std::find(_tree_vars_all_vars[tree_index].begin(), _tree_vars_all_vars[tree_index].end(), var_name) != _tree_vars_all_vars[tree_index].end()) {
570  std::cerr << "ERROR: The tree '" << _trees[tree_index]->GetName() << "' already contains a variable called '" << var_name << "' - please call your variable something else." << std::endl;
571  std::cerr << "Program will now exit, to save you from having to solve a nasty bug later..." << std::endl;
572  exit(1);
573  }
574 
575  if (_tree_vars_all_vars[tree_index][var_index]!="") {
576  std::cerr << "ERROR: The tree '" << _trees[tree_index]->GetName() << "' already contains a variable with index " << var_index
577  << " and a different name '" << GetVarName(tree_index, var_index)
578  << "' - please use a different index for variable '" << var_name << "'" << std::endl;
579  std::cerr << "Program will now exit, to save you from having to solve a nasty bug later..." << std::endl;
580  exit(1);
581  }
582 
583  _tree_vars_all_vars[tree_index][var_index]=var_name;
584 
585  return true;
586 }
const std::string & GetVarName(Int_t tree_index, Int_t var_index) const
Returns the variable name.
std::vector< TTree *> _trees
Vector of trees.
Definition: TreeManager.hxx:75
std::vector< std::vector< std::string > > _tree_vars_all_vars
The names of all variables added.

Member Data Documentation

§ _tree_vars_exist_int

std::vector< std::vector< Bool_t > > OutputManager::_tree_vars_exist_int
protected

–— Vectors containing whether a given index is used or not

Single variables

Definition at line 854 of file OutputManager.hxx.


The documentation for this class was generated from the following files: