class TH1D: public TH1, public TArrayD


The Histogram classes

ROOT supports the following histogram types:
  • 1-D histograms:
    • TH1C : histograms with one byte per channel. Maximum bin content = 127
    • TH1S : histograms with one short per channel. Maximum bin content = 32767
    • TH1I : histograms with one int per channel. Maximum bin content = 2147483647
    • TH1F : histograms with one float per channel. Maximum precision 7 digits
    • TH1D : histograms with one double per channel. Maximum precision 14 digits
  • 2-D histograms:
    • TH2C : histograms with one byte per channel. Maximum bin content = 127
    • TH2S : histograms with one short per channel. Maximum bin content = 32767
    • TH2I : histograms with one int per channel. Maximum bin content = 2147483647
    • TH2F : histograms with one float per channel. Maximum precision 7 digits
    • TH2D : histograms with one double per channel. Maximum precision 14 digits
  • 3-D histograms:
    • TH3C : histograms with one byte per channel. Maximum bin content = 127
    • TH3S : histograms with one short per channel. Maximum bin content = 32767
    • TH3I : histograms with one int per channel. Maximum bin content = 2147483647
    • TH3F : histograms with one float per channel. Maximum precision 7 digits
    • TH3D : histograms with one double per channel. Maximum precision 14 digits
  • Profile histograms: See classes TProfile and TProfile2D. Profile histograms are used to display the mean value of Y and its RMS for each bin in X. Profile histograms are in many cases an elegant replacement of two-dimensional histograms : the inter-relation of two measured quantities X and Y can always be visualized by a two-dimensional histogram or scatter-plot; If Y is an unknown (but single-valued) approximate function of X, this function is displayed by a profile histogram with much better precision than by a scatter-plot.
All histogram classes are derived from the base class TH1
                                TH1
                                 ^
                                 |
                                 |
                                 |
         -----------------------------------------------------------
                |                |       |      |      |     |     |
                |                |      TH1C   TH1S   TH1I  TH1F  TH1D
                |                |                                 |
                |                |                                 |
                |               TH2                             TProfile
                |                |
                |                |
                |                ----------------------------------
                |                        |      |      |     |     |
                |                       TH2C   TH2S   TH2I  TH2F  TH2D
                |                                                  |
               TH3                                                 |
                |                                               TProfile2D
                |
                -------------------------------------
                        |      |      |      |      |
                       TH3C   TH3S   TH3I   TH3F   TH3D
      The TH*C classes also inherit from the array class TArrayC.
      The TH*S classes also inherit from the array class TArrayS.
      The TH*I classes also inherit from the array class TArrayI.
      The TH*F classes also inherit from the array class TArrayF.
      The TH*D classes also inherit from the array class TArrayD.

Creating histograms

Histograms are created by invoking one of the constructors, eg

       TH1F *h1 = new TH1F("h1","h1 title",100,0,4.4);
       TH2F *h2 = new TH2F("h2","h2 title",40,0,4,30,-3,3);

Histograms may also be created by:

  • calling the Clone function, see below
  • making a projection from a 2-D or 3-D histogram, see below
  • reading an histogram from a file

When an histogram is created, a reference to it is automatically added to the list of in-memory objects for the current file or directory. This default behaviour can be changed by:

       h->SetDirectory(0);          for the current histogram h
       TH1::AddDirectory(kFALSE);   sets a global switch disabling the reference
When the histogram is deleted, the reference to it is removed from the list of objects in memory. When a file is closed, all histograms in memory associated with this file are automatically deleted.

Fix or variable bin size

All histogram types support either fix or variable bin sizes. 2-D histograms may have fix size bins along X and variable size bins along Y or vice-versa. The functions to fill, manipulate, draw or access histograms are identical in both cases.

Each histogram always contains 3 objects TAxis: fXaxis, fYaxis and fZaxis To access the axis parameters, do:

        TAxis *xaxis = h->GetXaxis(); etc.
        Double_t binCenter = xaxis->GetBinCenter(bin), etc.
See class TAxis for a description of all the access functions. The axis range is always stored internally in double precision.

Convention for numbering bins

For all histogram types: nbins, xlow, xup
        bin = 0;       underflow bin
        bin = 1;       first bin with low-edge xlow INCLUDED
        bin = nbins;   last bin with upper-edge xup EXCLUDED
        bin = nbins+1; overflow bin

In case of 2-D or 3-D histograms, a "global bin" number is defined. For example, assuming a 3-D histogram with binx,biny,binz, the function

        Int_t gbin = h->GetBin(binx,biny,binz);
returns a global/linearized gbin number. This global gbin is useful to access the bin content/error information independently of the dimension. Note that to access the information other than bin content and errors one should use the TAxis object directly with eg:
         Double_t xcenter = h3->GetZaxis()->GetBinCenter(27);
returns the center along z of bin number 27 (not the global bin) in the 3-d histogram h3.

Alphanumeric Bin Labels

By default, an histogram axis is drawn with its numeric bin labels. One can specify alphanumeric labels instead with:
  • call TAxis::SetBinLabel(bin,label); This can always be done before or after filling. When the histogram is drawn, bin labels will be automatically drawn. See example in $ROOTSYS/tutorials/graphs/labels1.C, labels2.C
  • call to a Fill function with one of the arguments being a string, eg
               hist1->Fill(somename,weigth);
               hist2->Fill(x,somename,weight);
               hist2->Fill(somename,y,weight);
               hist2->Fill(somenamex,somenamey,weight);
    
    See example in $ROOTSYS/tutorials/hist/hlabels1.C, hlabels2.C
  • via TTree::Draw. see for example $ROOTSYS/tutorials/tree/cernstaff.C
               tree.Draw("Nation::Division");
    
    where "Nation" and "Division" are two branches of a Tree.

When using the options 2 or 3 above, the labels are automatically added to the list (THashList) of labels for a given axis. By default, an axis is drawn with the order of bins corresponding to the filling sequence. It is possible to reorder the axis - alphabetically - by increasing or decreasing values The reordering can be triggered via the TAxis contextMenu by selecting the menu item "LabelsOption" or by calling directly TH1::LabelsOption(option,axis) where

  • axis may be "X","Y" or "Z"
  • option may be:
    • "a" sort by alphabetic order
    • ">" sort by decreasing values
    • "<" sort by increasing values
    • "h" draw labels horizonthal
    • "v" draw labels vertical
    • "u" draw labels up (end of label right adjusted)
    • "d" draw labels down (start of label left adjusted)

When using the option 2 above, new labels are added by doubling the current number of bins in case one label does not exist yet. When the Filling is terminated, it is possible to trim the number of bins to match the number of active labels by calling

           TH1::LabelsDeflate(axis) with axis = "X","Y" or "Z"
This operation is automatic when using TTree::Draw. Once bin labels have been created, they become persistent if the histogram is written to a file or when generating the C++ code via SavePrimitive.

Histograms with automatic bins

When an histogram is created with an axis lower limit greater or equal to its upper limit, the SetBuffer is automatically called with an argument fBufferSize equal to fgBufferSize (default value=1000). fgBufferSize may be reset via the static function TH1::SetDefaultBufferSize. The axis limits will be automatically computed when the buffer will be full or when the function BufferEmpty is called.

Filling histograms

An histogram is typically filled with statements like:
       h1->Fill(x);
       h1->Fill(x,w); fill with weight
       h2->Fill(x,y)
       h2->Fill(x,y,w)
       h3->Fill(x,y,z)
       h3->Fill(x,y,z,w)
or via one of the Fill functions accepting names described above. The Fill functions compute the bin number corresponding to the given x,y or z argument and increment this bin by the given weight. The Fill functions return the bin number for 1-D histograms or global bin number for 2-D and 3-D histograms.

If TH1::Sumw2 has been called before filling, the sum of squares of weights is also stored. One can also increment directly a bin number via TH1::AddBinContent or replace the existing content via TH1::SetBinContent. To access the bin content of a given bin, do:

       Double_t binContent = h->GetBinContent(bin);

By default, the bin number is computed using the current axis ranges. If the automatic binning option has been set via

       h->SetBit(TH1::kCanRebin);
then, the Fill Function will automatically extend the axis range to accomodate the new value specified in the Fill argument. The method used is to double the bin size until the new value fits in the range, merging bins two by two. This automatic binning options is extensively used by the TTree::Draw function when histogramming Tree variables with an unknown range.

This automatic binning option is supported for 1-d, 2-D and 3-D histograms. During filling, some statistics parameters are incremented to compute the mean value and Root Mean Square with the maximum precision.

In case of histograms of type TH1C, TH1S, TH2C, TH2S, TH3C, TH3S a check is made that the bin contents do not exceed the maximum positive capacity (127 or 32767). Histograms of all types may have positive or/and negative bin contents.

Rebinning

At any time, an histogram can be rebinned via TH1::Rebin. This function returns a new histogram with the rebinned contents. If bin errors were stored, they are recomputed during the rebinning.

Associated errors

By default, for each bin, the sum of weights is computed at fill time. One can also call TH1::Sumw2 to force the storage and computation of the sum of the square of weights per bin. If Sumw2 has been called, the error per bin is computed as the sqrt(sum of squares of weights), otherwise the error is set equal to the sqrt(bin content). To return the error for a given bin number, do:
        Double_t error = h->GetBinError(bin);

Associated functions

One or more object (typically a TF1*) can be added to the list of functions (fFunctions) associated to each histogram. When TH1::Fit is invoked, the fitted function is added to this list. Given an histogram h, one can retrieve an associated function with:
        TF1 *myfunc = h->GetFunction("myfunc");

Operations on histograms

Many types of operations are supported on histograms or between histograms
  • Addition of an histogram to the current histogram
  • Additions of two histograms with coefficients and storage into the current histogram
  • Multiplications and Divisions are supported in the same way as additions.
  • The Add, Divide and Multiply functions also exist to add,divide or multiply an histogram by a function.
If an histogram has associated error bars (TH1::Sumw2 has been called), the resulting error bars are also computed assuming independent histograms. In case of divisions, Binomial errors are also supported. One can mark a histogram to be an "average" histogram by setting its bit kIsAverage via myhist.SetBit(TH1::kIsAverage); When adding (see TH1::Add) average histograms, the histograms are averaged and not summed.

Fitting histograms

Histograms (1-D,2-D,3-D and Profiles) can be fitted with a user specified function via TH1::Fit. When an histogram is fitted, the resulting function with its parameters is added to the list of functions of this histogram. If the histogram is made persistent, the list of associated functions is also persistent. Given a pointer (see above) to an associated function myfunc, one can retrieve the function/fit parameters with calls such as:
       Double_t chi2 = myfunc->GetChisquare();
       Double_t par0 = myfunc->GetParameter(0); value of 1st parameter
       Double_t err0 = myfunc->GetParError(0);  error on first parameter

Projections of histograms

One can:

  • make a 1-D projection of a 2-D histogram or Profile see functions TH2::ProjectionX,Y, TH2::ProfileX,Y, TProfile::ProjectionX
  • make a 1-D, 2-D or profile out of a 3-D histogram see functions TH3::ProjectionZ, TH3::Project3D.

One can fit these projections via:

      TH2::FitSlicesX,Y, TH3::FitSlicesZ.

Random Numbers and histograms

TH1::FillRandom can be used to randomly fill an histogram using the contents of an existing TF1 function or another TH1 histogram (for all dimensions).

For example the following two statements create and fill an histogram 10000 times with a default gaussian distribution of mean 0 and sigma 1:

       TH1F h1("h1","histo from a gaussian",100,-3,3);
       h1.FillRandom("gaus",10000);
TH1::GetRandom can be used to return a random number distributed according the contents of an histogram.

Making a copy of an histogram

Like for any other ROOT object derived from TObject, one can use the Clone() function. This makes an identical copy of the original histogram including all associated errors and functions, e.g.:
       TH1F *hnew = (TH1F*)h->Clone("hnew");

Normalizing histograms

One can scale an histogram such that the bins integral is equal to the normalization parameter via TH1::Scale(Double_t norm), where norm is the desired normalization divided by the integral of the histogram.

Drawing histograms

Histograms are drawn via the THistPainter class. Each histogram has a pointer to its own painter (to be usable in a multithreaded program). Many drawing options are supported. See THistPainter::Paint() for more details.

The same histogram can be drawn with different options in different pads. When an histogram drawn in a pad is deleted, the histogram is automatically removed from the pad or pads where it was drawn. If an histogram is drawn in a pad, then filled again, the new status of the histogram will be automatically shown in the pad next time the pad is updated. One does not need to redraw the histogram. To draw the current version of an histogram in a pad, one can use

        h->DrawCopy();
This makes a clone (see Clone below) of the histogram. Once the clone is drawn, the original histogram may be modified or deleted without affecting the aspect of the clone.

One can use TH1::SetMaximum() and TH1::SetMinimum() to force a particular value for the maximum or the minimum scale on the plot.

TH1::UseCurrentStyle() can be used to change all histogram graphics attributes to correspond to the current selected style. This function must be called for each histogram. In case one reads and draws many histograms from a file, one can force the histograms to inherit automatically the current graphics style by calling before gROOT->ForceStyle().

Setting Drawing histogram contour levels (2-D hists only)

By default contours are automatically generated at equidistant intervals. A default value of 20 levels is used. This can be modified via TH1::SetContour() or TH1::SetContourLevel(). the contours level info is used by the drawing options "cont", "surf", and "lego".

Setting histogram graphics attributes

The histogram classes inherit from the attribute classes: TAttLine, TAttFill, TAttMarker and TAttText. See the member functions of these classes for the list of options.

Giving titles to the X, Y and Z axis

       h->GetXaxis()->SetTitle("X axis title");
       h->GetYaxis()->SetTitle("Y axis title");
The histogram title and the axis titles can be any TLatex string. The titles are part of the persistent histogram. It is also possible to specify the histogram title and the axis titles at creation time. These titles can be given in the "title" parameter. They must be separated by ";":
        TH1F* h=new TH1F("h","Histogram title;X Axis;Y Axis;Z Axis",100,0,1);
Any title can be omitted:
        TH1F* h=new TH1F("h","Histogram title;;Y Axis",100,0,1);
        TH1F* h=new TH1F("h",";;Y Axis",100,0,1);
The method SetTitle has the same syntax:

        h->SetTitle("Histogram title;An other X title Axis");

Saving/Reading histograms to/from a ROOT file

The following statements create a ROOT file and store an histogram on the file. Because TH1 derives from TNamed, the key identifier on the file is the histogram name:
        TFile f("histos.root","new");
        TH1F h1("hgaus","histo from a gaussian",100,-3,3);
        h1.FillRandom("gaus",10000);
        h1->Write();
To Read this histogram in another Root session, do:
        TFile f("histos.root");
        TH1F *h = (TH1F*)f.Get("hgaus");
One can save all histograms in memory to the file by:
        file->Write();

Miscelaneous operations

        TH1::KolmogorovTest(): statistical test of compatibility in shape
                             between two histograms
        TH1::Smooth() smooths the bin contents of a 1-d histogram
        TH1::Integral() returns the integral of bin contents in a given bin range
        TH1::GetMean(int axis) returns the mean value along axis
        TH1::GetRMS(int axis)  returns the sigma distribution along axis
        TH1::GetEntries() returns the number of entries
        TH1::Reset() resets the bin contents and errors of an histogram
 

Function Members (Methods)

public:
TH1D()
TH1D(const TVectorD& v)
TH1D(const TH1D& h1d)
TH1D(const char* name, const char* title, Int_t nbinsx, const Float_t* xbins)
TH1D(const char* name, const char* title, Int_t nbinsx, const Double_t* xbins)
TH1D(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup)
virtual~TH1D()
voidTObject::AbstractMethod(const char* method) const
virtual voidTH1::Add(const TH1* h1, Double_t c1 = 1)
virtual voidTH1::Add(TF1* h1, Double_t c1 = 1, Option_t* option = "")
virtual voidTH1::Add(const TH1* h, const TH1* h2, Double_t c1 = 1, Double_t c2 = 1)MENU
voidTArrayD::AddAt(Double_t c, Int_t i)
virtual voidAddBinContent(Int_t bin)
virtual voidAddBinContent(Int_t bin, Double_t w)
static voidTH1::AddDirectory(Bool_t add = kTRUE)
static Bool_tTH1::AddDirectoryStatus()
voidTArrayD::Adopt(Int_t n, Double_t* array)
virtual voidTObject::AppendPad(Option_t* option = "")
Double_tTArrayD::At(Int_t i) const
virtual voidTH1::Browse(TBrowser* b)
virtual Int_tTH1::BufferEmpty(Int_t action = 0)
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
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual Double_tTH1::ComputeIntegral()
virtual voidCopy(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 voidTH1::Divide(const TH1* h1)
virtual voidTH1::Divide(TF1* f1, Double_t c1 = 1)
virtual voidTH1::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_tTH1::Fill(Double_t x)
virtual Int_tTH1::Fill(Double_t x, Double_t w)
virtual Int_tTH1::Fill(const char* name, Double_t w)
virtual voidTNamed::FillBuffer(char*& buffer)
virtual voidTH1::FillN(Int_t ntimes, const Double_t* x, const Double_t* w, Int_t stride = 1)
virtual voidTH1::FillN(Int_t, const Double_t*, const Double_t*, const Double_t*, Int_t)
virtual voidTH1::FillRandom(const char* fname, Int_t ntimes = 5000)
virtual voidTH1::FillRandom(TH1* h, Int_t ntimes = 5000)
virtual Int_tTH1::FindBin(Double_t x, Double_t y = 0, Double_t z = 0)
virtual TObject*TH1::FindObject(const char* name) const
virtual TObject*TH1::FindObject(const TObject* obj) const
virtual Int_tTH1::Fit(const char* formula, Option_t* option = "", Option_t* goption = "", Double_t xmin = 0, Double_t xmax = 0)MENU
virtual Int_tTH1::Fit(TF1* f1, Option_t* option = "", Option_t* goption = "", Double_t xmin = 0, Double_t xmax = 0)
virtual voidTH1::FitPanel()MENU
const Double_t*TArrayD::GetArray() const
Double_t*TArrayD::GetArray()
TH1*TH1::GetAsymmetry(TH1* h2, Double_t c2 = 1, Double_t dc2 = 0)
virtual Double_tTArrayD::GetAt(Int_t i) const
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 bin, Int_t) const
virtual Double_tGetBinContent(Int_t bin, Int_t, Int_t) const
virtual Double_tTH1::GetBinError(Int_t bin) const
virtual Double_tTH1::GetBinError(Int_t binx, Int_t biny) const
virtual Double_tTH1::GetBinError(Int_t binx, Int_t biny, Int_t binz) const
virtual Double_tTH1::GetBinLowEdge(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 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
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
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
virtual Double_tTH1::GetMaximum(Double_t maxval = FLT_MAX) 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
virtual Double_tTH1::GetMinimum(Double_t minval = -FLT_MAX) 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
virtual Double_tTH1::GetNormFactor() 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 Double_tTH1::GetRMS(Int_t axis = 1) const
virtual Double_tTH1::GetRMSError(Int_t axis = 1) const
Int_tTArray::GetSize() const
virtual Double_tTH1::GetSkewness(Int_t axis = 1) const
virtual voidTH1::GetStats(Double_t* stats) const
Stat_tTArrayD::GetSum() 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
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_tTH1::Integral(Option_t* option = "") const
virtual Double_tTH1::Integral(Int_t binx1, Int_t binx2, Option_t* option = "") const
virtual Double_tTH1::Integral(Int_t, Int_t, Int_t, Int_t, Option_t* = "") const
virtual Double_tTH1::Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t* = "") const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() 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_tTH1::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_tTH1::Merge(TCollection* list)
virtual voidTAttLine::Modify()
virtual voidTH1::Multiply(const TH1* h1)
virtual voidTH1::Multiply(TF1* h1, Double_t c1 = 1)
virtual voidTH1::Multiply(const TH1* h1, const TH1* h2, Double_t c1 = 1, Double_t c2 = 1, Option_t* option = "")MENU
virtual Bool_tTObject::Notify()
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)
TH1D&operator=(const TH1D& h1)
Double_t&TArrayD::operator[](Int_t i)
Double_tTArrayD::operator[](Int_t i) const
virtual voidTH1::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTH1::Print(Option_t* option = "") const
virtual voidTH1::PutStats(Double_t* stats)
virtual Int_tTObject::Read(const char* name)
static TArray*TArray::ReadArray(TBuffer& b, const TClass* clReq)
virtual TH1*TH1::Rebin(Int_t ngroup = 2, const char* newname = "", const Double_t* xbins = 0)MENU
virtual voidTH1::RebinAxis(Double_t x, TAxis* axis)
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 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 voidTH1::SavePrimitive(ostream& out, Option_t* option = "")
virtual voidTH1::Scale(Double_t c1 = 1, Option_t* option = "")
virtual voidTArrayD::Set(Int_t n)
voidTArrayD::Set(Int_t n, const Double_t* array)
virtual voidTArrayD::SetAt(Double_t v, Int_t i)
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 bin, Int_t, Double_t content)
virtual voidSetBinContent(Int_t bin, Int_t, Int_t, Double_t content)
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::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, 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 voidSetBinsLength(Int_t n = -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::SetFillStyle(Style_t fstyle)
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::SetLineStyle(Style_t lstyle)
virtual voidTAttLine::SetLineWidth(Width_t lwidth)
virtual voidTAttMarker::SetMarkerAttributes()MENU
virtual voidTAttMarker::SetMarkerColor(Color_t tcolor = 1)
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")
virtual voidTH1::SetNormFactor(Double_t factor = 1)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTH1::SetOption(Option_t* option = " ")
virtual voidTH1::SetStats(Bool_t stats = kTRUE)
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*TH1::ShowBackground(Int_t niter = 20, Option_t* option = "same")MENU
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTH1::ShowPeaks(Double_t sigma = 2, Option_t* option = "", Double_t threshold = 0.05)MENU
virtual Int_tTNamed::Sizeof() const
virtual voidTH1::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& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTH1::Sumw2()
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
static voidTArray::WriteArray(TBuffer& b, const TArray* a)
protected:
Bool_tTArray::BoundsOk(const char* where, Int_t at) const
virtual Int_tTH1::BufferFill(Double_t x, Double_t w)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual Bool_tTH1::FindNewAxisLimits(const TAxis* axis, const Double_t point, Double_t& newMin, Double_t& newMax)
voidTObject::MakeZombie()
Bool_tTArray::OutOfBoundsError(const char* where, Int_t i) const
static Bool_tTH1::RecomputeAxisLimits(TAxis& destAxis, const TAxis& anAxis)
static Bool_tTH1::SameLimitsAndNBins(const TAxis& axis1, const TAxis& axis2)
virtual voidTH1::SavePrimitiveHelp(ostream& out, Option_t* option = "")

Data Members

public:
enum TH1::[unnamed] { kNoStats
kUserContour
kCanRebin
kLogX
kIsZoomed
kNoTitle
kIsAverage
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
public:
Double_t*TArrayD::fArray[fN] Array of fN doubles
Int_tTArray::fNNumber of array elements
protected:
Short_tTH1::fBarOffset(1000*offset) for bar charts or legos
Short_tTH1::fBarWidth(1000*width) for bar charts or legos
Double_t*TH1::fBuffer[fBufferSize] entry buffer
Int_tTH1::fBufferSizefBuffer size
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
TList*TH1::fFunctions->Pointer to list of functions (fits and user)
Double_t*TH1::fIntegral!Integral of bins used by GetRandom
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
TStringTNamed::fNameobject identifier
Int_tTH1::fNcellsnumber of bins(1D), cells (2D) +U/Overflows
Double_tTH1::fNormFactorNormalization factor
TStringTH1::fOptionhistogram options
TVirtualHistPainter*TH1::fPainter!pointer to histogram painter
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
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

TH1D()
 Constructor.
TH1D(const char* name, const char* title, Int_t nbinsx, Double_t xlow, Double_t xup)
    Create a 1-Dim histogram with fix bins of type double

           (see TH1::TH1 for explanation of parameters)

TH1D(const char *name,const char *title,Int_t nbins,const Float_t *xbins)
    Create a 1-Dim histogram with variable bins of type double

           (see TH1::TH1 for explanation of parameters)

TH1D(const char *name,const char *title,Int_t nbins,const Double_t *xbins)
    Create a 1-Dim histogram with variable bins of type double

           (see TH1::TH1 for explanation of parameters)

TH1D(const TVectorD &v)
 Create a histogram from a TVectorD
 by default the histogram name is "TVectorD" and title = ""
~TH1D()
 Destructor.
TH1D(const TH1D &h1d)
 Constructor.
void Copy(TObject& hnew) const
 Copy this to newth1
TH1 * DrawCopy(Option_t* option = "") const
 Draw copy.
Double_t GetBinContent(Int_t bin) const
 see convention for numbering bins in TH1::GetBin
void Reset(Option_t* option = "")
 Reset.
void SetBinContent(Int_t bin, Double_t content)
 Set bin content
 see convention for numbering bins in TH1::GetBin
 In case the bin number is greater than the number of bins and
 the timedisplay option is set or the kCanRebin bit is set,
 the number of bins is automatically doubled to accomodate the new bin
void SetBinsLength(Int_t n = -1)
 Set total number of bins including under/overflow
 Reallocate bin contents array
TH1D& operator=(const TH1D& h1)
 Operator =
void AddBinContent(Int_t bin)
void AddBinContent(Int_t bin, Double_t w)
Double_t GetBinContent(Int_t bin) const
Double_t GetBinContent(Int_t bin, Int_t ) const
void SetBinContent(Int_t bin, Double_t content)
void SetBinContent(Int_t bin, Int_t , Double_t content)

Author: Rene Brun 26/12/94
Last change: root/hist:$Id: TH1.h 22992 2008-04-05 09:43:01Z pcanal $
Last generated: 2008-06-25 08:46
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.