KaliVeda
Toolkit for HIC analysis
KVDataAnalysisTreeHistoHandler< AnalysisClass > Class Template Reference

Detailed Description

template<typename AnalysisClass>
class KVDataAnalysisTreeHistoHandler< AnalysisClass >

Methods to facilitate creation and use of histograms and TTrees in user analysis.

Template Parameters
AnalysisClassthe class which employs this class as one of its base classes (this is an example of the Curiously Recurring Template Pattern)

Definition at line 19 of file KVDataAnalysisTreeHistoHandler.h.

#include <KVDataAnalysisTreeHistoHandler.h>

Public Member Functions

template<typename HistoType , typename... Args>
HistoType * AddHisto (Args &&... args)
 
TTreeAddTree (const TString &name, const TString &title="")
 
void FillHisto (const Char_t *histo_name, const Char_t *label, Double_t weight=1)
 Fill histogram with given name according to label bin and weight. More...
 
void FillHisto (const Char_t *histo_name, Double_t x, Double_t y=1, Double_t z=1, Double_t w=1)
 Fill previously-declared histogram with given name and required arguments. More...
 
void FillTree (std::optional< TString > tree_name={})
 
TH1GetHisto (const Char_t *name) const
 
const KVHashListGetHistoList () const
 
TTreeGetTree (const Char_t *name) const
 
const KVHashListGetTreeList () const
 GetTreeList. More...
 

Static Public Member Functions

static const Char_tClass_Name ()
 

Member Function Documentation

◆ AddHisto()

template<typename AnalysisClass >
template<typename HistoType , typename... Args>
HistoType* KVDataAnalysisTreeHistoHandler< AnalysisClass >::AddHisto ( Args &&...  args)
inline

Add a user histogram to the analysis. The name of the histogram can later be used in calls to FillHisto().

-/! th1 is a pointer to TH1F
auto th1 = AddHisto<TH1F>("h1", "A 1-D histogram", 100, -50., 50.);
-/! th2 is a pointer to TH2F
auto th2 = AddHisto<TH2F>("h2", "A 2-D histogram", 100, -50., 50., 100, -10., 10.);
auto * th2
auto * th1
TArc a
Template Parameters
HistoTypevalid ROOT histogram class name
Parameters
argsarguments required by constructor of HistoType class
Returns
address of the newly-created histogram as a pointer of type HistoType*

Definition at line 113 of file KVDataAnalysisTreeHistoHandler.h.

◆ AddTree()

template<typename AnalysisClass >
TTree* KVDataAnalysisTreeHistoHandler< AnalysisClass >::AddTree ( const TString name,
const TString title = "" 
)
inline

Create TTree and add to list of trees to be filled during analysis. name can be used to fill individual TTree with FillTree().

Parameters
namename for TTree
titleoptional title for TTree
Returns
pointer to new TTree

Definition at line 127 of file KVDataAnalysisTreeHistoHandler.h.

◆ Class_Name()

template<typename AnalysisClass >
static const Char_t* KVDataAnalysisTreeHistoHandler< AnalysisClass >::Class_Name ( )
inlinestatic

Definition at line 220 of file KVDataAnalysisTreeHistoHandler.h.

◆ FillHisto() [1/2]

template<typename AnalysisClass >
void KVDataAnalysisTreeHistoHandler< AnalysisClass >::FillHisto ( const Char_t histo_name,
const Char_t label,
Double_t  weight = 1 
)
inline

Fill histogram with given name according to label bin and weight.

Parameters
histo_namename of histogram previously defined with AddHisto()
labellabel of bin in histogram to fill
weightweight for filling

Definition at line 189 of file KVDataAnalysisTreeHistoHandler.h.

◆ FillHisto() [2/2]

template<typename AnalysisClass >
void KVDataAnalysisTreeHistoHandler< AnalysisClass >::FillHisto ( const Char_t histo_name,
Double_t  x,
Double_t  y = 1,
Double_t  z = 1,
Double_t  w = 1 
)
inline

Fill previously-declared histogram with given name and required arguments.

Parameters
[in]histo_namename of histogram to fill
[in]xvalue for x axis
[in]yvalue for y axis (or weight if histogram is 1D)
[in]zvalue for z axis (or weight if histogram is 2D or TProfile)
[in]wweight for 3D histogram (TH3, TProfile2D)

Definition at line 161 of file KVDataAnalysisTreeHistoHandler.h.

◆ FillTree()

template<typename AnalysisClass >
void KVDataAnalysisTreeHistoHandler< AnalysisClass >::FillTree ( std::optional< TString tree_name = {})
inline

Call TTree::Fill() for TTree with given name, or for all trees associated with analysis if no name given.

Parameters
tree_name[optional] name of individual TTree to fill

Definition at line 205 of file KVDataAnalysisTreeHistoHandler.h.

◆ GetHisto()

template<typename AnalysisClass >
TH1* KVDataAnalysisTreeHistoHandler< AnalysisClass >::GetHisto ( const Char_t name) const
inline
Parameters
namename of histogram
Returns
pointer to histogram with given name added with AddHisto()

Definition at line 137 of file KVDataAnalysisTreeHistoHandler.h.

◆ GetHistoList()

template<typename AnalysisClass >
const KVHashList* KVDataAnalysisTreeHistoHandler< AnalysisClass >::GetHistoList ( ) const
inline
Returns
pointer to the list of all histograms added with AddHisto()

Definition at line 84 of file KVDataAnalysisTreeHistoHandler.h.

◆ GetTree()

template<typename AnalysisClass >
TTree* KVDataAnalysisTreeHistoHandler< AnalysisClass >::GetTree ( const Char_t name) const
inline
Parameters
namename of TTree
Returns
pointer to TTree with given name added with AddTree()

Definition at line 146 of file KVDataAnalysisTreeHistoHandler.h.

◆ GetTreeList()

template<typename AnalysisClass >
const KVHashList* KVDataAnalysisTreeHistoHandler< AnalysisClass >::GetTreeList ( ) const
inline

GetTreeList.

Returns
pointer to the list of trees added with AddTree()

Definition at line 92 of file KVDataAnalysisTreeHistoHandler.h.