|
NAGASH 0.9.8
Next Generation Analysis System
|
Provide a base class for manipulating a group of histograms at the same time. More...
#include "NAGASH/PlotGroup.h"
Public Member Functions | |
| PlotGroup (std::shared_ptr< MSGTool > MSG, std::shared_ptr< ConfigTool > c, const TString &rname, const TString &fname="") | |
| Constructor, same as that of Result. | |
| virtual | ~PlotGroup ()=default |
| template<typename HistType > | |
| void | AddNGHist (const TString &name, std::shared_ptr< NGHist< HistType > > plot) |
| Append a NGHist to this PlotGroup. | |
| void | AddPlot1D (const TString &name, std::shared_ptr< Plot1D > plot) |
| Append a NGHist<TH1D> to this PlotGroup. | |
| void | AddPlot2D (const TString &name, std::shared_ptr< Plot2D > plot) |
| Append a NGHist<TH2D> to this PlotGroup. | |
| void | AddPlot3D (const TString &name, std::shared_ptr< Plot3D > plot) |
| Append a NGHist<TH3D> to this PlotGroup. | |
| template<typename HistType , typename... Args> | |
| std::shared_ptr< NGHist< HistType > > | BookNGHist (const TString &name, Args &&...args) |
| Book NGHist and store in this PlotGroup. | |
| template<typename... Args> | |
| std::shared_ptr< Plot1D > | BookPlot1D (const TString &name, Args &&...args) |
| Book NGHist<TH1D> | |
| template<typename... Args> | |
| std::shared_ptr< Plot2D > | BookPlot2D (const TString &name, Args &&...args) |
| Book NGHist<TH2D> | |
| template<typename... Args> | |
| std::shared_ptr< Plot3D > | BookPlot3D (const TString &name, Args &&...args) |
| Book NGHist<TH3D> | |
| void | BookSystematicVariation (const std::vector< TString > &names, double corr_factor=0, HistBase::SystPolicy policy=HistBase::SystPolicy::Maximum) |
| Book systematic variations for each histogram inside this PlotGroup. | |
| void | BookSystematicVariation (const TString &name, double corr_factor=0, HistBase::SystPolicy policy=HistBase::SystPolicy::Maximum) |
| Book systematic variations for each histogram inside this PlotGroup. | |
| void | BookSystematicVariation (const TString &name1, const TString &name2, double corr_factor=0, HistBase::SystPolicy policy=HistBase::SystPolicy::Maximum) |
| Book systematic variations for each histogram inside this PlotGroup. | |
| void | ClearLinkPlotGroup () |
| Clear the linked plotgroup. | |
| std::shared_ptr< PlotGroup > | Clone (const TString &name) |
| Clone this PlotGroup. | |
| void | Combine (std::shared_ptr< Result > result) override |
| Combine two PlotGroups. | |
| void | ForEachPlot (std::function< void(std::shared_ptr< HistBase >)>) |
| Apply the given function to each histogram inside this PlotGroup. | |
| template<typename HistType > | |
| std::shared_ptr< NGHist< HistType > > | GetNGHist (const TString &name) |
| Get booked NGHist with given name. | |
| int | GetNPlots () |
| Get the number of histograms stored inside this PlotGroup. | |
| std::shared_ptr< Plot1D > | GetPlot1D (const TString &name) |
| Get NGHist<TH1D> | |
| std::shared_ptr< Plot2D > | GetPlot2D (const TString &name) |
| Get NGHist<TH2D> | |
| std::shared_ptr< Plot3D > | GetPlot3D (const TString &name) |
| Get NGHist<TH3D> | |
| void | Process () |
| Call NGHist::Process() for each histogram inside this PlotGroup. | |
| void | Recover (const TString &filename) |
| Retrieve histograms from the input file. | |
| void | Recover (std::shared_ptr< TFileHelper >) |
| Retrieve histograms from the input file. | |
| void | Recover (TFile *file) |
| Retrieve histograms from the input file. | |
| void | RegroupSystematicVariation (const std::vector< TString > &names, HistBase::SystPolicy policy) |
| Call NGHist::RegroupSystematicVariation for each histogram inside this PlotGroup. | |
| void | RemoveSystematicVariation (const TString &name) |
| Call NGHist::RemoveSystematicVariation for each histogram inside this PlotGroup. | |
| void | RenameSystematicVariation (const TString &name_old, const TString &name_new) |
| Call NGHist::RenameSystematicVariation for each histogram inside this PlotGroup. | |
| void | Reset () |
| Call NGHist::Reset() for each histogram inside this PlotGroup. | |
| void | Scale (double) |
| Call NGHist::Scale() for each histogram inside this PlotGroup. | |
| void | ScaleVariation (const TString &, double) |
| Scale a variation of each histogram inside this PlotGroup. | |
| void | SetLinkPlotGroup (uint64_t, std::shared_ptr< PlotGroup >) |
| Set the linked plotgroup, should be the same structure of this one. | |
| void | SetLinkType (const TString &) |
| Set the type of the link for each histogram inside this PlotGroup. | |
| void | SetLinkType (std::function< double(const std::vector< double > &)>, std::function< double(const std::vector< double > &, const std::vector< double > &)>) |
| Set link function for each histogram inside this PlotGroup. | |
| void | SetLinkType (std::function< void(const std::vector< TH1 * > &, TH1 *)>) |
| Set the type of the link for each histogram inside this PlotGroup. | |
| void | SetSystematicVariation (const TString &name="Nominal") |
| Set the systematic variation for each histogram inside this PlotGroup. | |
| void | SetSystematicVariation (int index) |
| Set the systematic variation for each histogram inside this PlotGroup. | |
| void | SetUnprocessed () |
| Call NGHist::SetUnprocessed() for each histogram inside this PlotGroup. | |
| void | WriteToFile () override |
| Write all histograms inside this PlotGroup to a file. | |
Public Member Functions inherited from NAGASH::Result | |
| const TString & | GetOutputFileName () |
| Return the name of the result. | |
| const TString & | GetResultName () |
Private Attributes | |
| MapTool | maptool |
| std::map< TString, std::shared_ptr< HistBase > > | PlotMap |
| std::vector< std::shared_ptr< HistBase > > | PlotVector |
Additional Inherited Members | |
Protected Member Functions inherited from NAGASH::Result | |
| Result ()=delete | |
| Result (const Result &result)=delete | |
| Result (Result &&result)=delete | |
| Result (std::shared_ptr< MSGTool > MSG, std::shared_ptr< ConfigTool > c, const TString &rname, const TString &fname="") | |
| virtual interface to write the result to a file. | |
| virtual | ~Result ()=default |
| std::shared_ptr< ConfigTool > | ConfigUser () |
| Return the internal ConfigTool.> | |
| std::shared_ptr< MSGTool > | MSGUser () |
| Return the internal MSGTool. | |
| Result & | operator= (const Result &result)=delete |
| Result & | operator= (Result &&result)=delete |
| void | SetOutputFileName (const TString &fileName) |
| Set the output file name of the result. | |
| Toolkit * | ToolkitUser () |
| Return the internal Toolkit. | |
Provide a base class for manipulating a group of histograms at the same time.
Here is a simple demonstration of how to use PlotGroup:
Definition at line 17 of file PlotGroup.h.
| PlotGroup::PlotGroup | ( | std::shared_ptr< MSGTool > | MSG, |
| std::shared_ptr< ConfigTool > | c, | ||
| const TString & | rname, | ||
| const TString & | fname = "" |
||
| ) |
Constructor, same as that of Result.
Definition at line 75 of file PlotGroup.cxx.
|
virtualdefault |
|
inline |
|
inline |
Append a NGHist<TH1D> to this PlotGroup.
| name | name of the NGHist. |
| plot | the pointer to the NGHist<TH1D> to be appended. |
Definition at line 199 of file PlotGroup.h.
|
inline |
Append a NGHist<TH2D> to this PlotGroup.
| name | name of the NGHist. |
| plot | the pointer to the NGHist<TH2D> to be appended. |
Definition at line 207 of file PlotGroup.h.
|
inline |
Append a NGHist<TH3D> to this PlotGroup.
| name | name of the NGHist. |
| plot | the pointer to the NGHist<TH3D> to be appended. |
Definition at line 215 of file PlotGroup.h.
|
inline |
|
inline |
Book NGHist<TH1D>
| ...Args | deduced by compiler. |
Definition at line 145 of file PlotGroup.h.
|
inline |
Book NGHist<TH2D>
| ...Args | deduced by compiler. |
Definition at line 156 of file PlotGroup.h.
|
inline |
Book NGHist<TH3D>
| ...Args | deduced by compiler. |
Definition at line 167 of file PlotGroup.h.
| void PlotGroup::BookSystematicVariation | ( | const std::vector< TString > & | names, |
| double | corr_factor = 0, |
||
| HistBase::SystPolicy | policy = HistBase::SystPolicy::Maximum |
||
| ) |
Book systematic variations for each histogram inside this PlotGroup.
| names | vector of names of the systematic variations. |
| corr_factor | correlation factor. |
| policy | policy to deal with the systematic variations. |
Definition at line 304 of file PlotGroup.cxx.
| void PlotGroup::BookSystematicVariation | ( | const TString & | name, |
| double | corr_factor = 0, |
||
| HistBase::SystPolicy | policy = HistBase::SystPolicy::Maximum |
||
| ) |
Book systematic variations for each histogram inside this PlotGroup.
| name | name of the systematic variation. |
| corr_factor | correlation factor. |
| policy | policy to deal with the systematic variation. |
Definition at line 283 of file PlotGroup.cxx.
| void PlotGroup::BookSystematicVariation | ( | const TString & | name1, |
| const TString & | name2, | ||
| double | corr_factor = 0, |
||
| HistBase::SystPolicy | policy = HistBase::SystPolicy::Maximum |
||
| ) |
Book systematic variations for each histogram inside this PlotGroup.
| name1 | name of the first systematic variation. |
| name2 | name of the second systematic variation. |
| corr_factor | correlation factor. |
| policy | policy to deal with the systematic variations. |
Definition at line 294 of file PlotGroup.cxx.
| void PlotGroup::ClearLinkPlotGroup | ( | ) |
Clear the linked plotgroup.
Definition at line 182 of file PlotGroup.cxx.
| std::shared_ptr< PlotGroup > PlotGroup::Clone | ( | const TString & | name | ) |
Clone this PlotGroup.
| name | the name of the new PlotGroup. |
Definition at line 260 of file PlotGroup.cxx.
|
overridevirtual |
Combine two PlotGroups.
Reimplemented from NAGASH::Result.
Definition at line 80 of file PlotGroup.cxx.
| void PlotGroup::ForEachPlot | ( | std::function< void(std::shared_ptr< HistBase >)> | func | ) |
Apply the given function to each histogram inside this PlotGroup.
| func | the function to be applied to each histogram. |
Definition at line 113 of file PlotGroup.cxx.
|
inline |
| int PlotGroup::GetNPlots | ( | ) |
Get the number of histograms stored inside this PlotGroup.
Definition at line 274 of file PlotGroup.cxx.
|
inline |
Get NGHist<TH1D>
| name | name of the NGHist. |
Definition at line 175 of file PlotGroup.h.
|
inline |
Get NGHist<TH2D>
| name | name of the NGHist. |
Definition at line 183 of file PlotGroup.h.
|
inline |
Get NGHist<TH3D>
| name | name of the NGHist. |
Definition at line 191 of file PlotGroup.h.
| void PlotGroup::Process | ( | ) |
Call NGHist::Process() for each histogram inside this PlotGroup.
Definition at line 105 of file PlotGroup.cxx.
| void PlotGroup::Recover | ( | const TString & | filename | ) |
Retrieve histograms from the input file.
| filename | the name of the input ROOT file. |
Definition at line 219 of file PlotGroup.cxx.
| void PlotGroup::Recover | ( | std::shared_ptr< TFileHelper > | file | ) |
Retrieve histograms from the input file.
| file | the pointer to the TFileHelper. |
Definition at line 251 of file PlotGroup.cxx.
| void PlotGroup::Recover | ( | TFile * | file | ) |
Retrieve histograms from the input file.
| file | the pointer to the ROOT TFile. |
Definition at line 236 of file PlotGroup.cxx.
| void PlotGroup::RegroupSystematicVariation | ( | const std::vector< TString > & | names, |
| HistBase::SystPolicy | policy | ||
| ) |
Call NGHist::RegroupSystematicVariation for each histogram inside this PlotGroup.
Definition at line 311 of file PlotGroup.cxx.
| void PlotGroup::RemoveSystematicVariation | ( | const TString & | name | ) |
Call NGHist::RemoveSystematicVariation for each histogram inside this PlotGroup.
Definition at line 318 of file PlotGroup.cxx.
| void PlotGroup::RenameSystematicVariation | ( | const TString & | name_old, |
| const TString & | name_new | ||
| ) |
Call NGHist::RenameSystematicVariation for each histogram inside this PlotGroup.
Definition at line 325 of file PlotGroup.cxx.
| void PlotGroup::Reset | ( | ) |
Call NGHist::Reset() for each histogram inside this PlotGroup.
Definition at line 210 of file PlotGroup.cxx.
| void PlotGroup::Scale | ( | double | sf | ) |
Call NGHist::Scale() for each histogram inside this PlotGroup.
| sf | the scale factor. |
Definition at line 128 of file PlotGroup.cxx.
| void PlotGroup::ScaleVariation | ( | const TString & | varname, |
| double | sf | ||
| ) |
Scale a variation of each histogram inside this PlotGroup.
| varname | the name of the variation. |
| sf | the scale factor. |
Definition at line 137 of file PlotGroup.cxx.
| void PlotGroup::SetLinkPlotGroup | ( | uint64_t | index, |
| std::shared_ptr< PlotGroup > | pg | ||
| ) |
Set the linked plotgroup, should be the same structure of this one.
Definition at line 171 of file PlotGroup.cxx.
| void PlotGroup::SetLinkType | ( | const TString & | type | ) |
Set the type of the link for each histogram inside this PlotGroup.
Definition at line 157 of file PlotGroup.cxx.
| void PlotGroup::SetLinkType | ( | std::function< double(const std::vector< double > &)> | cf, |
| std::function< double(const std::vector< double > &, const std::vector< double > &)> | ef | ||
| ) |
Set link function for each histogram inside this PlotGroup.
Definition at line 150 of file PlotGroup.cxx.
| void PlotGroup::SetLinkType | ( | std::function< void(const std::vector< TH1 * > &, TH1 *)> | hf | ) |
Set the type of the link for each histogram inside this PlotGroup.
Definition at line 164 of file PlotGroup.cxx.
| void PlotGroup::SetSystematicVariation | ( | const TString & | name = "Nominal" | ) |
Set the systematic variation for each histogram inside this PlotGroup.
| name | the name of the systematic variation. |
Definition at line 333 of file PlotGroup.cxx.
| void PlotGroup::SetSystematicVariation | ( | int | index | ) |
Set the systematic variation for each histogram inside this PlotGroup.
| index | index of the systematic variation. |
Definition at line 341 of file PlotGroup.cxx.
| void PlotGroup::SetUnprocessed | ( | ) |
Call NGHist::SetUnprocessed() for each histogram inside this PlotGroup.
Definition at line 120 of file PlotGroup.cxx.
|
overridevirtual |
Write all histograms inside this PlotGroup to a file.
Reimplemented from NAGASH::Result.
Definition at line 191 of file PlotGroup.cxx.
|
private |
Definition at line 23 of file PlotGroup.h.
|
private |
Definition at line 20 of file PlotGroup.h.
|
private |
Definition at line 21 of file PlotGroup.h.