RootUtils
HistUtils Namespace Reference

Functions

Double_t getMeanY (TH1 *hist)
 Get histogram mean value along Y axis. More...
 
void invertHist (TH1 *hist)
 Invert histogram. More...
 
TH1 * cropHistogram (TH1 *hist, Double_t minX, Double_t maxX)
 Crop histogram to a given range. More...
 
TH1 * cropHistogram (TH1 *hist, Int_t minBin, Int_t maxBin)
 Crop histogram to a given bin range. More...
 
TH2 * makeHistStack (TList *histList, Double_t axisMin=0, Double_t axisMax=1, const char *name="")
 Make 3D histogram stack. More...
 

Detailed Description

Useful histogram operations.

Function Documentation

◆ cropHistogram() [1/2]

TH1 * HistUtils::cropHistogram ( TH1 *  hist,
Double_t  minX,
Double_t  maxX 
)

Crop histogram to a given range.

Function finds corresponding bins and returns cropped histogram with bins including the given range.

Parameters
histhistogram.
minXminimum value along X axis of the new histogram.
maxXmaximum value along X axis of the new histogram.
Returns
new TH1 histogram.

◆ cropHistogram() [2/2]

TH1 * HistUtils::cropHistogram ( TH1 *  hist,
Int_t  minBin,
Int_t  maxBin 
)

Crop histogram to a given bin range.

Function returns cropped histogram with bin numbers between minBin and maxBin.

Parameters
histhistogram.
minBinminimum bin number.
maxBinmaximum bin number.
Returns
new TH1 histogram.

◆ getMeanY()

Double_t HistUtils::getMeanY ( TH1 *  hist)

Get histogram mean value along Y axis.

Function returns an average value of counts across all the bins.

Parameters
histhistogram.
Returns
double value of mean counts.

◆ invertHist()

void HistUtils::invertHist ( TH1 *  hist)

Invert histogram.

Function inverts histogram values in each bin.

Parameters
histhistogram.

◆ makeHistStack()

TH2 * HistUtils::makeHistStack ( TList *  histList,
Double_t  axisMin = 0,
Double_t  axisMax = 1,
const char *  name = "" 
)

Make 3D histogram stack.

A list of TH1 histograms are aligned one after another in a 3D stack way

Parameters
histListTList of histograms.
axisMinminimum new axis number.
axisMaxmaximum new axis number.
namename of returned histogram
Returns
new TH2* histogram.