HighLAND
|
#include <HistoStack.hxx>
Public Member Functions | |
HistoStack (const std::string &title, const std::string &titleX, const std::string &titleY) | |
virtual | ~HistoStack () |
bool | Is1D () |
Tells whether this is a 1D histo. | |
bool | Is2D () |
Tells whether this is a 2D histo. | |
void | Add (TH1_h *h1, int lc, int lw, int fc, int fs, const std::string &leg) |
Add a new 1D histogram to the stack, with fill colour "fc", line colour "lc". | |
void | Add (TH2_h *h2, int fc, int lc, const std::string &leg="") |
Add a new 2D histogram to the stack, with fill colour "fc", line colour "lc". | |
void | Draw (int lc, int lw, int fc, int fs, const std::string &root_opt="", const std::string &opt="", const std::string &leg_opt="", int mode=0) |
void | Draw (const std::string &root_opt="", const std::string &opt="") |
Same as above but with a predefined style. | |
void | SetTotal (TH1_h *h1) |
void | SetTotal (TH2_h *h2) |
TH1_h * | GetTotal1D () |
Return the total 1D histo. | |
TH1_h * | GetTotalStat1D () |
Return the total 1D histo with only stat errors. | |
TH1_h * | GetTotalSyst1D () |
Return the total 1D histo with only systematic errors. | |
TH2_h * | GetTotal2D () |
Return the total 2D histo. | |
void | AddTotal (TH1_h *h1, TH1_h *hsyst=NULL) |
Sets the total 1D histo if it does not exists or adds to the previous one when it exists. | |
void | AddSystHistos (TH2_h *h1, TH2_h *h2, TH2_h *h1w) |
Add histos for updating systematics when using several files. | |
void | GetSystHistos (const std::string &group, TH2_h *&h1, TH2_h *&h2, TH2_h *&h1w) |
Get Histos for updating systematics when using several files. | |
void | AddSystHistosGroup (const std::string &group) |
Add a new group of systemtic histos. | |
void | SetCurrentSystGroup (const std::string &group) |
Set the current Systematics group. | |
const std::string & | GetCurrentSystGroup () |
std::vector< std::string > | GetSystHistosGroups () const |
get the vector of groups of systemtic histos | |
void | AddTotal (TH2_h *h2) |
Sets the total 2D histo if it does not exists or adds to the previous one when it exists. | |
void | FillLegend (TLegend *leg) |
Fill the legend with info in the HistoStack. | |
TH1_h * | GetHisto1D (const std::string &title) |
Returns one of the histos in the 1D stack. The title is used for comparison. | |
TH1_h * | GetHisto1D (Int_t index) |
Returns the 1D histo with a given index. | |
TH2_h * | GetHisto2D (const std::string &title) |
Returns one of the histos in the 2D stack. The title is used for comparison. | |
TH2_h * | GetHisto2D (Int_t index) |
Returns the 2D histo with a given index. | |
void | Print () const |
Dump the stack contents. | |
void | NormalizeByArea (const std::string &uopt, double area=1) |
normalize all histos in the stack by area | |
void | ResetDrawHistos () |
delete all temporary histos used for drawing the stak (with variable binning normalization) | |
double | GetMaximum (const std::string &opt="") |
Get the maximum for the HistoStack. | |
double | GetMaximumWithError (const std::string &opt="") |
Get the maximum for the HistoStack taking into account the upper error. | |
void | SetMaximum (double max) |
Set the maximum for the HistoStack. | |
void | SetMinimum (double min) |
Set the minimum for the HistoStack. | |
Protected Attributes | |
std::vector< TH1_h * > | _histos1D |
The TH1_hs that were added to the stack. | |
std::vector< TH1_h * > | _histos1D_draw |
The TH1_hs that were added to the stack. Temporary histos used for drawing the stack (with variable binning normalization) | |
std::vector< TH2_h * > | _histos2D |
The TH2_hs that were added to the stack. | |
THStack * | _stack |
The root stack. | |
TH1_h * | _hall1D |
TH1_h * | _hall1D_stat |
The "total" 1D histogram with only stat errors. | |
TH1_h * | _hall1D_syst |
The "total" 1D histogram with only systematic errors. | |
TH1_h * | _hall1D_draw |
temporary histo used for drawing the total (with variable binning normalization) | |
TH2_h * | _hall2D |
std::string | _title |
The title of the plot. | |
std::string | _titleX |
The title of the X axis. | |
std::string | _titleY |
The title of the Y axis. | |
bool | _is1D |
is it 1D ? | |
bool | _is2D |
is it 2D ? | |
std::vector< std::string > | _systHistosGroups |
Histos for updating systematics when using several files. | |
std::string | _currentSystGroup |
std::map< std::string, TH2_h * > | _h1 |
std::map< std::string, TH2_h * > | _h1w |
std::map< std::string, TH2_h * > | _h2 |
This class is used by the DrawingTools and DrawingToolsBase classes to aid the creation of stacked histograms.
The stacked histograms are created based on track categories (for example, "particle") and track types within those categories (for example, "muon" and "electron"). The track categories are from the TrackCategoryDefinition class, and the types from the TrackTypeDefinition class.
The underlying implementation does not use a THStack, but overlaid histograms. This means we the same logic can be used to stack both TH1 and TH2 histograms.
Definition at line 25 of file HistoStack.hxx.
HistoStack::HistoStack | ( | const std::string & | title, |
const std::string & | titleX, | ||
const std::string & | titleY | ||
) |
Instantiate the object, setting the title of the plot, the X axis, and the Y axis.
Definition at line 6 of file HistoStack.cxx.
|
virtual |
Destructor, which cleans up the cumulative histograms used internally by the class. The user should delete the histograms that were added to the stack.
Definition at line 34 of file HistoStack.cxx.
void HistoStack::Draw | ( | int | lc, |
int | lw, | ||
int | fc, | ||
int | fs, | ||
const std::string & | root_opt = "" , |
||
const std::string & | opt = "" , |
||
const std::string & | leg_opt = "" , |
||
int | mode = 0 |
||
) |
Draw the stack of histograms that have been added. If "root_opt" contains "same", then the current active pad is re-used. If "opt" contains "ETOT", then error bars are drawn on the total stack.
Definition at line 148 of file HistoStack.cxx.
|
inline |
The total histogram is normally the sum of all the histograms that were added to the stack. This can be overriden (before calling Draw()).
Definition at line 60 of file HistoStack.hxx.
|
inline |
The total histogram is normally the sum of all the histograms that were added to the stack. This can be overriden (before calling Draw()).
Definition at line 64 of file HistoStack.hxx.
|
protected |
The "total" 1D histogram. Nominally the sum of all the stacked histograms, but can be set by the user.
Definition at line 154 of file HistoStack.hxx.
|
protected |
The "total" 2D histogram. Nominally the sum of all the stacked histograms, but can be set by the user.
Definition at line 167 of file HistoStack.hxx.