ROOT logo
ROOT » HIST » HIST » TH2Poly

class TH2Poly: public TH2


TH2Poly: 2D Histogram with Polygonal Bins

Overview

TH2Poly is a 2D Histogram class (TH2) allowing to define polygonal bins of arbitrary shape.

Each bin in the TH2Poly histogram is a TH2PolyBin object. TH2PolyBin is a very simple class containing the vertices (stored as TGraphs or TMultiGraphs ) and contents of the polygonal bin as well as several related functions.

Essentially, a TH2Poly is a TList of TH2PolyBin objects with methods to manipulate them.

Bins are defined using one of the AddBin() methods. The bin definition should be done before filling.

The histogram can be filled with Fill(Double_t x, Double_t y, Double_t w) . w is the weight. If no weight is specified, it is assumed to be 1.

Not all histogram's area need to be binned. Filling an area without bins, will falls into the overflows. Adding a bin is not retroactive; it doesn't affect previous fillings. A Fill() call, that was previously ignored due to the lack of a bin at the specified location, is not reconsidered when that location is binned later.

If there are two overlapping bins, the first one in the list will be incremented by Fill().

The histogram may automatically extends its limits if a bin outside the histogram limits is added. This is done when the default constructor (with no arguments) is used. It generates a histogram with no limits along the X and Y axis. Adding bins to it will extend it up to a proper size.

TH2Poly implements a partitioning algorithm to speed up bins' filling. The partitioning algorithm divides the histogram into regions called cells. The bins that each cell intersects are recorded in an array of TLists. When a coordinate in the histogram is to be filled; the method (quickly) finds which cell the coordinate belongs. It then only loops over the bins intersecting that cell to find the bin the input coordinate corresponds to. The partitioning of the histogram is updated continuously as each bin is added. The default number of cells on each axis is 25. This number could be set to another value in the constructor or adjusted later by calling the ChangePartition(Int_t, Int_t) method. The partitioning algorithm is considerably faster than the brute force algorithm (i.e. checking if each bin contains the input coordinates), especially if the histogram is to be filled many times.

The following very simple macro shows how to build and fill a TH2Poly:

{
    TH2Poly *h2p = new TH2Poly();
    Double_t x1[] = {0, 5, 6};
    Double_t y1[] = {0, 0, 5};
    Double_t x2[] = {0, -1, -1, 0};
    Double_t y2[] = {0, 0, -1, 3};
    Double_t x3[] = {4, 3, 0, 1, 2.4};
    Double_t y3[] = {4, 3.7, 1, 3.7, 2.5};
    h2p->AddBin(3, x1, y1);
    h2p->AddBin(4, x2, y2);
    h2p->AddBin(5, x3, y3);
    h2p->Fill(0.1, 0.01, 3);
    h2p->Fill(-0.5, -0.5, 7);
    h2p->Fill(-0.7, -0.5, 1);
    h2p->Fill(1, 3, 1.5);
}

More examples can bin found in $ROOTSYS/tutorials/hist/th2poly*.C

Partitioning Algorithm

The partitioning algorithm forms an essential part of the TH2Poly class. It is implemented to speed up the filling of bins.

With the brute force approach, the filling is done in the following way: An iterator loops over all bins in the TH2Poly and invokes the method IsInside() for each of them. This method checks if the input location is in that bin. If the filling coordinate is inside, the bin is filled. Looping over all the bin is very slow.

The alternative is to divide the histogram into virtual rectangular regions called "cells". Each cell stores the pointers of the bins intersecting it. When a coordinate is to be filled, the method finds which cell the coordinate falls into. Since the cells are rectangular, this can be done very quickly. It then only loops over the bins associated with that cell.

The addition of bins to the appropriate cells is done when the bin is added to the histogram. To do this, AddBin() calls the AddBinToPartition() method. This method adds the input bin to the partitioning matrix.

The number of partition cells per axis can be specified in the constructor. If it is not specified, the default value of 25 along each axis will be assigned. This value was chosen because it is small enough to avoid slowing down AddBin(), while being large enough to enhance Fill() by a considerable amount. Regardless of how it is initialized at construction time, it can be changed later with the ChangePartition() method. ChangePartition() deletes the old partition matrix and generates a new one with the specified number of cells on each axis.

The optimum number of partition cells per axis changes with the number of times Fill() will be called. Although partitioning greatly speeds up filling, it also adds a constant time delay into the code. When Fill() is to be called many times, it is more efficient to divide the histogram into a large number cells. However, if the histogram is to be filled only a few times, it is better to divide into a small number of cells.

 

Function Members (Methods)

public:
TH2Poly()
TH2Poly(const TH2Poly&)
TH2Poly(const char* name, const char* title, Double_t xlow, Double_t xup, Double_t ylow, Double_t yup)
TH2Poly(const char* name, const char* title, Int_t nX, Double_t xlow, Double_t xup, Int_t nY, Double_t ylow, Double_t yup)
virtual~TH2Poly()
voidTObject::AbstractMethod(const char* method) const
virtual Bool_tAdd(const TH1* h1, Double_t c1)
virtual Bool_tAdd(TF1* h1, Double_t c1 = 1, Option_t* option = "")
virtual Bool_tAdd(const TH1* h1, const TH1* h2, Double_t c1 = 1, Double_t c2 = 1)
Int_tAddBin(TObject* poly)
Int_tAddBin(Int_t n, const Double_t* x, const Double_t* y)
Int_tAddBin(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual voidTH1::AddBinContent(Int_t bin)
virtual voidTH1::AddBinContent(Int_t bin, Double_t w)
static voidTH1::AddDirectory(Bool_t add = kTRUE)
static Bool_tTH1::AddDirectoryStatus()
virtual Double_tTH1::AndersonDarlingTest(const TH1* h2, Option_t* option = "") const
virtual Double_tTH1::AndersonDarlingTest(const TH1* h2, Double_t& advalue) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTH1::Browse(TBrowser* b)
virtual Int_tTH2::BufferEmpty(Int_t action = 0)
voidChangePartition(Int_t n, Int_t m)
virtual Double_tTH1::Chi2Test(const TH1* h2, Option_t* option = "UU", Double_t* res = 0) const
virtual Double_tTH1::Chi2TestX(const TH1* h2, Double_t& chi2, Int_t& ndf, Int_t& igood, Option_t* option = "UU", Double_t* res = 0) const
virtual Double_tTH1::Chisquare(TF1* f1, Option_t* option = "") const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
voidClearBinContents()
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual Double_tTH1::ComputeIntegral(Bool_t onlyPositive = false)
virtual voidTH2::Copy(TObject& hnew) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual voidTH1::DirectoryAutoAdd(TDirectory*)
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tTH1::DistancetoPrimitive(Int_t px, Int_t py)
virtual Bool_tTH1::Divide(const TH1* h1)
virtual Bool_tTH1::Divide(TF1* f1, Double_t c1 = 1)
virtual Bool_tTH1::Divide(const TH1* h1, const TH1* h2, Double_t c1 = 1, Double_t c2 = 1, Option_t* option = "")MENU
virtual voidTH1::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual TH1*DrawCopy(Option_t* option = "") const
virtual TH1*TH1::DrawNormalized(Option_t* option = "", Double_t norm = 1) const
virtual voidTH1::DrawPanel()MENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTH1::Eval(TF1* f1, Option_t* option = "")
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTH1::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TH1*TH1::FFT(TH1* h_output, Option_t* option)
virtual Int_tFill(Double_t)
virtual Int_tFill(Double_t x, Double_t y)
virtual Int_tFill(const char* name, Double_t w)
virtual Int_tFill(Double_t x, Double_t y, Double_t w)
virtual Int_tFill(Double_t, const char*, Double_t)
virtual Int_tFill(const char*, Double_t, Double_t)
virtual Int_tFill(const char*, const char*, Double_t)
virtual voidTNamed::FillBuffer(char*& buffer)
virtual voidFillN(Int_t, const Double_t*, const Double_t*, Int_t)
virtual voidFillN(Int_t ntimes, const Double_t* x, const Double_t* y, const Double_t* w, Int_t stride = 1)
virtual voidTH2::FillRandom(const char* fname, Int_t ntimes = 5000)
virtual voidTH2::FillRandom(TH1* h, Int_t ntimes = 5000)
virtual Int_tFindBin(Double_t x, Double_t y, Double_t z = 0)
virtual Int_tTH2::FindFirstBinAbove(Double_t threshold = 0, Int_t axis = 1) const
virtual Int_tTH1::FindFixBin(Double_t x, Double_t y = 0, Double_t z = 0) const
virtual Int_tTH2::FindLastBinAbove(Double_t threshold = 0, Int_t axis = 1) const
virtual TObject*TH1::FindObject(const char* name) const
virtual TObject*TH1::FindObject(const TObject* obj) const
virtual TFitResultPtrTH1::Fit(const char* formula, Option_t* option = "", Option_t* goption = "", Double_t xmin = 0, Double_t xmax = 0)MENU
virtual TFitResultPtrTH1::Fit(TF1* f1, Option_t* option = "", Option_t* goption = "", Double_t xmin = 0, Double_t xmax = 0)
static Int_tTH1::FitOptionsMake(Option_t* option, Foption_t& Foption)
virtual voidTH1::FitPanel()MENU
virtual voidTH2::FitSlicesX(TF1* f1 = 0, Int_t firstybin = 0, Int_t lastybin = -1, Int_t cut = 0, Option_t* option = "QNR", TObjArray* arr = 0)MENU
virtual voidTH2::FitSlicesY(TF1* f1 = 0, Int_t firstxbin = 0, Int_t lastxbin = -1, Int_t cut = 0, Option_t* option = "QNR", TObjArray* arr = 0)MENU
TH1*TH1::GetAsymmetry(TH1* h2, Double_t c2 = 1, Double_t dc2 = 0)
virtual Color_tTH1::GetAxisColor(Option_t* axis = "X") const
virtual Float_tTH1::GetBarOffset() const
virtual Float_tTH1::GetBarWidth() const
virtual Int_tTH1::GetBin(Int_t binx, Int_t biny = 0, Int_t binz = 0) const
virtual Double_tTH1::GetBinCenter(Int_t bin) const
virtual Double_tGetBinContent(Int_t bin) const
virtual Double_tGetBinContent(Int_t, Int_t) const
virtual Double_tGetBinContent(Int_t, Int_t, Int_t) const
Bool_tGetBinContentChanged() const
virtual Double_tGetBinError(Int_t bin) const
virtual Double_tGetBinError(Int_t, Int_t) const
virtual Double_tGetBinError(Int_t, Int_t, Int_t) const
virtual Double_tTH2::GetBinErrorLow(Int_t binx, Int_t biny)
virtual TH1::EBinErrorOptTH1::GetBinErrorOption() const
virtual Double_tTH2::GetBinErrorUp(Int_t binx, Int_t biny)
virtual Double_tTH1::GetBinLowEdge(Int_t bin) const
const char*GetBinName(Int_t bin) const
TList*GetBins()
const char*GetBinTitle(Int_t bin) const
virtual Double_tTH1::GetBinWidth(Int_t bin) const
virtual Double_tTH1::GetBinWithContent(Double_t c, Int_t& binx, Int_t firstx = 0, Int_t lastx = 0, Double_t maxdiff = 0) const
virtual Double_tTH2::GetBinWithContent2(Double_t c, Int_t& binx, Int_t& biny, Int_t firstxbin = 1, Int_t lastxbin = -1, Int_t firstybin = 1, Int_t lastybin = -1, Double_t maxdiff = 0) const
virtual voidTH1::GetBinXYZ(Int_t binglobal, Int_t& binx, Int_t& biny, Int_t& binz) const
const Double_t*TH1::GetBuffer() const
Int_tTH1::GetBufferLength() const
Int_tTH1::GetBufferSize() const
virtual Double_tTH1::GetCellContent(Int_t binx, Int_t biny) const
virtual Double_tTH1::GetCellError(Int_t binx, Int_t biny) const
virtual voidTH1::GetCenter(Double_t* center) const
virtual Int_tTH1::GetContour(Double_t* levels = 0)
virtual Double_tTH1::GetContourLevel(Int_t level) const
virtual Double_tTH1::GetContourLevelPad(Int_t level) const
virtual Double_tTH2::GetCorrelationFactor(Int_t axis1 = 1, Int_t axis2 = 2) const
virtual Double_tTH2::GetCovariance(Int_t axis1 = 1, Int_t axis2 = 2) const
TH1*TH1::GetCumulative(Bool_t forward = kTRUE, const char* suffix = "_cumulative") const
static Int_tTH1::GetDefaultBufferSize()
static Bool_tTH1::GetDefaultSumw2()
virtual Int_tTH1::GetDimension() const
TDirectory*TH1::GetDirectory() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Double_tTH1::GetEffectiveEntries() const
virtual Double_tTH1::GetEntries() const
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
Bool_tGetFloat()
virtual TF1*TH1::GetFunction(const char* name) const
virtual const char*TObject::GetIconName() const
virtual Double_t*TH1::GetIntegral()
virtual Double_tTH1::GetKurtosis(Int_t axis = 1) const
virtual Color_tTH1::GetLabelColor(Option_t* axis = "X") const
virtual Style_tTH1::GetLabelFont(Option_t* axis = "X") const
virtual Float_tTH1::GetLabelOffset(Option_t* axis = "X") const
virtual Float_tTH1::GetLabelSize(Option_t* axis = "X") const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
TList*TH1::GetListOfFunctions() const
virtual voidTH1::GetLowEdge(Double_t* edge) const
virtual Color_tTAttMarker::GetMarkerColor() const
virtual Size_tTAttMarker::GetMarkerSize() const
virtual Style_tTAttMarker::GetMarkerStyle() const
Double_tGetMaximum() const
virtual Double_tGetMaximum(Double_t maxval) const
virtual Int_tTH1::GetMaximumBin() const
virtual Int_tTH1::GetMaximumBin(Int_t& locmax, Int_t& locmay, Int_t& locmaz) const
virtual Double_tTH1::GetMaximumStored() const
virtual Double_tTH1::GetMean(Int_t axis = 1) const
virtual Double_tTH1::GetMeanError(Int_t axis = 1) const
Double_tGetMinimum() const
virtual Double_tGetMinimum(Double_t minval) const
virtual Int_tTH1::GetMinimumBin() const
virtual Int_tTH1::GetMinimumBin(Int_t& locmix, Int_t& locmiy, Int_t& locmiz) const
virtual Double_tTH1::GetMinimumStored() const
virtual const char*TNamed::GetName() const
virtual Int_tTH1::GetNbinsX() const
virtual Int_tTH1::GetNbinsY() const
virtual Int_tTH1::GetNbinsZ() const
virtual Int_tTH1::GetNdivisions(Option_t* axis = "X") const
Bool_tGetNewBinAdded() const
virtual Double_tTH1::GetNormFactor() const
Int_tGetNumberOfBins() const
virtual char*TH1::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TH1::GetOption() const
TVirtualHistPainter*TH1::GetPainter(Option_t* option = "")
virtual Int_tTH1::GetQuantiles(Int_t nprobSum, Double_t* q, const Double_t* probSum = 0)
virtual Double_tTH1::GetRandom() const
virtual voidTH2::GetRandom2(Double_t& x, Double_t& y)
virtual Double_tTH1::GetRMS(Int_t axis = 1) const
virtual Double_tTH1::GetRMSError(Int_t axis = 1) const
virtual Double_tTH1::GetSkewness(Int_t axis = 1) const
virtual voidTH2::GetStats(Double_t* stats) const
Double_tTH1::GetStdDev(Int_t axis = 1) const
Double_tTH1::GetStdDevError(Int_t axis = 1) const
virtual Double_tTH1::GetSumOfWeights() const
virtual TArrayD*TH1::GetSumw2()
virtual const TArrayD*TH1::GetSumw2() const
virtual Int_tTH1::GetSumw2N() const
virtual Float_tTH1::GetTickLength(Option_t* axis = "X") const
virtual const char*TNamed::GetTitle() const
virtual Style_tTH1::GetTitleFont(Option_t* axis = "X") const
virtual Float_tTH1::GetTitleOffset(Option_t* axis = "X") const
virtual Float_tTH1::GetTitleSize(Option_t* axis = "X") const
virtual UInt_tTObject::GetUniqueID() const
TAxis*TH1::GetXaxis() const
TAxis*TH1::GetYaxis() const
TAxis*TH1::GetZaxis() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
voidHoneycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
virtual Double_tIntegral(Option_t* option = "") const
virtual Double_tIntegral(Int_t, Int_t, Option_t*) const
virtual Double_tIntegral(Int_t, Int_t, Int_t, Int_t, Option_t*) const
virtual Double_tIntegral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t*) const
virtual Double_tTH2::IntegralAndError(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Double_t& err, Option_t* option = "") const
virtual Double_tTH2::Interpolate(Double_t x)
virtual Double_tTH2::Interpolate(Double_t x, Double_t y)
virtual Double_tTH2::Interpolate(Double_t x, Double_t y, Double_t z)
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tTH1::IsBinOverflow(Int_t bin) const
Bool_tTH1::IsBinUnderflow(Int_t bin) const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTObject::IsZombie() const
virtual Double_tTH2::KolmogorovTest(const TH1* h2, Option_t* option = "") const
virtual voidTH1::LabelsDeflate(Option_t* axis = "X")
virtual voidTH1::LabelsInflate(Option_t* axis = "X")
virtual voidTH1::LabelsOption(Option_t* option = "h", Option_t* axis = "X")
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Long64_tMerge(TCollection*)
virtual voidTAttLine::Modify()
virtual Bool_tTH1::Multiply(const TH1* h1)
virtual Bool_tTH1::Multiply(TF1* h1, Double_t c1 = 1)
virtual Bool_tTH1::Multiply(const TH1* h1, const TH1* h2, Double_t c1 = 1, Double_t c2 = 1, Option_t* option = "")MENU
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TNamed&TNamed::operator=(const TNamed& rhs)
virtual voidTH1::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTH1::Print(Option_t* option = "") const
TProfile*TH2::ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "") constMENU
TProfile*TH2::ProfileY(const char* name = "_pfy", Int_t firstxbin = 1, Int_t lastxbin = -1, Option_t* option = "") constMENU
TH1D*TH2::ProjectionX(const char* name = "_px", Int_t firstybin = 0, Int_t lastybin = -1, Option_t* option = "") constMENU
TH1D*TH2::ProjectionY(const char* name = "_py", Int_t firstxbin = 0, Int_t lastxbin = -1, Option_t* option = "") constMENU
virtual voidTH2::PutStats(Double_t* stats)
virtual Int_tTObject::Read(const char* name)
virtual TH1*TH1::Rebin(Int_t ngroup = 2, const char* newname = "", const Double_t* xbins = 0)MENU
virtual TH2*TH2::Rebin2D(Int_t nxgroup = 2, Int_t nygroup = 2, const char* newname = "")
virtual voidTH1::RebinAxis(Double_t x, TAxis* axis)
virtual TH2*TH2::RebinX(Int_t ngroup = 2, const char* newname = "")
virtual TH2*TH2::RebinY(Int_t ngroup = 2, const char* newname = "")
virtual voidTH1::Rebuild(Option_t* option = "")
virtual voidTH1::RecursiveRemove(TObject* obj)
virtual voidReset(Option_t* option)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
virtual voidTAttMarker::ResetAttMarker(Option_t* toption = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTH1::ResetStats()
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidTAttMarker::SaveMarkerAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t sizdef = 1)
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
virtual voidScale(Double_t c1 = 1, Option_t* option = "")
virtual voidTH1::SetAxisColor(Color_t color = 1, Option_t* axis = "X")
virtual voidTH1::SetAxisRange(Double_t xmin, Double_t xmax, Option_t* axis = "X")
virtual voidTH1::SetBarOffset(Float_t offset = 0.25)
virtual voidTH1::SetBarWidth(Float_t width = 0.5)
virtual voidSetBinContent(Int_t bin, Double_t content)
virtual voidSetBinContent(Int_t, Int_t, Double_t)
virtual voidSetBinContent(Int_t, Int_t, Int_t, Double_t)
voidSetBinContentChanged(Bool_t flag)
virtual voidTH1::SetBinError(Int_t bin, Double_t error)
virtual voidTH1::SetBinError(Int_t binx, Int_t biny, Double_t error)
virtual voidTH1::SetBinError(Int_t binx, Int_t biny, Int_t binz, Double_t error)
virtual voidTH1::SetBinErrorOption(TH1::EBinErrorOpt type)
virtual voidTH1::SetBins(Int_t nx, const Double_t* xBins)
virtual voidTH1::SetBins(Int_t nx, Double_t xmin, Double_t xmax)
virtual voidTH1::SetBins(Int_t nx, const Double_t* xBins, Int_t ny, const Double_t* yBins)
virtual voidTH1::SetBins(Int_t nx, Double_t xmin, Double_t xmax, Int_t ny, Double_t ymin, Double_t ymax)
virtual voidTH1::SetBins(Int_t nx, const Double_t* xBins, Int_t ny, const Double_t* yBins, Int_t nz, const Double_t* zBins)
virtual voidTH1::SetBins(Int_t nx, Double_t xmin, Double_t xmax, Int_t ny, Double_t ymin, Double_t ymax, Int_t nz, Double_t zmin, Double_t zmax)
virtual voidTH1::SetBinsLength(Int_t = -1)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTH1::SetBuffer(Int_t buffersize, Option_t* option = "")
virtual voidTH1::SetCellContent(Int_t binx, Int_t biny, Double_t content)
virtual voidTH1::SetCellError(Int_t binx, Int_t biny, Double_t content)
virtual voidTH1::SetContent(const Double_t* content)
virtual voidTH1::SetContour(Int_t nlevels, const Double_t* levels = 0)
virtual voidTH1::SetContourLevel(Int_t level, Double_t value)
static voidTH1::SetDefaultBufferSize(Int_t buffersize = 1000)
static voidTH1::SetDefaultSumw2(Bool_t sumw2 = kTRUE)
virtual voidTH1::SetDirectory(TDirectory* dir)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTH1::SetEntries(Double_t n)
virtual voidTH1::SetError(const Double_t* error)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillColorAlpha(Color_t fcolor, Float_t falpha)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
voidSetFloat(Bool_t flag = true)
virtual voidTH1::SetLabelColor(Color_t color = 1, Option_t* axis = "X")
virtual voidTH1::SetLabelFont(Style_t font = 62, Option_t* axis = "X")
virtual voidTH1::SetLabelOffset(Float_t offset = 0.005, Option_t* axis = "X")
virtual voidTH1::SetLabelSize(Float_t size = 0.02, Option_t* axis = "X")
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidTAttLine::SetLineColor(Color_t lcolor)
virtual voidTAttLine::SetLineColorAlpha(Color_t lcolor, Float_t lalpha)
virtual voidTAttLine::SetLineStyle(Style_t lstyle)
virtual voidTAttLine::SetLineWidth(Width_t lwidth)
virtual voidTAttMarker::SetMarkerAttributes()MENU
virtual voidTAttMarker::SetMarkerColor(Color_t mcolor = 1)
virtual voidTAttMarker::SetMarkerColorAlpha(Color_t mcolor, Float_t malpha)
virtual voidTAttMarker::SetMarkerSize(Size_t msize = 1)
virtual voidTAttMarker::SetMarkerStyle(Style_t mstyle = 1)
virtual voidTH1::SetMaximum(Double_t maximum = -1111)MENU
virtual voidTH1::SetMinimum(Double_t minimum = -1111)MENU
virtual voidTH1::SetName(const char* name)MENU
virtual voidTH1::SetNameTitle(const char* name, const char* title)
virtual voidTH1::SetNdivisions(Int_t n = 510, Option_t* axis = "X")
voidSetNewBinAdded(Bool_t flag)
virtual voidTH1::SetNormFactor(Double_t factor = 1)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTH1::SetOption(Option_t* option = " ")
virtual voidTH2::SetShowProjectionX(Int_t nbins = 1)MENU
virtual voidTH2::SetShowProjectionY(Int_t nbins = 1)MENU
virtual voidTH1::SetStats(Bool_t stats = kTRUE)MENU
virtual voidTH1::SetTickLength(Float_t length = 0.02, Option_t* axis = "X")
virtual voidTH1::SetTitle(const char* title)MENU
virtual voidTH1::SetTitleFont(Style_t font = 62, Option_t* axis = "X")
virtual voidTH1::SetTitleOffset(Float_t offset = 1, Option_t* axis = "X")
virtual voidTH1::SetTitleSize(Float_t size = 0.02, Option_t* axis = "X")
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidTH1::SetXTitle(const char* title)
virtual voidTH1::SetYTitle(const char* title)
virtual voidTH1::SetZTitle(const char* title)
virtual TH1*TH2::ShowBackground(Int_t niter = 20, Option_t* option = "same")
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTH2::ShowPeaks(Double_t sigma = 2, Option_t* option = "", Double_t threshold = 0.05)MENU
virtual Int_tTNamed::Sizeof() const
virtual voidTH2::Smooth(Int_t ntimes = 1, Option_t* option = "")MENU
static voidTH1::SmoothArray(Int_t NN, Double_t* XX, Int_t ntimes = 1)
static voidTH1::StatOverflows(Bool_t flag = kTRUE)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTH1::Sumw2(Bool_t flag = kTRUE)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
static TH1*TH1::TransformHisto(TVirtualFFT* fft, TH1* h_output, Option_t* option)
virtual voidTH1::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
voidAddBinToPartition(TH2PolyBin* bin)
virtual Int_tTH2::BufferFill(Double_t, Double_t)
virtual Int_tTH2::BufferFill(Double_t x, Double_t y, Double_t w)
static boolTH1::CheckAxisLimits(const TAxis* a1, const TAxis* a2)
static boolTH1::CheckBinLabels(const TAxis* a1, const TAxis* a2)
static boolTH1::CheckBinLimits(const TAxis* a1, const TAxis* a2)
static boolTH1::CheckConsistency(const TH1* h1, const TH1* h2)
static boolTH1::CheckConsistentSubAxes(const TAxis* a1, Int_t firstBin1, Int_t lastBin1, const TAxis* a2, Int_t firstBin2 = 0, Int_t lastBin2 = 0)
static boolTH1::CheckEqualAxes(const TAxis* a1, const TAxis* a2)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual voidTH1::DoFillN(Int_t ntimes, const Double_t* x, const Double_t* w, Int_t stride = 1)
virtual voidTH2::DoFitSlices(bool onX, TF1* f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t* option, TObjArray* arr)
virtual Double_tTH1::DoIntegral(Int_t ix1, Int_t ix2, Int_t iy1, Int_t iy2, Int_t iz1, Int_t iz2, Double_t& err, Option_t* opt, Bool_t doerr = kFALSE) const
virtual TProfile*TH2::DoProfile(bool onX, const char* name, Int_t firstbin, Int_t lastbin, Option_t* option) const
virtual TH1D*TH2::DoProjection(bool onX, const char* name, Int_t firstbin, Int_t lastbin, Option_t* option) const
virtual Bool_tTH1::FindNewAxisLimits(const TAxis* axis, const Double_t point, Double_t& newMin, Double_t& newMax)
voidInitialize(Double_t xlow, Double_t xup, Double_t ylow, Double_t yup, Int_t n, Int_t m)
Bool_tIsIntersecting(TH2PolyBin* bin, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt)
Bool_tIsIntersectingPolygon(Int_t bn, Double_t* x, Double_t* y, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt)
voidTObject::MakeZombie()
static Bool_tTH1::RecomputeAxisLimits(TAxis& destAxis, const TAxis& anAxis)
static Bool_tTH1::SameLimitsAndNBins(const TAxis& axis1, const TAxis& axis2)
virtual voidTH1::SavePrimitiveHelp(ostream& out, const char* hname, Option_t* option = "")

Data Members

protected:
Short_tTH1::fBarOffset(1000*offset) for bar charts or legos
Short_tTH1::fBarWidth(1000*width) for bar charts or legos
Bool_tfBinContentChanged!For the 3D Painter
TH1::EBinErrorOptTH1::fBinStatErrOptoption for bin statistical errors
TList*fBinsList of bins. The list owns the contained objects
Double_t*TH1::fBuffer[fBufferSize] entry buffer
Int_tTH1::fBufferSizefBuffer size
Int_tfCellXNumber of partition cells in the x-direction of the histogram
Int_tfCellYNumber of partition cells in the y-direction of the histogram
TList*fCells[fNCells] The array of TLists that store the bins that intersect with each cell. List do not own the contained objects
Bool_t*fCompletelyInside[fNCells] The array that returns true if the cell at the given coordinate is completely inside a bin
TArrayDTH1::fContourArray to display contour levels
Int_tTH1::fDimension!Histogram dimension (1, 2 or 3 dim)
TDirectory*TH1::fDirectory!Pointer to directory holding this histogram
Double_tTH1::fEntriesNumber of entries
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
Bool_tfFloatWhen set to kTRUE, allows the histogram to expand if a bin outside the limits is added.
TList*TH1::fFunctions->Pointer to list of functions (fits and user)
Double_t*TH1::fIntegral!Integral of bins used by GetRandom
Bool_t*fIsEmpty[fNCells] The array that returns true if the cell at the given coordinate is empty
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
Color_tTAttMarker::fMarkerColorMarker color index
Size_tTAttMarker::fMarkerSizeMarker size
Style_tTAttMarker::fMarkerStyleMarker style
Double_tTH1::fMaximumMaximum value for plotting
Double_tTH1::fMinimumMinimum value for plotting
Int_tfNCellsNumber of partition cells: fCellX*fCellY
TStringTNamed::fNameobject identifier
Int_tTH1::fNcellsnumber of bins(1D), cells (2D) +U/Overflows
Bool_tfNewBinAdded!For the 3D Painter
Double_tTH1::fNormFactorNormalization factor
TStringTH1::fOptionhistogram options
Double_tfOverflow[9]Overflow bins
TVirtualHistPainter*TH1::fPainter!pointer to histogram painter
Double_tTH2::fScalefactorScale factor
Double_tfStepX
Double_tfStepYDimensions of a partition cell
TArrayDTH1::fSumw2Array of sum of squares of weights
TStringTNamed::fTitleobject title
Double_tTH1::fTsumwTotal Sum of weights
Double_tTH1::fTsumw2Total Sum of squares of weights
Double_tTH1::fTsumwxTotal Sum of weight*X
Double_tTH1::fTsumwx2Total Sum of weight*X*X
Double_tTH2::fTsumwxyTotal Sum of weight*X*Y
Double_tTH2::fTsumwyTotal Sum of weight*Y
Double_tTH2::fTsumwy2Total Sum of weight*Y*Y
TAxisTH1::fXaxisX axis descriptor
TAxisTH1::fYaxisY axis descriptor
TAxisTH1::fZaxisZ axis descriptor
static Bool_tTH1::fgAddDirectory!flag to add histograms to the directory
static Int_tTH1::fgBufferSize!default buffer size for automatic histograms
static Bool_tTH1::fgDefaultSumw2!flag to call TH1::Sumw2 automatically at histogram creation time
static Bool_tTH1::fgStatOverflows!flag to use under/overflows in statistics

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TH2Poly()
 Default Constructor. No boundaries specified.
TH2Poly(const char* name, const char* title, Double_t xlow, Double_t xup, Double_t ylow, Double_t yup)
 Constructor with specified name and boundaries,
 but no partition cell number.
TH2Poly(const char* name, const char* title, Int_t nX, Double_t xlow, Double_t xup, Int_t nY, Double_t ylow, Double_t yup)
 Constructor with specified name and boundaries and partition cell number.
~TH2Poly()
 Destructor.
Int_t AddBin(TObject* poly)
 Adds a new bin to the histogram. It can be any object having the method
 IsInside(). It returns the bin number in the histogram. It returns 0 if
 it failed to add. To allow the histogram limits to expand when a bin
 outside the limits is added, call SetFloat() before adding the bin.
Int_t AddBin(Int_t n, const Double_t* x, const Double_t* y)
 Adds a new bin to the histogram. The number of vertices and their (x,y)
 coordinates are required as input. It returns the bin number in the
 histogram.
Int_t AddBin(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
 Add a new bin to the histogram. The bin shape is a rectangle.
 It returns the bin number of the bin in the histogram.
Bool_t Add(const TH1* h1, Double_t c1)
 Performs the operation: this = this + c1*h1.
Bool_t Add(TF1* h1, Double_t c1 = 1, Option_t* option = "")
 Performs the operation: this = this + c1*f1.
Bool_t Add(const TH1* h1, const TH1* h2, Double_t c1 = 1, Double_t c2 = 1)
 Replace contents of this histogram by the addition of h1 and h2.
void AddBinToPartition(TH2PolyBin* bin)
 Adds the input bin into the partition cell matrix. This method is called
 in AddBin() and ChangePartition().
void ChangePartition(Int_t n, Int_t m)
 Changes the number of partition cells in the histogram.
 Deletes the old partition and constructs a new one.
void ClearBinContents()
 Clears the contents of all bins in the histogram.
void Reset(Option_t* option)
 Reset this histogram: contents, errors, etc.
TH1 * DrawCopy(Option_t* option = "") const
 Draw copy.
Int_t FindBin(Double_t x, Double_t y, Double_t z = 0)
 Returns the bin number of the bin at the given coordinate. -1 to -9 are
 the overflow and underflow bins.  overflow bin -5 is the unbinned areas in
 the histogram (also called "the sea"). The third parameter can be left
 blank.
 The overflow/underflow bins are:

 -1 | -2 | -3

 -4 | -5 | -6

 -7 | -8 | -9

 where -5 means is the "sea" bin (i.e. unbinned areas)
Int_t Fill(Double_t x, Double_t y)
 Increment the bin containing (x,y) by 1.
 Uses the partitioning algorithm.
Int_t Fill(Double_t x, Double_t y, Double_t w)
 Increment the bin containing (x,y) by w.
 Uses the partitioning algorithm.
Int_t Fill(const char* name, Double_t w)
 Increment the bin named "name" by w.
void FillN(Int_t ntimes, const Double_t* x, const Double_t* y, const Double_t* w, Int_t stride = 1)
 Fills a 2-D histogram with an array of values and weights.

 ntimes:  number of entries in arrays x and w
          (array size must be ntimes*stride)
 x:       array of x values to be histogrammed
 y:       array of y values to be histogrammed
 w:       array of weights
 stride:  step size through arrays x, y and w
Double_t Integral(Option_t* option = "") const
 Returns the integral of bin contents.
 By default the integral is computed as the sum of bin contents.
 If option "width" or "area" is specified, the integral is the sum of
 the bin contents multiplied by the area of the bin.
Double_t GetBinContent(Int_t bin) const
 Returns the content of the input bin
 For the overflow/underflow/sea bins:

 -1 | -2 | -3
 ---+----+----
 -4 | -5 | -6
 ---+----+----
 -7 | -8 | -9

 where -5 is the "sea" bin (i.e. unbinned areas)
Double_t GetBinError(Int_t bin) const
 Returns the value of error associated to bin number bin.
 If the sum of squares of weights has been defined (via Sumw2),
 this function returns the sqrt(sum of w2).
 otherwise it returns the sqrt(contents) for this bin.
const char * GetBinName(Int_t bin) const
 Returns the bin name.
const char * GetBinTitle(Int_t bin) const
 Returns the bin title.
Double_t GetMaximum() const
 Returns the maximum value of the histogram.
Double_t GetMaximum(Double_t maxval) const
 Returns the maximum value of the histogram that is less than maxval.
Double_t GetMinimum() const
 Returns the minimum value of the histogram.
Double_t GetMinimum(Double_t minval) const
 Returns the minimum value of the histogram that is greater than minval.
void Honeycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s)
 Bins the histogram using a honeycomb structure
void Initialize(Double_t xlow, Double_t xup, Double_t ylow, Double_t yup, Int_t n, Int_t m)
 Initializes the TH2Poly object.  This method is called by the constructor.
Bool_t IsIntersecting(TH2PolyBin* bin, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt)
 Returns kTRUE if the input bin is intersecting with the
 input rectangle (xclipl, xclipr, yclipb, yclipt)
Bool_t IsIntersectingPolygon(Int_t bn, Double_t* x, Double_t* y, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt)
 Returns kTRUE if the input polygon (bn, x, y) is intersecting with the
 input rectangle (xclipl, xclipr, yclipb, yclipt)
Long64_t Merge(TCollection* )
void SavePrimitive(ostream& out, Option_t* option = "")
 Save primitive as a C++ statement(s) on output stream out
void Scale(Double_t c1 = 1, Option_t* option = "")
 Multiply this histogram by a constant c1.
void SetBinContent(Int_t bin, Double_t content)
 Sets the contents of the input bin to the input content
 Negative values between -1 and -9 are for the overflows and the sea
void SetFloat(Bool_t flag = true)
 When set to kTRUE, allows the histogram to expand if a bin outside the
 limits is added.
void Fill(Double_t )
{fContent = fContent+w; SetChanged(true);}
TH2Poly()
Int_t Fill(Double_t x, Double_t y)
Int_t Fill(Double_t x, Double_t y, Double_t w)
Int_t Fill(const char* name, Double_t w)
void FillN(Int_t ntimes, const Double_t* x, const Double_t* y, const Double_t* w, Int_t stride = 1)
TList * GetBins()
{return fBins;}
Double_t GetBinContent(Int_t bin) const
Double_t GetBinContent(Int_t , Int_t ) const
{return 0;}
Bool_t GetBinContentChanged() const
Double_t GetBinError(Int_t bin) const
Double_t GetBinError(Int_t , Int_t ) const
{return 0;}
Bool_t GetFloat()
{return fFloat;}
Bool_t GetNewBinAdded() const
{return fNewBinAdded;}
Int_t GetNumberOfBins() const
{return fNcells;}
Double_t Integral(Option_t* option = "") const
Double_t Integral(Int_t , Int_t , Option_t* ) const
{return 0;}
Double_t Integral(Int_t , Int_t , Int_t , Int_t , Option_t* ) const
{return 0;}
void SetBinContent(Int_t bin, Double_t content)
void SetBinContent(Int_t , Int_t , Double_t )
{return;}
void SetBinContentChanged(Bool_t flag)
void SetNewBinAdded(Bool_t flag)
{fNewBinAdded = flag;}