12 #include "KVHashList.h"
18 template<
typename AnalysisClass>
112 template<
typename HistoType,
typename... Args>
115 auto h =
new HistoType(std::forward<Args>(args)...);
116 static_cast<AnalysisClass&
>(*this).add_histo(
h);
130 static_cast<AnalysisClass&
>(*this).add_tree(t);
149 if (!t)
KVError::Error(
this,
"GetTree()",
"Tree %s not found: is this the right name?",
name);
179 KVError::Warning(
this,
"FillHisto",
"Histogram %s has not been defined", histo_name);
196 KVError::Warning(
this,
"FillHisto",
"Histogram %s has not been defined", histo_name);
205 void FillTree(std::optional<TString> tree_name = {})
208 GetTreeList().R__FOR_EACH(
TTree, Fill)();
212 if ((tt =
GetTree(*tree_name))) {
222 return "KVDataAnalysisTreeHistoHandler";
Methods to facilitate creation and use of histograms and TTrees in user analysis.
const KVHashList * GetTreeList() const
GetTreeList.
const KVHashList * GetHistoList() const
TH1 * GetHisto(const Char_t *name) const
static const Char_t * Class_Name()
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.
TTree * GetTree(const Char_t *name) const
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.
TTree * AddTree(const TString &name, const TString &title="")
HistoType * AddHisto(Args &&... args)
void FillTree(std::optional< TString > tree_name={})
Extended version of ROOT THashList.
T * get_object(const TString &name) const
virtual Int_t Fill(const char *name, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, const char *namez, Double_t w)
virtual const char * ClassName() const
virtual Bool_t InheritsFrom(const char *classname) const
void Error(UserClass p, const char *location, const char *va_(fmt),...)
void Warning(UserClass p, const char *location, const char *va_(fmt),...)