Common Analysis Framework » QFRAMEWORK » TQHistogramUtils

namespace TQHistogramUtils

Function Members (Methods)

public:
booladdGraph(TGraph* graph1, const TGraph* graph2)
booladdGraph(TGraph2D* graph1, const TGraph2D* graph2)
booladdGraph(TNamed* graph1, const TNamed* graph2)
booladdHistogram(TH1* histo1, const TH1* histo2, TQCounter* scale, double corr12 = 0., bool includeScaleUncertainty = false)
booladdHistogram(TH1* histo1, const TH1* histo2, double scale = 1., double scaleUncertainty = 0., double corr12 = 0., bool includeScaleUncertainty = true)
booladdHistogramAsError(TH1* hist, const TH1* errorhist, bool isRelative = false)
booladdHistogramInQuadrature(TH1* histo1, const TH1* histo2, double factor = 1)
booladdHistogramInQuadrature(TH1* histo1, double val, double factor = 1)
booladdHistogramWithoutError(TH1* histo1, const TH1* histo2, double scale = 1.)
intaddPCA(TPrincipal* orig, TPrincipal* add)
TCanvas*applyATLASstyle(TH1* histo, const TString& label = "Internal", double relPosX = 0.10000000000000001, double relPosY = 0.10000000000000001, double yResize = 1., const TString& xTitle = "none", const TString& yTitle = "none", bool square = false)
TCanvas*applyATLASstyle(TGraph* graph, const TString& label = "Internal", double relPosX = 0.10000000000000001, double relPosY = 0.10000000000000001, double yResize = 1., const TString& xTitle = "none", const TString& yTitle = "none", bool square = false)
TCanvas*applyATLASstyle(TMultiGraph* graph, const TString& label = "Internal", double relPosX = 0.10000000000000001, double relPosY = 0.10000000000000001, double yResize = 1., const TString& xTitle = "none", const TString& yTitle = "none", bool square = false)
boolapplyPoissonErrors(TH1* histo)
TH1*applySlopeToHistogram(TH1* input, double slope)
intapplyStyle(TH1* histo, TQTaggable* tags, const TString& styleScheme = "", bool allowRecursion = true)
boolareEqual(TH1* first, TH1* second, bool includeUnderflowOverflow = true, bool compareErrors = false, double tolerance = 0.01)
boolareEqualRel(double val1, double val2, double rel)
TStyle*ATLASstyle()
doublecalculateBinLineDistSquare(TH2* hist, double a, double b, int i, int j)
boolcheckConsistency(const TH1* histo1, const TH1* histo2, bool verbose = false)
doubleclearBinsAboveX(TH1* hist, double xMax)
doubleclearBinsAboveX(TH2* hist, double xMax)
doubleclearBinsAboveY(TH2* hist, double yMax)
doubleclearBinsBelowX(TH1* hist, double xMin)
doubleclearBinsBelowX(TH2* hist, double xMin)
doubleclearBinsBelowY(TH2* hist, double yMin)
TH1*convertFromText(TString input)
TMatrixD*convertHistogramToMatrix(TH2* hist)
TMatrixDSym*convertHistogramToSymMatrix(TH2* hist, double relThreshold = 1.0000000000000001E-9, double absThreshold = 1.0000000000000001E-9)
TMatrixDSym*convertHistogramToSymMatrix(TH2* hist, const vector<TString>& ordering, double relThreshold = 1.0000000000000001E-9, double absThreshold = 1.0000000000000001E-9)
TH1*convertTo1D(const TH2* histo, bool alongX = true, bool includeUnderflowsX = true, bool includeOverflowsX = true, bool includeUnderflowsY = true, bool includeOverflowsY = true)
TStringconvertToText(const TH1* histo, int detailLevel)
boolcopyAxisStyle(const TH1* source, TH1* target)
boolcopyAxisStyle(const TAxis* source, TAxis* target)
boolcopyBinLabels(const TH1* source, TH1* target)
boolcopyBinLabels(const TAxis* source, TAxis* target)
TNamed*copyGraph(const TNamed* histo, const TString& newName = "")
voidcopyGraphAxisTitles(TNamed* copy, const TNamed* graph)
TH1*copyHistogram(const TH1* histo, const TString& newName = "")
boolcopyStyle(TH1* dest, const TH1* src)
boolcopyStyle(TGraph* dest, const TH1* src)
boolcopyStyle(TGraph* dest, const TGraph* src)
boolcopyStyle(TGraph2D* dest, const TGraph2D* src)
boolcopyStyle(TNamed* dest, const TNamed* src)
TH1*countersToHistogram(TList* counters)
TH1*counterToHistogram(TQCounter* counter)
intcountHoles(TH2* hist)
TH1*createEnvelopingHistogram(TCollection* histos)
TH1*createEnvelopingHistogram(const vector<TH1*>& histos)
TNamed*createGraph(const TString& definition, bool printErrMsg = false)
TNamed*createGraph(TString definition, TString& errMsg)
TH1*createHistogram(TQTaggable* values, const TString& prefix)
TH2*createHistogram(const TGraph2D* graph, int precision)
TH1*createHistogram(const TString& definition, bool printErrMsg = false)
TH1*createHistogram(TString definition, TString& errMsg)
TH2*createHistogram(const TGraph2D* g, int nbinsx, int nbinsy)
boolcropLine(TH1* hist, TLine* l)
TH1*cutAndZoomHistogram(TH1* histo, int cutBinLowX, int cutBinHighX, int cutBinLowY = -1, int cutBinHighY = -1, int zoomBinLowX = -1, int zoomBinHighX = -1, int zoomBinLowY = -1, int zoomBinHighY = -1)
TH1*cutHistogram(TH1* histo, int xBinLow, int xBinHigh, int yBinLow = -1, int yBinHigh = -1, bool keepInUVX = false, bool keepInOVX = false, bool keepInUVY = false, bool keepInOVY = false)
booldivideHistogramWithoutError(TH1* histo1, const TH1* histo2)
booldrawHistograms(TList* histograms, TString drawOption = "", TString extOptions = "")
intdumpData(TPrincipal* p, int cutoff = 100)
intedge(TH1* hist, double cutoff = std::numeric_limits<double>::epsilon())
intedge(TH2* hist, double cutoff = std::numeric_limits<double>::epsilon())
intensureAbsMinimumBinContent(TH1* histo, double min = 9.9999999999999998E-13)
boolensureAbsMinimumContent(double& content, double min = 9.9999999999999998E-13)
intensureMinimumBinContent(TH1* histo, double min = 9.9999999999999998E-13, bool ignoreNegative = false, bool flipToPositive = false, bool assignUncertainty = false)
intensureMinimumBinError(TH1* histo, double averageWeight)
boolensureMinimumContent(double& content, double& uncertainty, double min = 9.9999999999999998E-13, bool ignoreNegative = false, bool flipToPositive = false, bool assignUncertainty = false)
boolenvelopeLower(TH1* hist, TH1* otherhist)
boolenvelopeUpper(TH1* hist, TH1* otherhist)
intestimateSize(const TH1* histo)
doubleevaluateGraph(const TGraph* g, double x, int mode = 0)
boolextractBinning(TQTaggable* p, int& index, int& nBins, double& min, double& max, vector<double>& edges, TString& errMsg)
boolextractRange(TQTaggable* p, int& index, double& min, double& max, TString& errMsg)
boolextractStyle(const TH1* histo, TQTaggable* tags, const TString& styleScheme = "")
boolextractStyle(const TGraph* graph, TQTaggable* tags, const TString& styleScheme = "")
TH1*extraOverflowBins(TH1*& histo, bool underflow = true, bool overflow = true, bool remap = false)
intfillHoles2DAverage(TH2* hist, double threshold, bool allowUnderflowOverflow = false, int dx = 1, int dy = 1, int minSources = 1)
intfillHoles2DMax(TH2* hist, double threshold, bool allowUnderflowOverflow = false, int dx = 1, int dy = 1, int minSources = 1)
doublefindIntersection(const TGraph* a, const TGraph* b, int mode = 0, double left = -std::numeric_limits<double>::quiet_NaN(), double right = std::numeric_limits<double>::quiet_NaN(), double epsilon = std::numeric_limits<double>::epsilon())
intfixHoles1D(TH1* hist, double threshold)
const TAxis*getAxis(const TNamed* obj, int idx)
TAxis*getAxis_nonconst(TNamed* obj, int idx)
doublegetAxisXmax(const TH1* hist)
doublegetAxisXmax(const TGraph* graph)
doublegetAxisXmin(const TH1* hist)
doublegetAxisXmin(const TGraph* graph)
doublegetAxisYmax(const TH1* hist)
doublegetAxisYmin(const TH1* hist)
vector<int>getBinBorders(const TH1* histo, const vector<double>& lowEdges)
vector<int>getBinBorders(const TAxis* histo, const vector<double>& lowEdges)
vector<int>getBinBordersFlat(TH1* histo, int nBins, bool includeOverflows)
vector<int>getBinBordersFlat2D(TH2* histo, int nBins, bool remapX, bool includeOverflows, bool remapSlices = true)
vector<double>getBinLowEdges(const TH1* histo, const vector<int>& binBorders)
vector<double>getBinLowEdges(const TAxis* histo, const vector<int>& binBorders)
TStringgetBinningDefinition(const TAxis* axis)
vector<int>getBinsSortedByRatio(TH1* sig, TH1* bkg, double epsilon = 9.9999999999999998E-13)
doublegetChi2(TH1* histo1, TH1* histo2)
doublegetContourArea(const TGraph* g)
doublegetContourJump(const TGraph* g)
vector<TList*>getContourList(TH2* hist, const vector<double>& thresholds)
TH1*getCutEfficiencyHisto(TH1* histo, TString options = "")
TStringgetDetailsAsString(const TNamed* obj, int option = 1)
TStringgetDetailsAsString(const TH1* histo, int option = 1)
TStringgetDetailsAsString(const TAxis* axis, int option = 1)
TStringgetDetailsAsString(const TGraph* g, int option = 1)
TStringgetDetailsAsString(const TGraph2D* g, int option = 1)
TStringgetDetailsAsString(const TPrincipal* p, int option = 1)
intgetDimension(const TH1* histo)
TH1*getEfficiencyHistogram(TH1* numerator, TH1* denominator)
voidgetFilteredRange(TCollection* histograms, double xmin, double xmax, double minContent, double maxContent, double& lower, double& upper, double logMin)
doublegetFOM(TQHistogramUtils::FOM fom, double b, double berr, double s, double serr)
TH1*getFOMHistogram(TQHistogramUtils::FOM fom, TH1* sig, TH1* bkg, double cutoff = 0, const vector<TH1*>& bkgSystHistos = std::vector<TH1 *>{})
TH1*getFOMScan(TQHistogramUtils::FOM fom, TH1* sig, TH1* bkg, bool fromleft, double cutoff, bool verbose, const vector<TH1*>& bkgSystHistos = std::vector<TH1 *>{})
TStringgetFOMTitleLaTeX(TQHistogramUtils::FOM fom)
TStringgetFOMTitleROOT(TQHistogramUtils::FOM fom)
TGraphAsymmErrors*getGraph(const TH1* histo)
TGraphAsymmErrors*getGraph(const TH1* nom, TObjArray* sys)
TStringgetGraphDefinition(const TNamed* graph)
doublegetHistogramBinContentFromFile(const TString& fname, const TString& hname, const TString binlabel)
doublegetHistogramBinContentFromFile(const TString& fname, const TString& hname, int)
TStringgetHistogramContents(const TH1* histo)
TStringgetHistogramDefinition(const TH1* histo)
doublegetHistogramMaximum(size_t n,...)
doublegetHistogramMinimum(size_t n,...)
doublegetHistogramXmax(size_t n,...)
doublegetHistogramXmin(size_t n,...)
doublegetHistogramYmax(size_t n,...)
doublegetHistogramYmin(size_t n,...)
doublegetIntegral(const TH1* histo, bool userUnderOverflow = true)
doublegetIntegralAndError(const TH1* histo, double& error, bool useUnderflowOverflow = true)
doublegetIntegralError(const TH1* histo)
TH1*getLineDistSquares(TH2* hist, double a, double b, bool useUnderflowOverflow = false)
doublegetMax(const TCollection* c, bool includeUnderflowOverflow = true, double maxMax = std::numeric_limits<double>::infinity())
doublegetMax(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double maxMax = std::numeric_limits<double>::infinity())
boolgetMaxArea2D(const TH2* histo, double frac, int& maxX, int& maxY, int& maxX_low, int& maxX_high, int& maxY_low, int& maxY_high)
intgetMaxBin(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double maxMax = std::numeric_limits<double>::infinity())
doublegetMaximumBinValue(TH1* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
doublegetMaximumBinValue(TCollection* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
doublegetMin(const TCollection* c, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity())
doublegetMin(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity())
intgetMinBin(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity())
doublegetMinBinArea(TH2* hist)
doublegetMinBinWidth(TAxis* a)
doublegetMinimumBinValue(TH1* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
doublegetMinimumBinValue(TCollection* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
boolgetMinMax(const TH1* histo, double& min, double& max, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity(), double maxMax = std::numeric_limits<double>::infinity())
boolgetMinMaxBin(const TH1* histo, int& minBin, int& maxBin, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity(), double maxMax = std::numeric_limits<double>::infinity())
intgetNBins(const TH1* histo, bool includeUnderflowOverflow = true)
intgetNbinsGlobal(const TH1* hist, bool ignoreLabels = false)
intgetNDips(TH1* histo)
vector<int>getOptimizedBinBorders(TH1* hsig, TH1* hbkg, double minSignal = 10, double minBkg = 10, double maxBkgUnc = 0.20000000000000001, bool significanceAgnostic = false, double maxSignal = 30, double estimatedMaxSignInBin = 6, bool verbose = false, double maxSigUnc = 0.5, double minBinWidth = -1, bool mergeBins = true)
doublegetPoisson(double b, double s)
doublegetPoissonError(double b, double s, double db, double ds)
doublegetPoissonWithError(double b, double db, double s)
doublegetPoissonWithErrorError(double b, double s, double db, double ds)
TH1*getProjection(TH1* histo, bool onX, int binLow = -1, int binHigh = -1)
TList*getProjectionHistograms(TH2* histo, bool projectOnX, bool normalize = false)
TList*getProjectionHistogramsX(TH2* histo, bool normalize = false)
TList*getProjectionHistogramsY(TH2* histo, bool normalize = false)
TH1*getProjectionX(TH1* histo, int binLow = -1, int binHigh = -1)
TH1*getProjectionY(TH1* histo, int binLow = -1, int binHigh = -1)
TH1*getRebinned(const TH1* histo, const vector<int>& binBorders, bool doRemap = false, bool keepOverFlowUnderFlowSeparate = false)
TH1*getRebinned(const TH1* histo, const vector<double>& lowEdges, bool doRemap = false, bool keepOverFlowUnderFlowSeparate = false)
TH1*getRebinned(const TH1* histo, const vector<int>& binBordersX, const vector<int>& binBordersY, bool doRemap = false, bool keepOverFlowUnderFlowSeparate = false)
TH1*getRebinned(const TH1* histo, const vector<double>& lowEdgesX, const vector<double>& lowEdgesY, bool doRemap = false, bool keepOverFlowUnderFlowSeparate = false)
TH1*getRebinned(const TH1* histo, const vector<int>& binBorders, const vector<double>& lowEdges, bool doRemap = false, bool keepOverFlowUnderFlowSeparate = false)
TH1*getRebinnedFlat(TH1* histo, int nBins)
TH1*getRelativeVariationHistogram(TH1* variation, TH1* nominal, double epsilon = 0.)
TH1*getRemapped(TH1* histo, const vector<double>& newBinBorders)
TH2*getRemapped2D(TH2* histo, const vector<int>& binBorders, bool remapX = true)
TH1*getRemappedFlat(TH1* histo, int nBins)
TH2*getRemappedFlat2D(TH2* histo, int nBins, bool remapX = true)
TH1*getReweightedHistogram(TH2* histo_input, TH1* histo_weights, bool projectOnX)
TH1*getReweightedHistogramX(TH2* histo_input, TH1* histo_weights)
TH1*getReweightedHistogramY(TH2* histo_input, TH1* histo_weights)
TGraphAsymmErrors*getROCGraph(TH1* h_bkg, TH1* h_sig, bool lowerBound)
voidgetSgnfAndErr(double b, double bErr, double s, double sErr, double& sgnf, double& sgnfErr, TString sgnfName, TString* sgnfTitle = 0)
doublegetSignificance(double b, double s, TString sgnfName, double berr, TString* sgnfTitle = 0)
TH1*getSignificanceHisto(TH1* histo_bkg, TH1* histo_sig, TString options = "")
intgetSizePerBin(const TH1* histo)
TObjArray*getSlices(const TH2* input, bool alongX = true)
TH1*getSlopeHistogram(TH1* input, double slope)
TH1*getSmoothedManually(const TH1* histo, const vector<double>& lowEdges, bool keepOverFlowUnderFlowSeparate = true)
TH1*getSmoothedManually(const TH1* histo, const vector<int>& binBorders, bool keepOverFlowUnderFlowSeparate = true)
TH1*getSmoothedVariation(const TH1* h_nom, TH1* h_var, const vector<int>& binBorders, bool keepOverFlowUnderFlowSeparate = true)
doublegetSoverB(double b, double s)
doublegetSoverSqrtB(double b, double s)
TH1*getSoverSqrtB(TH1* sig, TH1* bkg)
TH1*getSoverSqrtBScan(TH1* signal, TH1* bkg, bool fromleft, double cutoff = 0.050000000000000003, bool verbose = false)
doublegetSoverSqrtSplusB(double b, double s)
doublegetSummedBinByBinSignificance(TH1* histo_bkg, TH1* histo_sig, TString options = "sgnf:poisson")
TH1*getSystematics(TH1* h_nominal, TList* singleVars, TList* pairVars = 0)
TH1*getUncertaintyHistogram(TH1* hist)
voidgetUnFilteredRange(TCollection* histograms, double xmin, double xmax, double minContent, double maxContent, double& lower, double& upper)
vector<double>getUniformBinEdges(int nBins, double min, double max)
boolhasBinLabels(const TH1* h)
boolhasBinLabels(const TAxis* a)
boolhasGreaterMaximumThan(TH1* hist1, TH1* hist2)
boolhasUniformBinning(const TH1* hist)
boolhasUniformBinning(const TAxis* axis)
boolhaveEqualShapeRel(TH1* h1, TH1* h2, double rel)
vector<TString>histoBinsToCutStrings(TH1* hist, const TString& varexpr, TString cutname = "", const TString& basecutname = "")
TQCounter*histogramToCounter(TH1* histo)
TH1*includeOverflowBins(TH1* histo, bool underflow = true, bool overflow = true)
boolincludeSystematics(TH1* histo, TH1* systematics)
voidinterpolateGraph(TGraph* g, size_t increasePoints, const char* option = "S")
TH1*invertShift(TH1* var, TH1* nom)
TH1*invertShiftWithoutError(TH1* var, TH1* nom)
boolisAlphanumeric(const TAxis* ax)
boolisCloseToOneRel(double val, double rel)
boolisEmpty(const TH1* hist, double threshold, double mean = 0)
boolisGreaterThan(TH1* hist1, TH1* hist2)
boolisUnderflowOverflowBin(TH1* hist, int bin)
TLine*makeBisectorLine(TH1* hist, double angle = 45, double xUnit = -1, double yUnit = -1, double xOrig = 0, double yOrig = 0)
TMultiGraph*makeMultiColorGraph(const vector<double>& vecX, const vector<double>& vecY, const vector<short>& vecColors)
boolmultiplyHistogramWithoutError(TH1* histo1, const TH1* histo2)
TH1*normalize(TH1* histo, double normalizeTo = 1., bool includeUnderOverflow = true)
TH1*normalize(TH1* histo, const TH1* normalizeToHisto, bool includeUnderOverflow = true)
TH1*pcmpObsVsExp(TH1* hObs, TH1* hExp, bool ignoreExpUnc = false)
TH1*power(TH1* histo, double exp)
voidprint(THStack* s, TString options = "")
voidprintHistogramASCII(TH1* hist, const TString& tags = "")
voidprintHistogramASCII(TH1* hist, TQTaggable& tags)
voidprintHistogramASCII(ostream&, TH1* hist, const TString& tags)
voidprintHistogramASCII(ostream&, TH1* hist, TQTaggable& tags)
intpurgePeaks1D(TH1* hist, double threshold, int mode = 1)
doublepValuePoisson(unsigned int nObs, double nExp)
doublepValuePoissonError(unsigned int nObs, double E = 1, double V = 1)
doublepValueToSignificance(double p, bool excess = true)
TQHistogramUtils::FOMreadFOM(TString fom)
boolrebin(TH1*& hist, const vector<double>& boundaries, bool doRemap = false)
boolrebin(TH1*& hist, const vector<int>& boundaries, bool doRemap = false)
boolrebin(TH1*& hist, const vector<double>& boundariesX, const vector<double>& boundariesY, bool doRemap = false)
boolrebin(TH1*& hist, const vector<int>& boundariesX, const vector<int>& boundariesY, bool doRemap = false)
boolrebin(TH1* hist, int rebinX, int rebinY, int rebinZ, bool doRemap = false)
voidremap(TAxis* ax, double min = 0, double max = 1)
voidremapAndRelabel(TAxis* ax)
TH2*removeBins(TH2* in, const vector<TString>& blackList)
TH2*removeBins(TH2* in, TString blackList)
voidreorder(TH1* hist, const vector<int>& bins)
voidreorderBins(TH2* hist, const vector<TString>& ordering)
boolreplaceBins(TH1* histo1, TH1* histo2, vector<int> bins)
voidrerollGauss(TH1* hist, double zvalue = 1)
voidrerollPoisson(TH1* hist, int seed = 0)
boolresetBinErrors(TH1* histo)
TH1*rotationProfile(TH2* hist, double xUnit = -1, double yUnit = -1, int nStep = 36, double xOrig = 0, double yOrig = 0)
TH2*rotationXtranslationProfile(TH2* hist, double xUnit = -1, double yUnit = -1, int nStepAngle = 36, int nStepOffset = -1, double yOrig = 0, double x0 = std::numeric_limits<double>::quiet_NaN())
TH2*rotationYtranslationProfile(TH2* hist, double xUnit = -1, double yUnit = -1, int nStepAngle = 36, int nStepOffset = -1, double xOrig = 0, double y0 = std::numeric_limits<double>::quiet_NaN())
voidscaleErrors(TH1* hist, double scale)
boolscaleHistogram(TH1* histo1, TQCounter* scale, bool includeScaleUncertainty = false)
boolscaleHistogram(TH1* histo1, double scale = 1., double scaleUncertainty = 0., bool includeScaleUncertainty = true)
TGraph*scatterPlot(const TString& name, vector<double>& vec1, vector<double>& vec2, const TString& labelX = "x", const TString& labelY = "y")
TGraph*scatterPlot(const TString& name, double* vec1, double* vec2, int vLength, const TString& labelX = "x", const TString& labelY = "y")
boolsetHistogramContents(TH1* histo, const TString& contents)
voidsetRelativeUncertainties(TH1* hist, double relunc, bool addToInitialValue)
voidsetSliceX(TH2* hist2d, TH1* hist, double value)
voidsetSliceY(TH2* hist2d, TH1* hist, double value)
TH1*sumHistograms(TCollection* histos)
TH1*sumHistograms(const vector<TH1*>& histos)
TH1*sumHistogramsInQuadrature(const vector<TH1*>& histograms)
doublesumLineDistSquares(TH2* hist, double a, double b, bool useUnderflowOverflow = false)
TH1*sumOfSquares(const vector<TH1*>& histograms)
TH1*symmetrizeFromTwo(const TH1* var1, const TH1* var2, TH1* nom)
booltransferRelativeErrors(TH1* sourceHist, TH1* targetHist)
booltransferRelativeErrors(TQCounter* sourceHist, TQCounter* targetHist)
voidunifyMinMax(TCollection* histograms, double vetoFraction = 0.90000000000000002)
voidunifyMinMax(TH1* h1, TH1* h2, double vetoFraction = 0.90000000000000002)
voidunifyMinMax(TH1* h1, TH1* h2, TH1* h3, double vetoFraction = 0.90000000000000002)
TH1*unrollHistogram(const TH2* input, bool firstX = true, bool includeUnderflowOverflow = false, bool addLabels = false)

Data Members

Class Charts

Function documentation

bool isAlphanumeric(const TAxis* ax)
bool isEmpty(const TH1* hist, double threshold, double mean = 0)
 return true if the histogram is empty, false otherwise
TString getGraphDefinition(const TNamed* graph)
 Returns a string representing the definition of the histogram
 following a syntax compatible with
 TQHistogramUtils::createGraph(...). An empty string is returned
 in case an invalid histogram is passed.
TString getHistogramDefinition(const TH1* histo)
 Returns a string representing the definition of the histogram following a syntax
 compatible with TQHistogramUtils::createHistogram(...) and being similar to the
 constructor of the corresponding histogram class. An empty string is returned
 in case an invalid histogram is passed.
TString getHistogramContents(const TH1* histo)
 convert the histogram contents to a string
TH1* convertFromText(TString input)
 convert a string to a histogram
TString convertToText(const TH1* histo, int detailLevel)
 convert histogram to a string
bool setHistogramContents(TH1* histo, const TString& contents)
 set the histogram contents from a string
bool hasUniformBinning(const TH1* hist)
 return true if all axes of a histogram have uniform binning, false otherwise
bool hasUniformBinning(const TAxis* axis)
 return true if an axis has uniform binning, false otherwise
TString getBinningDefinition(const TAxis* axis)
 Returns a string representing a definition of the binning on axis <axis>. For
 uniformly binned axes the format is "<n>, <left>, <right>" where <n> refers to
 the number of bins, <left> to the lower edge of the first bin and <right> to
 the upper edge of the last bin. For non-uniformly binned axis the format is
 "{<e1>, ..., <en>, <eX>}" where <ei> refers to the lower bin edge of bin i and
 <eX> to the upper bin edge of the last bin. The format is compatible with
 TQHistogramUtils::createHistogram(...) An empty string is returned in case an
 invalid histogram is passed.
TH1* invertShift(TH1* var, TH1* nom)
 inv = 2*nom - var
TH1* invertShiftWithoutError(TH1* var, TH1* nom)
 inv = 2*nom - var
TH1* symmetrizeFromTwo(const TH1* var1, const TH1* var2, TH1* nom)
TH1 * createHistogram(const TString& definition, bool printErrMsg = false)
 Creates a new instance of a histogram (TH1F, TH1D, ...) from a definition string
TH1 * createHistogram(TQTaggable* values, const TString& prefix)
 Creates a new instance of a histogram (TH1F, TH1D, ...) from a definition string
TNamed * createGraph(const TString& definition, bool printErrMsg = false)
 Creates a new instance of a histogram (TH1F, TH1D, ...) from a definition string
int fillHoles2DAverage(TH2* hist, double threshold, bool allowUnderflowOverflow = false, int dx = 1, int dy = 1, int minSources = 1)
int fillHoles2DMax(TH2* hist, double threshold, bool allowUnderflowOverflow = false, int dx = 1, int dy = 1, int minSources = 1)
int countHoles(TH2* hist)
TH2* createHistogram(const TGraph2D* g, int nbinsx, int nbinsy)
 convert a TGraph2D into a TH2 with a given precision for rounding the bin centers
TH2* createHistogram(const TGraph2D* graph, int precision)
 convert a TGraph2D into a TH2 with a given precision for rounding the bin centers
std::vector<TList*> getContourList(TH2* hist, const vector<double>& thresholds)
 retrieve the list of contours corresponding to the given contour levels
TNamed * createGraph(TString definition, TString& errMsg)
 Creates a new instance of a graph (TGraph, TGraph2D, ...) from a definition string
 that uses a simple Class(name,title) syntax.
TH1 * createHistogram(TString definition, TString& errMsg)
 Creates a new instance of a histogram (TH1F, TH1D, ...) from a definition string
 that uses a similar syntax as the constructor of the corresponding histogram
 class. Currently, TH1F, TH1D, TH2F, TH2D, TH3F, and TH3D are supported.

 Examples:

 - a TH1F with 5 bins between 0. and 1.

 createHistogram("TH1F('histo', 'title', 5, 0, 1)")

 - similarly, but specifying the bin edges explicitly

 createHistogram("TH1F('histo', 'title', {0, 0.2, 0.4, 0.6, 0.8, 1})")

 - a TH2D with 10 times 10 bins between -5 ... 5 and -1 ... 1, respectively

 createHistogram("TH2F('histo', 'title', 10, -5., 5., 10, -1., 1.)")

 - a TH2D with 3 times 3 bins between -5 ... 5 and variable bins between
 -1 ... 1, respectively

 createHistogram("TH2F('histo', 'title', 3, -5., 5., {-1., -0.8, 0.1, 1.})")

std::vector<double> getUniformBinEdges(int nBins, double min, double max)
 Returns a pointer to a vector of doubles listing bin edges of <nBins> bins
 between <min> and <max>. The resulting vector will have <nBins> + 1 entries
 (the user is responsible for deleting the returned vector). A null pointer is
 returned in case <nBins> is smaller than one or <max> is not larger than <min>.
bool extractBinning(TQTaggable* p, int& index, int& nBins, double& min, double& max, vector<double>& edges, TString& errMsg)
 parameter name of number of bins (or array of bin edges)
bool extractRange(TQTaggable* p, int& index, double& min, double& max, TString& errMsg)
 parameter names of min and max in axis
TString getDetailsAsString(const TGraph* g, int option = 1)
 retrieve details of a TGraph as a string
TString getDetailsAsString(const TGraph2D* g, int option = 1)
 retrieve details of a TGraph2D as a string
TString getDetailsAsString(const TH1* histo, int option = 1)
 Returns a string summarizing properties of the histogram passed as argument
 <histo>. The optional parameter <option> allows to control the degree of detail
 of the resulting string (<option> is 1 by default):

 - <option> == 0 prints the number of bins on each axis
 - <option> == 1 additionally prints the sum of weights an the corresponding
 uncertainty (from root of sum of squares of weights)
 - <option> == 2 additionally prints the ranges and binning of axes
 - <option> == 3 additionally prints the units on axes
 - <option> == 4 additionally prints the plotting style
TString getDetailsAsString(const TAxis* axis, int option = 1)
 Returns a string summarizing properties of the axis passed as argument
 <axis>. The optional parameter <option> allows to control the degree of detail
 of the resulting string (<option> is 1 by default):

 - <option> == 1 prints the number of bins on axis
 - <option> == 2 additionally prints the ranges and binning of axis
 - <option> == 3 additionally prints the units on axis
int getNDips(TH1* histo)
 Counts and returns the number of dips (bins without entries surrounded by bins
 with non-zero entries) in input histogram <histo>. -1 is returned in case an
 invalid input histogram is provided. Please note: currently, only one and two
 dimensional histograms are supported.
bool getMaxArea2D(const TH2* histo, double frac, int& maxX, int& maxY, int& maxX_low, int& maxX_high, int& maxY_low, int& maxY_high)
 Scans the 2D input histogram <histo> for the maximum bin as well as the area
 around the maximum bin where the bin content exceeds <frac> times the maximum
 and returns true in case of success or false otherwise. The coordinates of the
 maximum bin are stored in <maxX> and <maxY> while the span of the maximum area
 is stored in <maxX_low>, <maxX_high>, <maxY_low>, and <maxY_high>.
 stop if input histogram is invalid or not a 2D histogram
std::vector<double> getBinLowEdges(const TH1* histo, const vector<int>& binBorders)
 create an array of low edges of a histogram
std::vector<double> getBinLowEdges(const TAxis* histo, const vector<int>& binBorders)
 create an array of low edges of an axis
std::vector<int> getBinBorders(const TAxis* histo, const vector<double>& lowEdges)
 create the array of bin borders
std::vector<int> getBinBorders(const TH1* histo, const vector<double>& lowEdges)
 create the array of bin borders
TH1 * getRebinned(const TH1 * histo, const std::vector<int>& binBorders, bool doRemap, bool keepOverFlowUnderFlowSeparate)
TH1 * getRebinned(const TH1 * histo, const std::vector<double>& lowEdges, bool doRemap, bool keepOverFlowUnderFlowSeparate)
TH1 * getRebinned(const TH1 * histo, const std::vector<int>& binBorders, const std::vector<double>& lowEdges, bool doRemap, bool keepOverFlowUnderFlowSeparate)
TH1 * getRemapped(TH1* histo, const vector<double>& newBinBorders)
 return a remapped version of a histogram with the given bin borders
TH2 * getRemapped2D(TH2* histo, const vector<int>& binBorders, bool remapX = true)
 return a remapped version of a 2D histogram with the given bin borders
TH1 * getRebinnedFlat(TH1* histo, int nBins)
 obtain a version of a 1D histogram remapped to a flat distribution
TH1 * getRemappedFlat(TH1* histo, int nBins)
 obtain a version of a 1D histogram rebinned to a flat distribution
TH2 * getRemappedFlat2D(TH2* histo, int nBins, bool remapX = true)
 obtain a version of a 2D histogram remapped to a flat distribution
TH1 * cutAndZoomHistogram(TH1* histo, int cutBinLowX, int cutBinHighX, int cutBinLowY = -1, int cutBinHighY = -1, int zoomBinLowX = -1, int zoomBinHighX = -1, int zoomBinLowY = -1, int zoomBinHighY = -1)
 cut and zoom a histogram to the given bin boundaries in X, Y and Z
TH1 * cutHistogram(TH1* histo, int xBinLow, int xBinHigh, int yBinLow = -1, int yBinHigh = -1, bool keepInUVX = false, bool keepInOVX = false, bool keepInUVY = false, bool keepInOVY = false)
 cut a histogram to the given bin boundaries in X, Y and Z
 giving a bin boundary of -1 implies no cut.
 only support 1- and 2-dimensional histograms
TH2 * removeBins(TH2* in, TString blackList)
 copies a (labled) TH2 skipping all bins (X and Y) whose labels match blackList.
TH2 * removeBins(TH2* in, TString blackList)
 copies a (labled) TH2 skipping all bins (X and Y) whose labels match any of the patterns
 in blackList.
std::vector<int> getBinBordersFlat2D(TH2* histo, int nBins, bool remapX, bool includeOverflows, bool remapSlices = true)
 obtain a new set of boundaries that remap a given histogram to a flat distribution
std::vector<int> getBinBordersFlat(TH1* histo, int nBins, bool includeOverflows)
 obtain a new set of boundaries that remap a given histogram to a flat distribution
std::vector<int> getOptimizedBinBorders(TH1* hsig, TH1* hbkg, double minSignal = 10, double minBkg = 10, double maxBkgUnc = 0.20000000000000001, bool significanceAgnostic = false, double maxSignal = 30, double estimatedMaxSignInBin = 6, bool verbose = false, double maxSigUnc = 0.5, double minBinWidth = -1, bool mergeBins = true)
 obtain a new set of boundaries that optimize the significance between hsig and hbkg following the conditions provided
 Parameters:
 minSignal:  minimum signal in bin to set bin border
 maxSignal: signal threshold to set early bin border (no effect with significanceAgnostic = true)
 minBkg: minimum bkg in bin to set bin border
 maxBkgUnc: maximum relative uncertainty on bkg to set bin border
 significanceAgnostic: If true, the bin boundaries are entirely specified with minSignal, minBkg, maxBkgUnc and the optional estimatedMaxSignInBin
 estimatedMaxSignInBin: optional ballpark estimate for significance of most signal sensitive bin to judge range of unsignificant part of distribution
 mergeBins: merge the first two bins
TH1 * convertTo1D(const TH2* histo, bool alongX = true, bool includeUnderflowsX = true, bool includeOverflowsX = true, bool includeUnderflowsY = true, bool includeOverflowsY = true)
 convert a 2D histogram to a 1D histogram by unrolling it
void reorderBins(TH2* hist, const vector<TString>& ordering)
TH1 * getProjection(TH1* histo, bool onX, int binLow = -1, int binHigh = -1)
 Creates a one-dimensional projection from a two-dimensional histogram onto any
 of its axes and returns a pointer to the projected histogram or a NULL pointer
 in case of failure. The histogram <histo> is projected onto its X axis if
 <onX> == true and onto its Y axis if <onX> == false. Optionally, the projection
 range on the axis that is projected out can be chosen via <binLow> and <binHigh>
 which refer to the first and the last bin to be considered, respectively. The
 projection range reaches to the minimum (including underflow bin) and/or the
 maximum (including the overflow bin) if <binLow> and/or <binHigh> are less than
 zero (both are -1 by default). The projection histogram adopts both style options
 as well as the association to a TDirectory from the source histogram (ensuring
 unique names in case of an association to a TDirectory).
TH1 * getProjectionX(TH1* histo, int binLow = -1, int binHigh = -1)
 Creates a one-dimensional projection from a two-dimensional histogram onto its
 X axis and returns a pointer to the projected histogram or a NULL pointer
 in case of failure. Please refer to the documentation of
 TQHistogramUtils::getProjection(...) for additional information.

 [Please note: this is wrapper to TQHistogramUtils::getProjection(..., true, ...)]
TH1 * getProjectionY(TH1* histo, int binLow = -1, int binHigh = -1)
 Creates a one-dimensional projection from a two-dimensional histogram onto its
 Y axis and returns a pointer to the projected histogram or a NULL pointer
 in case of failure. Please refer to the documentation of
 TQHistogramUtils::getProjection(...) for additional information.

 [Please note: this is wrapper to TQHistogramUtils::getProjection(..., false, ...)]
bool applyPoissonErrors(TH1* histo)
 Sets the bin errors for each bin of histogram histo to square-root of bin
 contents and returns false in case of an invalid histogram or if there are
 bins with negative entries or true otherwise. For bins with negative bin
 content the bin error is set to zero.
void copyGraphAxisTitles(TNamed* copy, const TNamed* graph)
 copy axis titles from one graph to the other
TNamed * copyGraph(const TNamed* histo, const TString& newName = "")
 a variant of copyHistogram that works on TGraphs instead
TH1 * copyHistogram(const TH1* histo, const TString& newName = "")
 Creates an independent copy of the input histogram <histo> and returns a pointer
 to the copy or a NULL pointer in case of failure. Please note: currently, only
 instances of TH1F, TH1D, TH2F, TH2D, TH3F, and TH3D are supported. Optionally,
 a new name for the copy can be specified via <newName>. Otherwise, the copied
 histogram will adopt the name of the input histogram. In any case it will adopt
 its potential association to an instance of TDirectory (ensuring a unique name).
bool copyBinLabels(const TH1* source, TH1* target)
 copy bin labels from axes of one histogram to the corresponding axes of the
 other returns false if no valid arguments are given or source and target
 histograms/axes are incompatible (different dimensionality / different number
 of bins)
bool hasBinLabels(const TH1* h)
 return true if this histogram has bin labels on any axis
bool hasBinLabels(const TAxis* a)
 return true if this axis has bin labels
bool copyBinLabels(const TAxis* source, TAxis* target)
 copy bin labels from one axis to another. Returns false if arguments are invalid or axes are incompatible
bool copyAxisStyle(const TH1* source, TH1* target)
 copy axis style settings from axes of one histogram to the corresponding axes of the
 other returns false if no valid arguments are given or source and target
 histograms/axes are incompatible (different dimensionality / different number
 of bins)
bool copyAxisStyle(const TAxis* source, TAxis* target)
add style settings to copy as needed
bool includeSystematics(TH1* histo, TH1* systematics)
TH1 * getSystematics(TH1* h_nominal, TList* singleVars, TList* pairVars = 0)
bool addHistogram(TH1* histo1, const TH1* histo2, TQCounter* scale, double corr12 = 0., bool includeScaleUncertainty = false)
 add two histograms, just like TH1::Add does
 this function will handle scale uncertainties and possible correlations
 between the two histograms properly on a bin-by-bin basis
bool addHistogramInQuadrature(TH1* histo1, const TH1* histo2, double factor = 1)
 add two histograms in quadrature
 bin = sqrt ( bin^2(histo1) + factor * bin^2(histo2) )
 replaces contents of histo1
bool addHistogramAsError(TH1* hist, const TH1* errorhist, bool isRelative = false)
 add a histogram in quadrature to the error of the other histogram
 binerror = sqrt ( binerror^2(hist) + bin^2(errorhist) )
 replaces contents of hist
bool addHistogramInQuadrature(TH1* histo1, double val, double factor = 1)
 add a value to a histogram in quadrature
 bin = sqrt ( bin^2(histo1) + factor * value^2) )
 replaces contents of histo1
TH1* sumOfSquares(const vector<TH1*>& histograms)
 creates a new histogram with contents equal to the sum of squared bin contents
 of the input histograms (a*a + b*b + ...).
 returns nullptr if list of input histograms is empty.
 Note: for sum in quadrature (i.e. sqrt(a*a + b*b + ...)) use
 TQHistogramUtils::sumHistogramsInQuadrature !
TH1* sumHistogramsInQuadrature(const vector<TH1*>& histograms)
 creates a new histogram with contents equal to the bin-by-bin quadrature sum
 (sqrt(a*a+b*b+...)) of the input histograms.
 Note: for sum of squared bin contents (i.e. a*a + b*b + ..., without sqrt() ) use
 TQHistogramUtils::sumOfSquares !
bool addHistogramWithoutError(TH1* histo1, const TH1* histo2, double scale = 1.)
 add two histograms, just like TH1::Add does, neglecting errors on the second one
bool divideHistogramWithoutError(TH1* histo1, const TH1* histo2)
bool multiplyHistogramWithoutError(TH1* histo1, const TH1* histo2)
bool addHistogram(TH1* histo1, const TH1* histo2, double scale = 1., double scaleUncertainty = 0., double corr12 = 0., bool includeScaleUncertainty = true)
 add two histograms, just like TH1::Add does
 this function will handle scale uncertainties and possible correlations
 between the two histograms properly on a bin-by-bin basis
bool replaceBins(TH1* histo1, TH1* histo2, vector<int> bins)
 replace the bin contents and errors of histo1 by the ones from histo2 in the given bins
bool scaleHistogram(TH1* histo1, TQCounter* scale, bool includeScaleUncertainty = false)
 scales a histogram, just like TH1::Scale does
 this function will handle scale uncertainties if requested
bool scaleHistogram(TH1* histo1, double scale = 1., double scaleUncertainty = 0., bool includeScaleUncertainty = true)
 scales a histogram, just like TH1::Scale does
 this function will handle scale uncertainties if requested
bool drawHistograms(TList* histograms, TString drawOption = "", TString extOptions = "")
 draw a list of histograms
bool resetBinErrors(TH1* histo)
 reset all the bin errors on a histogram
int getDimension(const TH1* histo)
 Returns the dimensionality of the histogram <histo> (e.g. 1 for TH1F, 2 for
 TH2D, ...). Returns 0 if the input histogram is invalid.
const TAxis* getAxis(const TNamed* obj, int idx)
 get the X (idx=0), Y (idx=1) or Z (idx=3) axis of a TH1 or TGraph or TGraph2D object
TAxis* getAxis_nonconst(TNamed* obj, int idx)
int getNBins(const TH1* histo, bool includeUnderflowOverflow = true)
 Returns the total number of bins of the input histogram <histo> including over-
 and underflow bins as well as all dimensions of the histogram or 0 in case of
 failure. That is, for a 10x10 bins 2D histogram 144 = (10+2)*(10+2) is returned.
int getSizePerBin(const TH1* histo)
 return the size of bits per bin
int estimateSize(const TH1* histo)
 estimate the memory size of a histogram
bool checkConsistency(const TH1* histo1, const TH1* histo2, bool verbose = false)
 Check if two histograms have consistent binning
TGraphAsymmErrors * getGraph(const TH1* histo)
 convert a histogram into a TGraph
TGraphAsymmErrors * getGraph(const TH1* nom, TObjArray* sys)
 convert a histogram into a TGraph
std::vector<TString> histoBinsToCutStrings(TH1* hist, const TString& varexpr, TString cutname = "", const TString& basecutname = "")
 creates a std::vector of TString that represent cut definitions according to the histogram bins
 the cutname should contain a %d placeholder which will be replaced by the cut (bin) index
 if the cutname does not contain such a placeholder, "_%d" will be appended
 if no cutname is given, the histogram name will be used
 if a non-empty basecutname is given, it will be included in the cut definition strings
 underflow and overflow bins will automatically be included as first and last vector element
double getPoisson(double b, double s)
 Returns the Poisson significance according to <b> expected background events
 and <s> expected signal events. Returns 0 if any term becomes invalid

 Poisson significance = TMath::Sqrt(2. * ((s + b) * TMath::Log(1. + s / b) - s))
double getPoissonError(double b, double s, double db, double ds)
 Returns the error on the Poisson significance according to <b> expected background events
 and <s> expected signal events. Returns 0 if any term becomes invalid

 Poisson significance = TMath::Sqrt(2. * ((s + b) * TMath::Log(1. + s / b) - s))
 The error is propagated from errors in b and s according to the most general formula
 for independent error propagation.
double getPoissonWithError(double b, double db, double s)
 Returns the significance corresponding to a Poisson-Poisson model with asymptotic formula.
 Returns 0 if any term becomes invalid

 Poisson-Poisson asymptotic significance = TMath::Sqrt(2. *(
         (s+b) * TMath::Log((s+b)*(b+db*db)/(b*b+(s+b)*db*db) ) -
   b*b/(db*db) * TMath::Log(1. +  (db*db*s)/(     b*(b+db*db)))    ) )
 See slide 9 https://indico.cern.ch/event/768968/contributions/3195413/attachments/1743878/2822499/statsCommitteeAtlasWeeklyOct2018.pdf
double getPoissonWithErrorError(double b, double s, double db, double ds)
 Returns the error on the Poisson significance according to <b> expected background events
 and <s> expected signal events. Returns 0 if any term becomes invalid

 Poisson significance = TMath::Sqrt(2. *(
         (s+b) * TMath::Log((s+b)*(b+db*db)/(b*b+(s+b)*db*db) ) -
   b*b/(db*db) * TMath::Log(1. +  (db*db*s)/(     b*(b+db*db)))    ) )
 The error is propagated from errors in b and s according to the most general formula
 for independent error propagation.
double getSoverSqrtB(double b, double s)
 Returns <s> over square-root of <b> or zero in case <s> is negative or <b> is
 not larger than zero.
double getSoverSqrtSplusB(double b, double s)
 Returns <s> over square-root of <b> or zero in case <s> is negative or <b> is
 not larger than zero.
double getSoverB(double b, double s)
 Returns <s> over <b> or zero in case <s> is negative or <b> is not larger than
 zero.
double getSignificance(double b, double s, TString sgnfName, double berr, TString* sgnfTitle = 0)
 calculate the significance given a certain string identifier
 supported versions are:
 poission, soversqrtb, soversqrtsplusb, soverb
bool areEqual(TH1* first, TH1* second, bool includeUnderflowOverflow = true, bool compareErrors = false, double tolerance = 0.01)
 return true if two histograms are completely equal
 false otherwise
void getSgnfAndErr(double b, double bErr, double s, double sErr, double& sgnf, double& sgnfErr, TString sgnfName, TString* sgnfTitle = 0)
 calculate the significance given a certain string identifier
 supported versions are:
 poission, soversqrtb, soversqrtsplusb, soverb
TH1 * getCutEfficiencyHisto(TH1* histo, TString options = "")
 Calculate the efficiency of a cut on the distribution given by the histogram
 histo.
TH1 * getSignificanceHisto(TH1* histo_bkg, TH1* histo_sig, TString options = "")
stop if the input histograms are invalid/inconsitent
double getSummedBinByBinSignificance(TH1* histo_bkg, TH1* histo_sig, TString options = "sgnf:poisson")
 add significances in bins quadratically
TGraphAsymmErrors * getROCGraph(TH1* h_bkg, TH1* h_sig, bool lowerBound)
TList * getProjectionHistograms(TH2* histo, bool projectOnX, bool normalize = false)
TList * getProjectionHistogramsX(TH2* histo, bool normalize = false)
TList * getProjectionHistogramsY(TH2* histo, bool normalize = false)
TH1 * getReweightedHistogram(TH2* histo_input, TH1* histo_weights, bool projectOnX)
TH1 * getReweightedHistogramX(TH2* histo_input, TH1* histo_weights)
TH1 * getReweightedHistogramY(TH2* histo_input, TH1* histo_weights)
TQCounter * histogramToCounter(TH1* histo)
 convert a histogram to a TQCounter
TH1 * counterToHistogram(TQCounter* counter)
 convert a TQCounter to a histogram
TH1 * countersToHistogram(TList* counters)
 convert a list of TQCounters to a histogram
double getIntegral(const TH1* histo, bool userUnderOverflow = true)
 Return the integral of a histogram
TH1* getEfficiencyHistogram(TH1* numerator, TH1* denominator)
 computes the ratio of the two given histograms. Errors are recalculated assuming
 that events in the numerator histogram are also present in the denominator,
 i.e., that the selection of events/entries in the numerator represents a true
 subset of those in the denominator. If the calculation of the resulting uncertainty
 fails at some point NULL is returned.
TH1* getRelativeVariationHistogram(TH1* variation, TH1* nominal, double epsilon = 0.)
 computes the (bin-by-bin) ratio of <variation>/<nominal>. Statistical
 uncertainties are calculated/propagated using only the uncertainty of the
 variation. If the bin content of the nominal or variation histogram is zero
 for some bin the uncertainty of the corresponding ratio bin is set to infinity.
 If at least one of the input histograms is invalid or the histograms
 are incompatible, according to TQHistogramUtils::checkConsistency, NULL is
 returned.
double getIntegralError(const TH1* histo)
 Return the error of the integral of a histogram including under- and over-
 flow bins
double getIntegralAndError(const TH1* histo, double& error, bool useUnderflowOverflow = true)
 Return the integral and its error of a histogram including under- and over-
 flow bins
TH1 * normalize(TH1* histo, double normalizeTo = 1., bool includeUnderOverflow = true)
 Normalize this histogram to a given integral value
TH1 * normalize(TH1* histo, const TH1* normalizeToHisto, bool includeUnderOverflow = true)
 Normalize this histogram to the integral value of another histogram
TH1 * power(TH1* histo, double exp)
 exponentiate every entry in a histogram by a given power
TH1 * getSlopeHistogram(TH1* input, double slope)
 set the contents of a histogram to reflect a certain slope
TH1 * applySlopeToHistogram(TH1* input, double slope)
 apply a slope to a given histogram
double getChi2(TH1* histo1, TH1* histo2)
 calculate the Chi2 difference between two histograms
TH1 * includeOverflowBins(TH1* histo, bool underflow = true, bool overflow = true)
 include overflow and/or underflow bins in a histogram
TH1 * extraOverflowBins(TH1*& histo, bool underflow = true, bool overflow = true, bool remap = false)
 add overflow and/or underflow bins as extra bins to a histogram
void unifyMinMax(TCollection* histograms, double vetoFraction = 0.90000000000000002)
 unify the minima and maxima of a list of histograms
void unifyMinMax(TH1* h1, TH1* h2, TH1* h3, double vetoFraction = 0.90000000000000002)
 unify the minima and maxima of three histograms
void unifyMinMax(TH1* h1, TH1* h2, double vetoFraction = 0.90000000000000002)
 unify the minima and maxima of two histograms
bool getMinMaxBin(const TH1* histo, int& minBin, int& maxBin, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity(), double maxMax = std::numeric_limits<double>::infinity())
 find the minimum and maximum bins of a histogram
bool getMinMax(const TH1* histo, double& min, double& max, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity(), double maxMax = std::numeric_limits<double>::infinity())
 find the minimum and maximum coordinates of a histogram
int getMinBin(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity())
 find the minimum bin of a histogram
int getMaxBin(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double maxMax = std::numeric_limits<double>::infinity())
 find the maximum bin of a histogram
double getMin(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity())
 find the minimum coordinate of a histogram
double getMax(const TH1* histo, bool includeError = false, bool includeUnderflowOverflow = true, double maxMax = std::numeric_limits<double>::infinity())
 find the maximum coordinate of a histogram
bool extractStyle(const TH1* histo, TQTaggable* tags, const TString& styleScheme = "")
 extract the style from a histogram and save it to a TQTaggable object
bool extractStyle(const TGraph* graph, TQTaggable* tags, const TString& styleScheme = "")
 extract the style from a histogram and save it to a TQTaggable object
int applyStyle(TH1* histo, TQTaggable* tags, const TString& styleScheme = "", bool allowRecursion = true)
 apply the style given by a TQTaggable object to a histogram
bool copyStyle(TH1* dest, const TH1* src)
 Copies the style settings (fill color, fill style, line color, line style, line
 width, marker size, marker color, marker style) from the source histogram
 <h_src> to the destionation histogram <h_dest> and returns true in case of
 success or false in case of failure.
bool copyStyle(TGraph* dest, const TH1* src)
 Copies the style settings (fill color, fill style, line color, line style, line
 width, marker size, marker color, marker style) from the source histogram
 <h_src> to the destionation graph <h_dest> and returns true in case of
 success or false in case of failure.
bool copyStyle(TNamed* dest, const TNamed* src)
 copies the style of histograms or graphs
bool copyStyle(TGraph* dest, const TGraph* src)
 Copies the style settings (fill color, fill style, line color, line style, line
 width, marker size, marker color, marker style) from the source graph
 <g_src> to the destionation graph <g_dest> and returns true in case of
 success or false in case of failure.
bool copyStyle(TGraph2D* dest, const TGraph2D* src)
 Copies the style settings (fill color, fill style, line color, line style, line
 width, marker size, marker color, marker style) from the source graph
 <g_src> to the destionation graph <g_dest> and returns true in case of
 success or false in case of failure.
bool isCloseToOneRel(double val, double rel)
 Returns true if the input value <val> is compatible with one with a relative
 deviation smaller than <rel> and false otherwise. The return value is invariant
 under the transformation <val> --> 1/<val>.
bool areEqualRel(double val1, double val2, double rel)
 Returns true if the two input values <val1> and <val2> are compatible with a
 relative deviation smaller than <rel> and false otherwise. If either of the
 input values is zero or one is positive while the other is negative false is
 returned. The return value is invariant under exchange of <val1> and <val2>.
bool haveEqualShapeRel(TH1* h1, TH1* h2, double rel)
 check if two histograms have a relatively equal shape by calling areEqualRel on every bin
bool ensureMinimumContent(double& content, double& uncertainty, double min = 9.9999999999999998E-13, bool ignoreNegative = false, bool flipToPositive = false, bool assignUncertainty = false)
 Takes a value content and ensure that it is greater or equal to min.
 Returns true if the content or uncertainty have changed, false
 otherwise. The variables content and uncertainty are call-by-reference.
 All additional options only play a role if content is negative:
 If (assignUncertainty) and (content < 0), then it is ensured that the
 new uncertainty is greater or equal to -content.
 If (ignoreNegative) and (content < 0), content is not changed.
 If (not ignoreNegative) and (flipToPositive) and (content < 0), then the
 absolute value of content is taken.
int ensureMinimumBinError(TH1* histo, double averageWeight)
int ensureMinimumBinContent(TH1* histo, double min = 9.9999999999999998E-13, bool ignoreNegative = false, bool flipToPositive = false, bool assignUncertainty = false)
 Ensure that a histogram has a certain minimum content in every bin
 For the other options, see ensureMinimumContent(...)
bool ensureAbsMinimumContent(double& content, double min = 9.9999999999999998E-13)
 Build upon ensureMinimumContent. When this is called the Absolute content is compared with the MinBinContent.
 If the AbsContent is lower than the MinBincontent and the Content was negative. The new content is -MinBinContent
 If the AbsContent is lower than the MinBincontent and the Content was positive. The new content is +MinBinContent
 Bins equal to zero are regarded as positive.
int ensureAbsMinimumBinContent(TH1* histo, double min = 9.9999999999999998E-13)
 Ensure that a histogram has a certain minimum content in every bin
 For the other options, see ensureMinimumContent(...)
double pValuePoisson(unsigned int nObs, double nExp)
    Consider Poi(k|nExp) and compute the p-value which corresponds to
    the observation of nObs counts.

    When nObs > nExp there is an excess of observed events and

    p-value = P(n>=nObs|nExp) = \sum_{n=nObs}^{\infty} Poi(n|nExp)
    = 1 - \sum_{n=0}^{nObs-1} Poi(n|nExp)
    = 1 - e^{-nExp} \sum_{n=0}^{nObs-1} nExp^n / n!

    Otherwise (nObs <= nExp) there is a deficit and

    p-value = P(n<=nObs|nExp) = \sum_{n=0}^{nObs} Poi(n|nExp)
    = e^{-nExp} \sum_{n=0}^{nObs} nExp^n / n!

double pValuePoissonError(unsigned int nObs, double E = 1, double V = 1)
    Consider Poi(k|nExp) and compute the p-value which corresponds to
    the observation of nObs counts, in the case of uncertain nExp whose
    variance is provided.

    The prior for nExp is a Gamma density which matches the expectation
    and variance provided as input. The marginal model is provided by
    the Poisson-Gamma mixture, which is used to compute the p-value.

    Gamma density: the parameters are
    * a = shape param [dimensionless]
    * b = rate param [dimension: inverse of x]

    nExp ~ Ga(x|a,b) = [b^a/Gamma(a)] x^{a-1} exp(-bx)

    One has E[x] = a/b and V[x] = a/b^2 hence
    * b = E/V
    * a = E*b

    The integral of Poi(n|x) Ga(x|a,b) over x gives the (marginal)
    probability of observing n counts as

    b^a [Gamma(n+a) / Gamma(a)]
    P(n|a,b) = -----------------------------
    n! (1+b)^{n+a}

    When nObs > nExp there is an excess of observed events and

    p-value = P(n>=nObs) = \sum_{n=nObs}^{\infty} P(n)
    = 1 - \sum_{n=0}^{nObs-1} P(n)

    Otherwise (nObs <= nExp) there is a deficit and

    p-value = P(n<=nObs) = \sum_{n=0}^{nObs} P(n)

    To compute the sum, we use the following recurrent relation:

    P(n=0) = [b/(1+b)]^a
    P(n=1) = [b/(1+b)]^a a/(1+b) = P(n=0) a/(1+b)
    P(n=2) = [b/(1+b)]^a a/(1+b) (a+1)/[2(1+b)] = P(n=1) (a+1)/[2(1+b)]
    ... ...
    P(n=k) = P(n=k-1) (a+k-1) / [k(1+b)]

    and to avoid rounding errors, we work with logarithms.

  if (nObs<0) {
    std::cerr << "ERROR in pValuePoissonError(): the number of observed events cannot be negative" << std::endl;
    return 0;
  }
double pValueToSignificance(double p, bool excess = true)
    Convert a p-value into a right-tail normal significance, i.e. into
    the number of Gaussian standard deviations which correspond to it.

TH1* pcmpObsVsExp(TH1* hObs, TH1* hExp, bool ignoreExpUnc = false)
TH1* getUncertaintyHistogram(TH1* hist)
 fills a new histogram with uncertainties of the argument.
void setRelativeUncertainties(TH1* hist, double relunc, bool addToInitialValue)
 set the uncertainties of a histogram to the relative unceratinty value given
TGraph* scatterPlot(const TString& name, double* vec1, double* vec2, int vLength, const TString& labelX = "x", const TString& labelY = "y")
 obtain a TGraph scatter plot from two lists of numbers
TGraph* scatterPlot(const TString& name, vector<double>& vec1, vector<double>& vec2, const TString& labelX = "x", const TString& labelY = "y")
 obtain a TGraph scatter plot from two lists of numbers
TMultiGraph* makeMultiColorGraph(const vector<double>& vecX, const vector<double>& vecY, const vector<short>& vecColors)
 creates multiple TGraphs combined into a TMultiGraph. vecColors idicates the
 color of each point (according to the usual ROOT colors) and is hence required
 to have the same number of elements as the coordinates of the points (vecX, vecY).
 For each color present in vecColors one TGraph is created and added to the
 TMultiGraph.
void setSliceX(TH2* hist2d, TH1* hist, double value)
 set an X-slice of a TH2*-type histogram to the content of a TH1*-type histogram
 the dimension of the TH1* will become the Y-direction of the TH2*
void setSliceY(TH2* hist2d, TH1* hist, double value)
 set an Y-slice of a TH2*-type histogram to the content of a TH1*-type histogram
 the dimension of the TH1* will become the X-direction of the TH2*
int purgePeaks1D(TH1* hist, double threshold, int mode = 1)
void getFilteredRange(TCollection* histograms, double xmin, double xmax, double minContent, double maxContent, double& lower, double& upper, double logMin)
Find the largest error of a plot
void getUnFilteredRange(TCollection* histograms, double xmin, double xmax, double minContent, double maxContent, double& lower, double& upper)
Fit even points with insane errors on a plot
double getMinimumBinValue(TH1* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
 find the minimum bin value of the given histogram
 in the given x-range ignoring bins smaller or
 equal to minContent and larger or equal to maxContent
double getMinimumBinValue(TCollection* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
 find the minimum bin value of a list of histograms
double getMaximumBinValue(TH1* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
 find the maximum bin value of the given histogram
 in the given x-range ignoring bins smaller or
 equal to minContent and larger or equal to maxContent
double getMaximumBinValue(TCollection* hist, double xmin, double xmax, bool includeErrors = false, double minContent = -std::numeric_limits<double>::infinity(), double maxContent = std::numeric_limits<double>::infinity())
 find the maximum bin value of a list of histograms
double getHistogramMaximum(size_t n, ...)
 find the total maximum of a set of histograms
 the first argument is the number of histograms to consider
 an arbitrary number of subsequent histogram pointers can be passed
double getHistogramMinimum(size_t n, ...)
 find the total minimum of a set of histograms
 the first argument is the number of histograms to consider
 an arbitrary number of subsequent histogram pointers can be passed
double getHistogramXmax(size_t n, ...)
 find x axis maximum of a set of histograms
 the first argument is the number of histograms to consider
 an arbitrary number of subsequent histogram pointers can be passed
double getHistogramXmin(size_t n, ...)
 find the x axis minimum of a set of histograms
 the first argument is the number of histograms to consider
 an arbitrary number of subsequent histogram pointers can be passed
double getHistogramYmax(size_t n, ...)
 find the y axis maximum of a set of histograms
 the first argument is the number of histograms to consider
 an arbitrary number of subsequent histogram pointers can be passed
double getHistogramYmin(size_t n, ...)
 find the y axis minimum of a set of histograms
 the first argument is the number of histograms to consider
 an arbitrary number of subsequent histogram pointers can be passed
double getAxisYmin(const TH1* hist)
 retrieve lower edge value of y-axis from histogram
double getAxisYmax(const TH1* hist)
 retrieve upper edge value of y-axis from histogram
double getAxisXmin(const TH1* hist)
 retrieve lower edge value of x-axis from histogram
double getAxisXmax(const TH1* hist)
 retrieve upper edge value of x-axis from histogram
double getAxisXmin(const TGraph* graph)
 retrieve lower edge value of x-axis from histogram
double getAxisXmax(const TGraph* graph)
 retrieve upper edge value of x-axis from histogram
double getHistogramBinContentFromFile(const TString& fname, const TString& hname, const TString binlabel)
 retrieve the contents of the bin labeled binlabel
 from a histogram named hname which resides in a TFile fname
 will return NaN and print an error message if no such file, histogram or bin exists
double getHistogramBinContentFromFile(const TString& fname, const TString& hname, int )
 retrieve the contents of the given bin
 from a histogram named hname which resides in a TFile fname
 will return NaN and print an error message if no such file, histogram or bin exists
std::vector<int> getBinsSortedByRatio(TH1* sig, TH1* bkg, double epsilon = 9.9999999999999998E-13)
 read in a signal and background histogram and give back a vector of bins starting with the lowest value of sig/bkg and ending with highest
 only supports 1dim histograms at the moment
int edge(TH1* hist, double cutoff = std::numeric_limits<double>::epsilon())
 edges a one-dimensional histogram
 adjusts the axis to hide marginal bins with a bin content below the cutoff
int edge(TH2* hist, double cutoff = std::numeric_limits<double>::epsilon())
 edges a two-dimensional histogram
 adjusts the axis to hide marginal bins with a bin content below the cutoff
bool rebin(TH1*& hist, const std::vector<int>& boundaries, bool doRemap)
 rebin and/or remap a histogram to given set of bin boundaries
bool rebin(TH1*& hist, const std::vector<int>& boundariesX, const std::vector<int>& boundariesY, bool doRemap)
 rebin and/or remap a histogram to given set of bin boundaries
TH1* getRebinned(const TH1* hist, const std::vector<int>& boundariesX, const std::vector<int>& boundariesY, bool doRemap, bool keepOverFlowUnderFlowSeparate)
 rebin and/or remap a histogram to given set of bin boundaries
void reorder(TH1* hist, const vector<int>& bins)
 read in a histogram and vector with the places of the bins and reorder the bins accordingly
bool rebin(TH1*& hist, const std::vector<double>& boundaries, bool doRemap)
 rebin and/or remap a histogram to given set of bin boundaries
bool rebin(TH1*& hist, const std::vector<double>& boundariesX, const std::vector<double>& boundariesY, bool doRemap)
 rebin and/or remap a histogram to given set of bin boundaries
TH1* getRebinned(const TH1* oldhist, const std::vector<double>& boundariesX, const std::vector<double>& boundariesY, bool doRemap, bool /* keepOverFlowUnderFlowSeparate */)
TH1 * getSmoothedManually(const TH1 * histo, const std::vector<double>& lowEdges, bool keepOverFlowUnderFlowSeparate)
TH1 * getSmoothedManually(const TH1 * histo, const std::vector<int>& binBorders, bool keepOverFlowUnderFlowSeparate)
TH1 * getSmoothedVariation(const TH1* h_nom, TH1* h_var, const vector<int>& binBorders, bool keepOverFlowUnderFlowSeparate = true)
 Returns histogram that is varied from nominal with the possibility to smooth the
  variation by deriving the relative variations in merged histogram bins as
  specified by binBorders.

bool rebin(TH1* hist, int rebinX, int rebinY, int rebinZ, bool doRemap = false)
 rebin and/or remap a histogram to given number of bins in X, Y and Z direction
void remap(TAxis* ax, double min = 0, double max = 1)
 remap the axis of a histogram to a given range (without actually changing the binning)
void remapAndRelabel(TAxis* ax)
 remap the axis of a histogram to a given range (without actually changing the binning)
void print(THStack* s, TString options = "")
 print the contents of a histogram stack to the console
double getMax(const TCollection* c, bool includeUnderflowOverflow = true, double maxMax = std::numeric_limits<double>::infinity())
 get the absolute maximum of a collection of histograms
double getMin(const TCollection* c, bool includeUnderflowOverflow = true, double minMin = -std::numeric_limits<double>::infinity())
 get the absolute minimum of a collection of histograms
double evaluateGraph(const TGraph* g, double x, int mode = 0)
 interpolate a graph to a specific point
 mode encodes the interpolation method:
   0: linear
   1: exponential (linear for logscale)
double findIntersection(const TGraph* a, const TGraph* b, int mode = 0, double left = -std::numeric_limits<double>::quiet_NaN(), double right = std::numeric_limits<double>::quiet_NaN(), double epsilon = std::numeric_limits<double>::epsilon())
 find the point where two graphs intersect
double getContourArea(const TGraph* g)
 calculate area of the graph contour (polygon) in the x/y plane
 will only yield an accurate result if the graph is a regular polygon
 without any intersecting lines
double getContourJump(const TGraph* g)
 calculate distance between first and last point of graph
 in the x/y plane
void interpolateGraph(TGraph* g, size_t increasePoints, const char* option = "S")
 interpolate a graph, increasing the number of points by the given factor
double getMinBinWidth(TAxis* a)
 calculate width of smallest bin in axis coordinates
double getMinBinArea(TH2* hist)
 calculate area of smallest bin in axis coordinates
int addPCA(TPrincipal* orig, TPrincipal* add)
 add two objects of type TPrincipal
 will add the contents of the second argument to the first one
 the second one will stay unchanged
bool addGraph(TGraph* graph1, const TGraph* graph2)
 add two objects of type TGraph
bool addGraph(TGraph2D* graph1, const TGraph2D* graph2)
 add two objects of type TGraph2D
bool addGraph(TNamed* graph1, const TNamed* graph2)
 add two graphs
TString getDetailsAsString(const TNamed* obj, int option = 1)
 retrieve an info-string for some TPrincipal object
TString getDetailsAsString(const TPrincipal* p, int option = 1)
 retrieve an info-string for some TPrincipal object
int dumpData(TPrincipal* p, int cutoff = 100)
 print the entire data contents of a TPrincipal object to the console
TH1* getSoverSqrtBScan(TH1* signal, TH1* bkg, bool fromleft, double cutoff = 0.050000000000000003, bool verbose = false)
 retrieve an integrated s/sqrt(b) histogram, scanning from left or right
double getFOM(TQHistogramUtils::FOM fom, double b, double berr, double s, double serr)
 calculate a figure of merit from the source numbers
TString getFOMTitleROOT(TQHistogramUtils::FOM fom)
 return a title string identifying a figure of merit
TString getFOMTitleLaTeX(TQHistogramUtils::FOM fom)
 return a title string identifying a figure of merit
TH1* getSoverSqrtB(TH1* sig, TH1* bkg)
 retrieve an s/sqrt(b) histogram (bin-by-bin mode)
TH1* getFOMHistogram(TQHistogramUtils::FOM fom, TH1* sig, TH1* bkg, double cutoff = 0, const vector<TH1*>& bkgSystHistos = std::vector<TH1 *>{})
 retrieve a significance histogram (bin-by-bin mode)
TH1* getFOMScan(TQHistogramUtils::FOM fom, TH1* sig, TH1* bkg, bool fromleft, double cutoff, bool verbose, const vector<TH1*>& bkgSystHistos = std::vector<TH1 *>{})
 retrieve an integrated FOM histogram, scanning from left or right
double sumLineDistSquares(TH2* hist, double a, double b, bool useUnderflowOverflow = false)
 calculate the sum of squared distances between some line and all histogram entries in a 2D histogram
double calculateBinLineDistSquare(TH2* hist, double a, double b, int i, int j)
 calculate the squared distance between some line and a given bin in a 2D histogram
 line is defined by slope b and y-axis offset a
TH1* getLineDistSquares(TH2* hist, double a, double b, bool useUnderflowOverflow = false)
 generate distribution of squared distances between some line and all histogram entries in a 2D histogram
 line is defined by slope b and y-axis offset a
TH1* rotationProfile(TH2* hist, double xUnit = -1, double yUnit = -1, int nStep = 36, double xOrig = 0, double yOrig = 0)
 produces the 'rotation profile' of a histogram in the following sense
 given a line with angle alpha, what is the sum of squared distances of all histogram entries
 with respect to the given line?
 the returned histogram holds the dependency of the inverse of this sum as a function of the angle alpha
 since the definition of the angle depends on the relative scaling of the two axis,
 units must be given for both dimensions.
TH2* rotationYtranslationProfile(TH2* hist, double xUnit = -1, double yUnit = -1, int nStepAngle = 36, int nStepOffset = -1, double xOrig = 0, double y0 = std::numeric_limits<double>::quiet_NaN())
 produces the 'rotation-translation profile' of a histogram in the following sense
 given a line with angle alpha and a vertical offset y, what is the sum of squared distances of all histogram entries
 with respect to the given line?
 the returned histogram holds the dependency of the inverse of this sum as a function of the angle alpha and the offset y
 since the definition of the angle depends on the relative scaling of the two axis,
 units must be given for both dimensions.
TH2* rotationXtranslationProfile(TH2* hist, double xUnit = -1, double yUnit = -1, int nStepAngle = 36, int nStepOffset = -1, double yOrig = 0, double x0 = std::numeric_limits<double>::quiet_NaN())
 produces the 'rotation-translation profile' of a histogram in the following sense
 given a line with angle alpha and a horizontal offset x, what is the sum of squared distances of all histogram entries
 with respect to the given line?
 the returned histogram holds the dependency of the inverse of this sum as a function of the angle alpha and the offset x
 since the definition of the angle depends on the relative scaling of the two axis,
 units must be given for both dimensions.
TLine* makeBisectorLine(TH1* hist, double angle = 45, double xUnit = -1, double yUnit = -1, double xOrig = 0, double yOrig = 0)
 create a TLine with a given angle (in xUnit and yUnit coordinates, axis coordinates if not given)
 measured from origin at xOrig and yOrig
 will be cropped to the size fo the histogram
bool cropLine(TH1* hist, TLine* l)
 crop a line so that it does not exceed the drawing area of the histogram
 this function will swap the line orientation such that x1<x2
double clearBinsAboveX(TH1* hist, double xMax)
 clear all histogram bins beyond xMax
double clearBinsBelowX(TH1* hist, double xMin)
 clear all histogram bins below xMin
double clearBinsAboveX(TH2* hist, double xMax)
 clear all histogram bins beyond xMax (for 2D-histograms)
double clearBinsBelowX(TH2* hist, double xMin)
 clear all histogram bins below xMin (for 2D-histograms)
double clearBinsAboveY(TH2* hist, double yMax)
 clear all histogram bins beyond yMax (for 2D-histograms)
double clearBinsBelowY(TH2* hist, double yMin)
 clear all histogram bins below yMin (for 2D-histograms)
void printHistogramASCII(TH1* hist, const TString& tags = "")
 print a histogram to the console (ascii-art)
void printHistogramASCII(TH1* hist, TQTaggable& tags)
 print a histogram to the console (ascii-art)
void printHistogramASCII(ostream& , TH1* hist, const TString& tags)
 print a histogram to a stream (ascii-art)
void printHistogramASCII(ostream& , TH1* hist, TQTaggable& tags)
 print a histogram to a stream (ascii-art)
TStyle* ATLASstyle()
 copied from official ATLAS style scripts
 returns a TStyle* object according to the ATLAS style guidelines
 can then be enabled via gROOT->SetStyle("ATLAS");
 followed by either calling TH1::UseCurrentStyle() on each histogram or gROOT->ForceStyle();
TCanvas* applyATLASstyle(TH1* histo, const TString& label = "Internal", double relPosX = 0.10000000000000001, double relPosY = 0.10000000000000001, double yResize = 1., const TString& xTitle = "none", const TString& yTitle = "none", bool square = false)
Turns a simple histogram into a plot following ATLAS style guidelines. This is mostly intended for quick plotting and interactive use
TH1* unrollHistogram(const TH2* input, bool firstX = true, bool includeUnderflowOverflow = false, bool addLabels = false)
 unroll a two-dimensional histogram, concatenating the slices to a single one-dimensional histogram
TObjArray* getSlices(const TH2* input, bool alongX = true)
 chop a 2d-histogram into slices along X (or Y)
bool isUnderflowOverflowBin(TH1* hist, int bin)
bool isGreaterThan(TH1* hist1, TH1* hist2)
 returns true if each bin of hist1 has a larger or equal value than the corresponding bin of hist2
bool hasGreaterMaximumThan(TH1* hist1, TH1* hist2)
TCanvas* applyATLASstyle(TGraph* graph, const TString& label = "Internal", double relPosX = 0.10000000000000001, double relPosY = 0.10000000000000001, double yResize = 1., const TString& xTitle = "none", const TString& yTitle = "none", bool square = false)
Turns a TGraph based scatter plot into a plot following ATLAS style guidelines. This is mostly intended for quick plotting and interactive use
TCanvas* applyATLASstyle(TMultiGraph* graph, const TString& label = "Internal", double relPosX = 0.10000000000000001, double relPosY = 0.10000000000000001, double yResize = 1., const TString& xTitle = "none", const TString& yTitle = "none", bool square = false)
Turns a TGraph based scatter plot into a plot following ATLAS style guidelines. This is mostly intended for quick plotting and interactive use
void rerollGauss(TH1* hist, double zvalue = 1)
 reroll a histogram, i.e. replace every bin content with a new
 number randomly selected from a gaussian distribution where mean
 and width are given by bin content and bin error of the histogram.
 zvalue can be used to scale up or down the width of the gaussian.
void rerollPoisson(TH1* hist, int seed = 0)
 reroll a histogram, i.e. replace every bin content with a new
 number randomly selected from a poisson distribution where the mean
 is given by bin content of the histogram.
bool envelopeUpper(TH1* hist, TH1* otherhist)
 envelope a histogram by another one, taking the bin-by-bin maximum
bool envelopeLower(TH1* hist, TH1* otherhist)
 envelope a histogram by another one, taking the bin-by-bin minimum
TMatrixD* convertHistogramToMatrix(TH2* hist)
 convert a 2d histogram into a matrix
TMatrixDSym* convertHistogramToSymMatrix(TH2* hist, double relThreshold = 1.0000000000000001E-9, double absThreshold = 1.0000000000000001E-9)
 convert a 2d histogram into a matrix
TMatrixDSym* convertHistogramToSymMatrix(TH2* hist, const vector<TString>& ordering, double relThreshold = 1.0000000000000001E-9, double absThreshold = 1.0000000000000001E-9)
 convert a 2d histogram into a matrix
int fixHoles1D(TH1* hist, double threshold)
 fix holes (empty bins below threshold) in a 1D histogram
 this function uses simple linear interpolation/extrapolation from the 2 adjacent bins
 underflow/overflow bins are ignored
void scaleErrors(TH1* hist, double scale)
 scale the errors of a histogram by an arbitrary number
bool transferRelativeErrors(TH1* sourceHist, TH1* targetHist)
 set the relative errors of targetHist to the ones of sourceHist
bool transferRelativeErrors(TQCounter* sourceHist, TQCounter* targetHist)
 set the relative errors of target counter to the ones of source counter
TH1* sumHistograms(TCollection* histos)
 sums up histograms in input collection and returns the summed histogram
 if no histogram (instance of TH1) is found a nullptr is returned.
 if histograms are found to be inconsistent a nullptr is returned.
TH1* sumHistograms(const vector<TH1*>& histos)
 sums up histograms in input collection and returns the summed histogram
 if no histogram (instance of TH1) is found a nullptr is returned.
 if histograms are found to be inconsistent a nullptr is returned.
TH1* createEnvelopingHistogram(TCollection* histos)
TH1* createEnvelopingHistogram(const vector<TH1*>& histos)
int getNbinsGlobal(const TH1* hist, bool ignoreLabels = false)
FOM readFOM(TString fom)