TH1
class description - source file - inheritance tree
private:
Int_t AxisChoice(Option_t* axis)
void Build()
Int_t FitOptionsMake(Option_t* option)
protected:
virtual void Copy(TObject& hnew)
public:
TH1 TH1()
TH1 TH1(const char* name, const char* title, Int_t nbinsx, Axis_t xlow, Axis_t xup)
TH1 TH1(const char* name, const char* title, Int_t nbinsx, Axis_t* xbins)
TH1 TH1(TH1&)
virtual void ~TH1()
virtual void Add(TH1* h1, Float_t c1 = 1)
virtual void Add(TH1* h1, TH1* h2, Float_t c1 = 1, Float_t c2 = 1)
virtual void AddBinContent(Int_t bin)
virtual void AddBinContent(Int_t bin, Stat_t w)
static void AddDirectory(Bool_t add = kTRUE)
virtual void Browse(TBrowser* b)
static TClass* Class()
virtual Double_t ComputeIntegral()
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual void Divide(TH1* h1)
virtual void Divide(TH1* h1, TH1* h2, Float_t c1 = 1, Float_t c2 = 1, Option_t* option)
virtual void Draw(Option_t* option)
virtual TH1* DrawCopy(Option_t* option)
virtual void DrawPanel()
virtual void Eval(TF1* f1, Option_t* option)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual Int_t Fill(Axis_t x)
virtual Int_t Fill(Axis_t x, Stat_t w)
virtual void FillN(Int_t ntimes, Axis_t* x, Double_t* w, Int_t stride = 1)
virtual void FillN(Int_t, Axis_t*, Axis_t*, Double_t*, Int_t)
virtual void FillRandom(const char* fname, Int_t ntimes = 5000)
virtual void FillRandom(TH1* h, Int_t ntimes = 5000)
virtual Int_t FindBin(Axis_t x, Axis_t y = 0, Axis_t z = 0)
virtual void Fit(const char* formula, Option_t* option, Option_t* goption, Float_t xmin = 0, Float_t xmax = 0)
virtual void FitPanel()
virtual Color_t GetAxisColor(Option_t* axis = X)
virtual Float_t GetBarOffset()
virtual Float_t GetBarWidth()
virtual Int_t GetBin(Int_t binx, Int_t biny = 0, Int_t binz = 0)
virtual Axis_t GetBinCenter(Int_t bin)
virtual Stat_t GetBinContent(Int_t bin)
virtual Stat_t GetBinError(Int_t bin)
virtual Axis_t GetBinLowEdge(Int_t bin)
virtual Axis_t GetBinWidth(Int_t bin)
virtual Stat_t GetCellContent(Int_t binx, Int_t biny)
virtual Stat_t GetCellError(Int_t binx, Int_t biny)
virtual void GetCenter(Axis_t* center)
virtual Int_t GetContour(Float_t* levels = 0)
virtual Float_t GetContourLevel(Int_t level)
virtual Int_t GetDimension() const
TDirectory* GetDirectory()
virtual Stat_t GetEntries()
virtual TF1* GetFunction(const char* name)
virtual Double_t* GetIntegral()
virtual Color_t GetLabelColor(Option_t* axis = X)
virtual Style_t GetLabelFont(Option_t* axis = X)
virtual Float_t GetLabelOffset(Option_t* axis = X)
virtual Float_t GetLabelSize(Option_t* axis = X)
TList* GetListOfFunctions()
virtual void GetLowEdge(Axis_t* edge)
virtual Float_t GetMaximum()
virtual Int_t GetMaximumBin()
virtual Int_t GetMaximumBin(Int_t& locmax, Int_t& locmay, Int_t& locmaz)
virtual Float_t GetMaximumStored()
virtual Stat_t GetMean(Int_t axis = 1)
virtual Float_t GetMinimum()
virtual Int_t GetMinimumBin()
virtual Int_t GetMinimumBin(Int_t& locmix, Int_t& locmiy, Int_t& locmiz)
virtual Float_t GetMinimumStored()
virtual Int_t GetNbinsX() const
virtual Int_t GetNbinsY() const
virtual Int_t GetNbinsZ() const
virtual Int_t GetNdivisions(Option_t* axis = X)
virtual Float_t GetNormFactor()
virtual char* GetObjectInfo(Int_t px, Int_t py)
virtual Option_t* GetOption() const
TVirtualHistPainter* GetPainter()
virtual Axis_t GetRandom()
virtual Stat_t GetRMS(Int_t axis = 1)
virtual void GetStats(Stat_t* stats)
virtual Stat_t GetSumOfWeights()
virtual Int_t GetSumw2N()
virtual Float_t GetTickLength(Option_t* axis = X)
virtual Float_t GetTitleOffset(Option_t* axis = X)
virtual Float_t GetTitleSize(Option_t* axis = X)
virtual TAxis* GetXaxis()
virtual TAxis* GetYaxis()
virtual TAxis* GetZaxis()
virtual Stat_t Integral()
virtual Stat_t Integral(Int_t binx1, Int_t binx2)
virtual Stat_t Integral(Int_t, Int_t, Int_t, Int_t)
virtual Stat_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t)
virtual TClass* IsA() const
virtual void Multiply(TH1* h1)
virtual void Multiply(TH1* h1, TH1* h2, Float_t c1 = 1, Float_t c2 = 1, Option_t* option)
virtual void Paint(Option_t* option)
virtual void Print(Option_t* option)
virtual void PutStats(Stat_t* stats)
TH1* Rebin(Int_t ngroup = 2, const char* newname)
virtual void RebinAxis(Axis_t x, Option_t* axis = X)
virtual void Reset(Option_t* option)
virtual void SavePrimitive(ofstream& out, Option_t* option)
virtual void Scale(Float_t c1 = 1)
virtual void SetAxisColor(Color_t color = 1, Option_t* axis = X)
virtual void SetAxisRange(Float_t xmin, Float_t xmax, Option_t* axis = X)
virtual void SetBarOffset(Float_t offset = 0.25)
virtual void SetBarWidth(Float_t width = 0.5)
virtual void SetBinContent(Int_t bin, Stat_t content)
virtual void SetBinError(Int_t bin, Stat_t error)
virtual void SetBins(Int_t nx, Float_t xmin, Float_t xmax)
virtual void SetBins(Int_t nx, Float_t xmin, Float_t xmax, Int_t ny, Float_t ymin, Float_t ymax)
virtual void SetBins(Int_t nx, Float_t xmin, Float_t xmax, Int_t ny, Float_t ymin, Float_t ymax, Int_t nz, Float_t zmin, Float_t zmax)
virtual void SetBinsLength(Int_t)
virtual void SetCellContent(Int_t binx, Int_t biny, Stat_t content)
virtual void SetCellError(Int_t binx, Int_t biny, Stat_t content)
virtual void SetContent(Stat_t* content)
virtual void SetContour(Int_t nlevels, Float_t* levels = 0)
virtual void SetContourLevel(Int_t level, Float_t value)
virtual void SetDirectory(TDirectory* dir)
virtual void SetEntries(Stat_t n)
virtual void SetError(Stat_t* error)
virtual void SetLabelColor(Color_t color = 1, Option_t* axis = X)
virtual void SetLabelFont(Style_t font = 62, Option_t* axis = X)
virtual void SetLabelOffset(Float_t offset = 0.005, Option_t* axis = X)
virtual void SetLabelSize(Float_t size = 0.02, Option_t* axis = X)
virtual void SetMaximum(Float_t maximum = -1111)
virtual void SetMinimum(Float_t minimum = -1111)
virtual void SetName(const char* name)
virtual void SetNdivisions(Int_t n = 510, Option_t* axis = X)
virtual void SetNormFactor(Float_t factor = 1)
virtual void SetObject(const char* name, const char* title)
virtual void SetOption(Option_t* option = )
virtual void SetStats(Bool_t stats = kTRUE)
virtual void SetTickLength(Float_t length = 0.02, Option_t* axis = X)
virtual void SetTitleOffset(Float_t offset = 1, Option_t* axis = X)
virtual void SetTitleSize(Float_t size = 0.02, Option_t* axis = X)
virtual void SetXTitle(char* title)
virtual void SetYTitle(char* title)
virtual void SetZTitle(char* title)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Smooth(Int_t ntimes = 1)
static void SmoothArray(Int_t NN, Double_t* XX, Int_t ntimes = 1)
static Double_t SmoothMedian(Int_t n, Double_t* a)
virtual void Streamer(TBuffer& b)
virtual void Sumw2()
virtual void UseCurrentStyle()
protected:
Int_t fNcells number of bins(1D), cells (2D) +U/Overflows
TAxis fXaxis X axis descriptor
TAxis fYaxis Y axis descriptor
TAxis fZaxis Z axis descriptor
Short_t fBarOffset (1000*offset) for bar charts or legos
Short_t fBarWidth (1000*width) for bar charts or legos
Stat_t fEntries Number of entries
Stat_t fTsumw Total Sum of weights
Stat_t fTsumw2 Total Sum of squares of weights
Stat_t fTsumwx Total Sum of weight*X
Stat_t fTsumwx2 Total Sum of weight*X*X
Float_t fMaximum Maximum value for plotting
Float_t fMinimum Minimum value for plotting
Float_t fNormFactor Normalization factor
TArrayF fContour Array to display contour levels
TArrayD fSumw2 Array of sum of squares of weights
TString fOption histogram options
TList* fFunctions Pointer to list of functions (fits and user)
TDirectory* fDirectory Pointer to directory holding this histogram
Int_t fDimension Histogram dimension (1, 2 or 3 dim)
Double_t* fIntegral Integral of bins used by GetRandom
TVirtualHistPainter* fPainter pointer to histogram painter
static Bool_t fgAddDirectory !flag to add histograms to the directory
public:
static const enum TObject:: kNoStats
static const enum TObject:: kUserContour
static const enum TObject:: kCanRebin
static const enum TObject:: kLogX
See also
-
TH1C, TH1D, TH1F, TH1S, TH2, TH3
*-*-*-*-*-*-*-*-*-*-*The H I S T O G R A M Classes*-*-*-*-*-*-*-*-*-*-*-*
*-* ===============================
*-*
*-* ROOT supports the following histogram types:
*-*
*-* 1-D histograms:
*-* TH1C : histograms with one byte per channel. Maximum bin content = 255
*-* TH1S : histograms with one short per channel. Maximum bin content = 65535
*-* 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 = 255
*-* TH2S : histograms with one short per channel. Maximum bin content = 65535
*-* 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 = 255
*-* TH3S : histograms with one short per channel. Maximum bin content = 65535
*-* 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 class TProfile
*-*
*-*- All histogram classes are derived from the base class TH1
*-*
*-* TH1
*-* ^
*-* |
*-* |
*-* |
*-* -----------------------------------------------------
*-* | | | | | |
*-* | | TH1C TH1S TH1F TH1D
*-* | | |
*-* | | |
*-* | TH2 TProfile
*-* | |
*-* | |
*-* | ------------------------------
*-* | | | | |
*-* | TH2C TH2S TH2F TH2D
*-* |
*-* TH3
*-* |
*-* |
*-* ------------------------------
*-* | | | |
*-* TH3C TH3S 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*F classes also inherit from the array class TArrayF.
*-* The TH*D classes also inherit from the array class TArrayD.
*-*
*-* 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
*-*
*-* 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).
*-*
*-* Associated functions
*-* ====================
*-* One or more object (typically a TF1*) can be added to the list
*-* of functions (fFunctions) associated to each histogram.
*-* When TF1::Fit is invoked, the fitted function is added to this list.
*-*
*-*
/*
*/
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
TH1(): TNamed(), TAttLine(), TAttFill(), TAttMarker()
*-*-*-*-*-*-*-*-*-*-*Histogram default constructor*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =============================
~TH1()
*-*-*-*-*-*-*-*-*-*-*Histogram default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ============================
TH1(const char *name,const char *title,Int_t nbins,Axis_t xlow,Axis_t xup)
:TNamed(name,title), TAttLine(), TAttFill(), TAttMarker()
*-*-*-*-*-*-*-*-*Normal constructor for fix bin size histograms*-*-*-*-*-*-*
*-* ==============================================
Creates the main histogram structure:
name : name of histogram (avoid blanks)
title : histogram title
nbins : number of bins
xlow : low edge of first bin
xup : upper edge of last bin (not included in last bin)
When an histogram is created, it is automatically added to the list
of special objects in the current directory.
To find the pointer to this histogram in the current directory
by its name, do:
TH1F *h1 = (TH1F*)gDirectory->FindObject(name);
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
TH1(const char *name,const char *title,Int_t nbins,Axis_t *xbins)
:TNamed(name,title), TAttLine(), TAttFill(), TAttMarker()
*-*-*-*-*-*-*Normal constructor for variable bin size histograms*-*-*-*-*-*-*
*-* ===================================================
Creates the main histogram structure:
name : name of histogram (avoid blanks)
title : histogram title
nbins : number of bins
xbins : array of low-edges for each bin
This is an array of size nbins+1
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void Browse(TBrowser *)
void Build()
*-*-*-*-*-*-*-*-*-*Creates histogram basic data structure*-*-*-*-*-*-*-*-*-*
*-* ======================================
void Add(TH1 *h1, Float_t c1)
Performs the operation: this = this + c1*h1
if errors are defined (see TH1::Sumw2), errors are also recalculated.
Note that if h1 has Sumw2 set, Sumw2 is automatically called for this
if not already set.
void Add(TH1 *h1, TH1 *h2, Float_t c1, Float_t c2)
*-*-*-*-*Replace contents of this histogram by the addition of h1 and h2*-*-*
*-* ===============================================================
this = c1*h1 + c2*h2
if errors are defined (see TH1::Sumw2), errors are also recalculated
Note that if h1 or h2 have Sumw2 set, Sumw2 is automatically called for this
if not already set.
void AddBinContent(Int_t)
*-*-*-*-*-*-*-*-*-*Increment bin content by 1*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==========================
void AddBinContent(Int_t, Stat_t)
*-*-*-*-*-*-*-*-*-*Increment bin content by a weight w*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
void AddDirectory(Bool_t add)
Sets the flag controlling the automatic add of histograms in memory
By default (fAddDirectory = kTRUE), histograms are automatically added
to the list of objects in memory.
Note that one histogram can be removed from its support directory
by calling h->SetDirectory(0) or h->SetDirectory(dir) to add it
to the list of objects in the directory dir.
NOTE that this is a static function. To call it, use;
TH1::AddDirectory
Double_t ComputeIntegral()
Compute integral (cumulative sum of bins)
The result stored in fIntegral is used by the GetRandom functions.
This function is automatically called by GetRandom when the fIntegral
array does not exist or when the number of entries in the histogram
has changed since the previous call to GetRandom.
The resulting integral is normalized to 1
void Copy(TObject &obj)
*-*-*-*-*-*-*Copy this histogram structure to newth1*-*-*-*-*-*-*-*-*-*-*-*
*-* =======================================
Note that this function does not copy the list of associated functions.
Use TObJect::Clone to make a full copy of an histogram.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a line*-*-*-*-*-*
*-* ===========================================
*-* Compute the closest distance of approach from point px,py to elements
*-* of an histogram.
*-* The distance is computed in pixels units.
*-*
*-* Algorithm:
*-* Currently, this simple model computes the distance from the mouse
*-* to the histogram contour only.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void Divide(TH1 *h1)
*-*-*-*-*-*-*-*-*-*-*Divide this histogram by h1*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===========================
this = this/h1
if errors are defined (see TH1::Sumw2), errors are also recalculated.
Note that if h1 has Sumw2 set, Sumw2 is automatically called for this
if not already set.
void Divide(TH1 *h1, TH1 *h2, Float_t c1, Float_t c2, Option_t *option)
*-*-*-*-*Replace contents of this histogram by the division of h1 by h2*-*-*
*-* ==============================================================
this = c1*h1/(c2*h2)
if errors are defined (see TH1::Sumw2), errors are also recalculated
Note that if h1 or h2 have Sumw2 set, Sumw2 is automatically called for this
if not already set.
void Draw(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*Draw this histogram with options*-*-*-*-*-*-*-*-*-*-*-*
*-* ================================
*-*
*-* This histogram is added in the list of objects to be drawn in the
*-* current pad.
*-* It is important to note that only a reference to this histogram is added.
*-* This means that if the histogram contents change between pad redraws,
*-* the current histogram contents will be shown.
*-* Use function DrawCopy to force a copy of the histogram at the time
*-* of the Draw operation in the Pad list.
*-*
*-* The following options are supported on all types:
*-* "AXIS" : Draw only axis
*-* "HIST" : Draw only histo contour. (if histo has errors, errors are not drawn)
*-* "SAME" : Superimpose on previous picture in the same pad
*-* "CYL" : Use Cylindrical coordinates
*-* "POL" : Use Polar coordinates
*-* "SPH" : Use Spherical coordinates
*-* "PSR" : Use PseudoRapidity/Phi coordinates
*-* "LEGO" : Draw a lego plot with hidden line removal
*-* "LEGO1" : Draw a lego plot with hidden surface removal
*-* "LEGO2" : Draw a lego plot using colors to show the cell contents
*-* "SURF" : Draw a surface plot with hidden line removal
*-* "SURF1" : Draw a surface plot with hidden surface removal
*-* "SURF2" : Draw a surface plot using colors to show the cell contents
*-* "SURF3" : same as SURF with in addition a contour view drawn on the top
*-* "SURF4" : Draw a surface using Gouraud shading
*-*
*-* The following options are supported for 1-D types:
*-* "AH" : Draw histogram, but not the axis labels and tick marks
*-* "B" : Bar chart option
*-* "C" : Draw a smooth Curve througth the histogram bins
*-* "E" : Draw error bars
*-* "E0" : Draw error bars including bins with o contents
*-* "E1" : Draw error bars with perpendicular lines at the edges
*-* "E2" : Draw error bars with rectangles
*-* "E3" : Draw a fill area througth the end points of the vertical error bars
*-* "E4" : Draw a smoothed filled area through the end points of the error bars
*-* "L" : Draw a line througth the bin contents
*-* "P" : Draw current marker at each bin
*-* "*H" : Draw histogram with a * at each bin
*-*
*-*
*-* The following options are supported for 2-D types:
*-* "ARR" : arrow mode. Shows gradient between adjacent cells
*-* "BOX" : a box is drawn for each cell with surface proportional to contents
*-* "COL" : a box is drawn for each cell with a color scale varying with contents
*-* "COLZ" : same as "COL". In addition the color mapping is also drawn
*-* "CONT" : Draw a contour plot (same as CONT0)
*-* "CONT0" : Draw a contour plot using colors to distinguish contours
*-* "CONT1" : Draw a contour plot using line styles to distinguish contours
*-* "CONT2" : Draw a contour plot using the same line style for all contours
*-* "CONT3" : Draw a contour plot using fill area colors
*-* "FB" : With LEGO or SURFACE, suppress the Front-Box
*-* "BB" : With LEGO or SURFACE, suppress the Back-Box
*-* "SCAT" : Draw a scatter-plot (default)
*-*
*-* Note that most options above can be concatenated, example:
*-* h-Draw("e1same");
*-* Options are case insensitive
*-*
*-* When using the options "BOX", "COL" or "COLZ", the color palette used
*-* is the one defined in the current style (see TStyle::SetPalette)
*-*
*-* When using the "CONT" or "SURF" or "LEGO" options, the number
*-* of contour levels can be changed via TH1::SetContour.
*-* (default is 20 equidistant levels)
*-*
*-* When option "same" is specified, the statistic box is not drawn.
*-* Specify option "sames" to force painting statistics with option "same"
*-* When option "sames" is given, one can use the following technique
*-* to rename a previous "stats" box and/or change its position
*-* Root > TPaveStats *st = (TPaveStats*)gPad->GetPrimitive("stats")
*-* Root > st->SetName(newname)
*-* Root > st->SetX1NDC(newx1); //new x start position
*-* Root > st->SetX2NDC(newx2); //new x end position
*-* Root > newhist->Draw("sames")
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
TH1* DrawCopy(Option_t *)
*-*-*-*-*-*-*Copy this histogram and Draw in the current pad*-*-*-*-*-*-*-*
*-* ===============================================
*-*
*-* Once the histogram is drawn into the pad, any further modification
*-* using graphics input will be made on the copy of the histogram,
*-* and not to the original object.
*-*
*-* See Draw for the list of options
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void DrawPanel()
*-*-*-*-*-*-*Display a panel with all histogram drawing options*-*-*-*-*-*
*-* ==================================================
*-*
*-* See class TDrawPanelHist for example
void Eval(TF1 *f1, Option_t *option)
*-*-*-*-*Evaluate function f1 at the center of bins of this histogram-*-*-*-*
*-* ============================================================
*-*
*-* If option "R" is specified, the function is evaluated only
*-* for the bins included in the function range.
*-* If option "A" is specified, the value of the function is added to the
*-* existing bin contents
*-* If option "S" is specified, the value of the function is used to
*-* generate an integer value, distributed according to the Poisson
*-* distribution, with f1 as the mean.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
*-* =========================================
*-* This member function is called when a histogram is clicked with the locator
*-*
*-* If Left button clicked on the bin top value, then the content of this bin
*-* is modified according to the new position of the mouse when it is released.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Int_t Fill(Axis_t x)
*-*-*-*-*-*-*-*-*-*Increment bin with abscissa X by 1*-*-*-*-*-*-*-*-*-*-*
*-* ==================================
*-*
*-* if x is less than the low-edge of the first bin, the Underflow bin is incremented
*-* if x is greater than the upper edge of last bin, the Overflow bin is incremented
*-*
*-* If the storage of the sum of squares of weights has been triggered,
*-* via the function Sumw2, then the sum of the squares of weights is incremented
*-* by 1 in the bin corresponding to x.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Int_t Fill(Axis_t x, Stat_t w)
*-*-*-*-*-*-*-*Increment bin with abscissa X with a weight w*-*-*-*-*-*-*-*
*-* =============================================
*-*
*-* if x is less than the low-edge of the first bin, the Underflow bin is incremented
*-* if x is greater than the upper edge of last bin, the Overflow bin is incremented
*-*
*-* If the storage of the sum of squares of weights has been triggered,
*-* via the function Sumw2, then the sum of the squares of weights is incremented
*-* by w^2 in the bin corresponding to x.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void FillN(Int_t ntimes, Axis_t *x, Double_t *w, Int_t stride)
*-*-*-*-*-*-*-*Fill this histogram with an array x and weights w*-*-*-*-*
*-* =================================================
*-*
*-* ntimes: number of entries in arrays x and w (array size must be ntimes*stride)
*-* x: array of values to be histogrammed
*-* w: array of weighs
*-* stride: step size through arrays x and w
*-*
*-* If the storage of the sum of squares of weights has been triggered,
*-* via the function Sumw2, then the sum of the squares of weights is incremented
*-* by w[i]^2 in the bin corresponding to x[i].
*-* if w is NULL each entry is assumed a weight=1
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void FillRandom(const char *fname, Int_t ntimes)
*-*-*-*-*-*-*Fill histogram following distribution in function fname*-*-*-*
*-* =======================================================
*-*
*-* The distribution contained in the function fname (TF1) is integrated
*-* over the channel contents.
*-* It is normalized to 1.
*-* Getting one random number implies:
*-* - Generating a random number between 0 and 1 (say r1)
*-* - Look in which bin in the normalized integral r1 corresponds to
*-* - Fill histogram channel
*-* ntimes random numbers are generated
*-*
*-* One can also call TF1::GetRandom to get a random variate from a function.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*
void FillRandom(TH1 *h, Int_t ntimes)
*-*-*-*-*-*-*Fill histogram following distribution in histogram h*-*-*-*
*-* ====================================================
*-*
*-* The distribution contained in the histogram h (TH1) is integrated
*-* over the channel contents.
*-* It is normalized to 1.
*-* Getting one random number implies:
*-* - Generating a random number between 0 and 1 (say r1)
*-* - Look in which bin in the normalized integral r1 corresponds to
*-* - Fill histogram channel
*-* ntimes random numbers are generated
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*
Int_t FindBin(Axis_t x, Axis_t y, Axis_t z)
*-*-*-*-*-*Return Global bin number corresponding to x,y,z*-*-*-*-*-*-*
*-* ===============================================
*-*
*-* 2-D and 3-D histograms are represented with a one dimensional
*-* structure.
*-* This has the advantage that all existing functions, such as
*-* GetBinContent, GetBinError, GetBinFunction work for all dimensions.
*-* See also TH1::GetBin
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void Fit(const char *fname ,Option_t *option ,Option_t *goption, Float_t xxmin, Float_t xxmax)
*-*-*-*-*-*-*-*-*-*-*Fit histogram with function fname*-*-*-*-*-*-*-*-*-*-*
*-* =================================
*-*
*-* fname is the name of an already predefined function created by TF1 or TF2
*-* Predefined functions such as Gaus, Expo and Poln are automatically
*-* created by ROOT.
*-*
*-* The list of fit options is given in parameter option.
*-* option = "W" Set all errors to 1
*-* = "I" Use integral of function in bin instead of value at bin center
*-* = "L" Use Loglikelihood method (default is chisquare method)
*-* = "U" Use a User specified fitting algorithm (via SetFCN)
*-* = "Q" Quiet mode (minimum printing)
*-* = "V" Verbose mode (default is between Q and V)
*-* = "E" Perform better Errors estimation using Minos technique
*-* = "M" More. Improve fit results
*-* = "R" Use the Range specified in the function range
*-* = "N" Do not store the graphics function, do not draw
*-* = "0" Do not plot the result of the fit. By default the fitted function
*-* is drawn unless the option"N" above is specified.
*-* = "+" Add this new fitted function to the list of fitted functions
*-* (by default, any previous function is deleted)
*-*
*-* When the fit is drawn (by default), the parameter goption may be used
*-* to specify a list of graphics options. See TH1::Draw for a complete
*-* list of these options.
*-*
*-* In order to use the Range option, one must first create a function
*-* with the expression to be fitted. For example, if your histogram
*-* has a defined range between -4 and 4 and you want to fit a gaussian
*-* only in the interval 1 to 3, you can do:
*-* TF1 *f1 = new TF1("f1","gaus",1,3);
*-* histo->Fit("f1","R");
*-*
*-* You can specify boundary limits for some or all parameters via
*-* f1->SetParLimits(p_number, parmin, parmax);
*-* if parmin>=parmax, the parameter is fixed
*-* Note that you are not forced to fix the limits for all parameters.
*-* For example, if you fit a function with 6 parameters, you can do:
*-* func->SetParameters(0,3.1,1.e-6,0.1,-8,100);
*-* func->SetParLimits(4,-10,-4);
*-* func->SetParLimits(5, 1,1);
*-* With this setup, parameters 0->3 can vary freely
*-* Parameter 4 has boundaries [-10,-4] with initial value -8
*-* Parameter 5 is fixed to 100.
*-*
*-* Note that option "I" gives better results but is slower.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
void FitPanel()
*-*-*-*-*-*-*Display a panel with all histogram fit options*-*-*-*-*-*
*-* ==============================================
*-*
*-* See class TFitPanel for example
char* GetObjectInfo(Int_t px, Int_t py)
Redefines TObject::GetObjectInfo.
Displays the histogram info (bin number, contents, integral up to bin
corresponding to cursor position px,py
Int_t FitOptionsMake(Option_t *choptin)
*-*-*-*-*-*-*-*-*Decode string choptin and fill Foption structure*-*-*-*-*-*
*-* ================================================
Int_t GetBin(Int_t binx, Int_t biny, Int_t binz)
*-*-*-*-*-*Return Global bin number corresponding to binx,y,z*-*-*-*-*-*-*
*-* ==================================================
*-*
*-* 2-D and 3-D histograms are represented with a one dimensional
*-* structure.
*-* This has the advantage that all existing functions, such as
*-* GetBinContent, GetBinError, GetBinFunction work for all dimensions.
*-*
*-* In case of a TH1x, returns binx directly.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Axis_t GetRandom()
return a random number distributed according the histogram bin contents.
This function checks if the bins integral exists. If not, the integral
is evaluated, normalized to one.
The integral is automatically recomputed if the number of entries
is not the same then when the integral was computed.
NB Only valid for 1-d histograms. Use GetRandom2 or 3 otherwise.
Stat_t GetBinContent(Int_t)
*-*-*-*-*-*-*Return content of global bin number bin*-*-*-*-*-*-*-*-*-*-*-*
*-* =======================================
void Multiply(TH1 *h1)
*-*-*-*-*-*-*-*-*-*-*Multiply this histogram by h1*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =============================
this = this*h1
If errors of this are available (TH1::Sumw2), errors are recalculated.
Note that if h1 has Sumw2 set, Sumw2 is automatically called for this
if not already set.
void Multiply(TH1 *h1, TH1 *h2, Float_t c1, Float_t c2, Option_t *option)
*-*-*-*-*Replace contents of this histogram by multiplication of h1 by h2*-*
*-* ================================================================
this = (c1*h1)*(c2*h2)
If errors of this are available (TH1::Sumw2), errors are recalculated.
Note that if h1 or h2 have Sumw2 set, Sumw2 is automatically called for this
if not already set.
void Paint(Option_t *option)
*-*-*-*-*-*-*-*-*Control routine to paint any kind of histograms*-*-*-*-*-*-*
*-* ===============================================
This function is automatically called by TCanvas::Update.
(see TH1::Draw for the list of options)
TH1* Rebin(Int_t ngroup, const char*newname)
*-*-*-*-*Rebin this histogram grouping ngroup bins together*-*-*-*-*-*-*-*-*
*-* ==================================================
if newname is not blank a new temporary histogram hnew is created.
else the current histogram is modified (default)
The parameter ngroup indicates how many bins of this have to me merged
into one bin of hnew
If the original histogram has errors stored (via Sumw2), the resulting
histograms has new errors correctly calculated.
examples: if h1 is an existing TH1F histogram with 100 bins
h1->Rebin(); //merges two bins in one in h1: previous contents of h1 are lost
h1->Rebin(5); //merges five bins in one in h1
TH1F *hnew = h1->Rebin(5,"hnew"); // creates a new histogram hnew
//merging 5 bins of h1 in one bin
NOTE: This function is currently implemented only for 1-D histograms
void RebinAxis(Axis_t x, const char *ax)
Histogram is resized along ax such that x is in the axis range.
The new axis limits are recomputed by doubling iteratively
the current axis range until the specified value x is within the limits.
The algorithm makes a copy of the histogram, then loops on all bins
of the old histogram to fill the rebinned histogram.
Takes into account errors (Sumw2) if any.
The algorithm works for 1-d, 2-d and 3-d histograms.
The bit kCanRebin must be set before invoking this function.
Ex: h->SetBit(TH1::kCanRebin);
void Scale(Float_t c1)
*-*-*-*-*Multiply this histogram by a constant c1*-*-*-*-*-*-*-*-*
*-* ========================================
this = c1*this
Note that both contents and errors(if any) are scaled.
This function uses the services of TH1::Add
void SmoothArray(Int_t NN, Double_t *XX, Int_t ntimes)
smooth array XX, translation of Hbook routine hsmoof.F
based on algorithm 353QH twice presented by J. Friedman
in Proc.of the 1974 CERN School of Computing, Norway, 11-24 August, 1974.
Double_t SmoothMedian(Int_t n, Double_t *a)
return the median of a vector a in monotonic order with length n
where median is a number which divides sequence of n numbers
into 2 halves. When n is odd, the median is kth element k = (n + 1) / 2.
when n is even the median is a mean of the elements k = n/2 and k = n/2 + 1.
void Smooth(Int_t ntimes)
Smooth bin contents of this histogram.
bin contents are replaced by their smooth values.
Errors (if any) are not modified.
algorithm can only be applied to 1-d histograms
void Streamer(TBuffer &b)
*-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =====================
void Print(Option_t *option)
*-*-*-*-*-*-*Print some global quantities for this histogram*-*-*-*-*-*-*-*
*-* ===============================================
If option "all" is given, bin contents and errors are also printed.
void Reset(Option_t *option)
*-*-*-*-*-*-*-*Reset this histogram: contents, errors, etc*-*-*-*-*-*-*-*
*-* ===========================================
if option "ICE" is specified, resets only Integral, Contents and Errors
void SavePrimitive(ofstream &out, Option_t *option)
Save primitive as a C++ statement(s) on output stream out
void UseCurrentStyle()
*-*-*-*-*-*Replace current attributes by current style*-*-*-*-*
*-* ===========================================
Stat_t GetMean(Int_t axis)
*-*-*-*-*-*-*-*Return mean value of this histogram along the X axis*-*-*-*-*
*-* ====================================================
Stat_t GetRMS(Int_t axis)
*-*-*-*-*-*-*-*Return the Root Mean Square value of this histogram*-*-*-*-*
*-* ===================================================
void GetStats(Stat_t *stats)
fill the array stats from the contents of this histogram
The array stats must be correctly dimensionned in the calling program.
stats[0] = sumw
stats[1] = sumw2
stats[2] = sumwx
stats[3] = sumwx2
If no axis-subrange is specified (via TAxis::SetRange), the array stats
is simply a copy of the statistics quantities computed at filling time.
If a sub-range is specified, the function recomputes these quantities
from the bin contents in the current axis range.
void PutStats(Stat_t *stats)
Replace current statistics with the values in array stats
Stat_t GetSumOfWeights()
*-*-*-*-*-*-*-*Return the sum of weights excluding under/overflows*-*-*-*-*
*-* ===================================================
Stat_t Integral()
Return integral of bin contents. Only bins in the bins range are considered.
Stat_t Integral(Int_t binx1, Int_t binx2)
Return integral of bin contents between binx1 and binx2 for a 1-D histogram
void SetContent(Stat_t *content)
*-*-*-*-*-*-*-*Replace bin contents by the contents of array content*-*-*-*
*-* =====================================================
Int_t GetContour(Float_t *levels)
*-*-*-*-*-*-*-*Return contour values into array levels*-*-*-*-*-*-*-*-*-*
*-* =======================================
*-*
*-* The number of contour levels can be returned by TH1::GetContourLevel
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Float_t GetContourLevel(Int_t level)
*-*-*-*-*-*-*-*Return the number of contour levels*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
void SetContour(Int_t nlevels, Float_t *levels)
*-*-*-*-*-*-*-*Set the number and values of contour levels*-*-*-*-*-*-*-*-*
*-* ===========================================
By default the number of contour levels is set to 20.
if argument levels = 0 or issing, equidistant contours are computed
void SetContourLevel(Int_t level, Float_t value)
*-*-*-*-*-*-*-*-*-*-*Set value for one contour level*-*-*-*-*-*-*-*-*-*-*-*
*-* ===============================
Float_t GetMaximum()
*-*-*-*-*-*-*-*-*-*-*Return maximum value of bins in the range*-*-*-*-*-*
*-* =========================================
Int_t GetMaximumBin()
*-*-*-*-*-*-*Return location of bin with maximum value in the range*-*
*-* ======================================================
Int_t GetMaximumBin(Int_t &locmax, Int_t &locmay, Int_t &locmaz)
*-*-*-*-*-*-*Return location of bin with maximum value in the range*-*
*-* ======================================================
Float_t GetMinimum()
*-*-*-*-*-*-*-*-*-*-*Return minimum value of bins in the range-*-*-*-*-*
*-* =========================================
Int_t GetMinimumBin()
*-*-*-*-*-*-*Return location of bin with minimum value in the range*-*
*-* ======================================================
Int_t GetMinimumBin(Int_t &locmix, Int_t &locmiy, Int_t &locmiz)
*-*-*-*-*-*-*Return location of bin with minimum value in the range*-*
*-* ======================================================
void SetBins(Int_t nx, Float_t xmin, Float_t xmax)
*-*-*-*-*-*-*-*-*Redefine x axis parameters*-*-*-*-*-*-*-*-*-*-*-*
*-* ===========================
The X axis parameters are modified.
The bins content array is resized
if errors (Sumw2) the errors array is resized
The previous bin contents are lost
To change only the axis limits, see TAxis::SetRange
void SetBins(Int_t nx, Float_t xmin, Float_t xmax, Int_t ny, Float_t ymin, Float_t ymax)
*-*-*-*-*-*-*-*-*Redefine x and y axis parameters*-*-*-*-*-*-*-*-*-*-*-*
*-* =================================
The X and Y axis parameters are modified.
The bins content array is resized
if errors (Sumw2) the errors array is resized
The previous bin contents are lost
To change only the axis limits, see TAxis::SetRange
void SetBins(Int_t nx, Float_t xmin, Float_t xmax, Int_t ny, Float_t ymin, Float_t ymax, Int_t nz, Float_t zmin, Float_t zmax)
*-*-*-*-*-*-*-*-*Redefine x, y and z axis parameters*-*-*-*-*-*-*-*-*-*-*-*
*-* ====================================
The X, Y and Z axis parameters are modified.
The bins content array is resized
if errors (Sumw2) the errors array is resized
The previous bin contents are lost
To change only the axis limits, see TAxis::SetRange
void SetMaximum(Float_t maximum)
*-*-*-*-*-*-*-*-*Set the maximum value for the Y axis*-*-*-*-*-*-*-*-*-*-*-*
*-* ====================================
By default the maximum value is automatically set to the maximum
bin content plus a margin of 10 per cent.
Use TH1::GetMaximum to find the maximum value of an histogram
Use TH1::GetMaximumBin to find the bin with the maximum value of an histogram
void SetMinimum(Float_t minimum)
*-*-*-*-*-*-*-*-*Set the minimum value for the Y axis*-*-*-*-*-*-*-*-*-*-*-*
*-* ====================================
By default the minimum value is automatically set to zero if all bin contents
are positive or the minimum - 10 per cent otherwise.
Use TH1::GetMinimum to find the minimum value of an histogram
Use TH1::GetMinimumBin to find the bin with the minimum value of an histogram
void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list
of histogram objects in the current directory in memory.
Remove reference to this histogram from current directory and add
reference to new directory dir. dir can be 0 in which case the
histogram does not belong to any directory.
void SetError(Stat_t *error)
*-*-*-*-*-*-*-*-*Replace bin errors by values in array error*-*-*-*-*-*-*-*-*
*-* ===========================================
void SetName(const char *name)
Change the name of this histogram
void SetObject(const char *name, const char *title)
Change the name and title of this histogram
void SetStats(Bool_t stats)
*-*-*-*-*-*-*-*-*Set statistics option on/off
*-* ============================
By default, the statistics box is drawn.
The paint options can be selected via gStyle->SetOptStats.
This function sets/resets the kNoStats bin in the histogram object.
It has priority over the Style option.
void Sumw2()
*-*-*-*-*Create structure to store sum of squares of weights*-*-*-*-*-*-*-*
*-* ===================================================
*-*
*-* if histogram is already filled, the sum of squares of weights
*-* is filled with the existing bin contents
*-*
*-* The error per bin will be computed as sqrt(sum of squares of weight)
*-* for each bin.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
TF1* GetFunction(const char *name)
*-*-*-*-*Return pointer to function with name*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
Functions such as TH1::Fit store the fitted function in the list of
functions of this histogram.
Stat_t GetBinError(Int_t bin)
*-*-*-*-*-*-*Return 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.
*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Stat_t GetCellContent(Int_t binx, Int_t biny)
Stat_t GetCellError(Int_t binx, Int_t biny)
void SetBinError(Int_t bin, Stat_t error)
void SetCellContent(Int_t binx, Int_t biny, Stat_t content)
void SetCellError(Int_t binx, Int_t biny, Stat_t error)
void SetBinContent(Int_t, Stat_t)
Inline Functions
Int_t AxisChoice(Option_t* axis)
void FillN(Int_t, Axis_t*, Axis_t*, Double_t*, Int_t)
Double_t* GetIntegral()
TList* GetListOfFunctions()
Int_t GetNdivisions(Option_t* axis = X)
Color_t GetAxisColor(Option_t* axis = X)
Color_t GetLabelColor(Option_t* axis = X)
Style_t GetLabelFont(Option_t* axis = X)
Float_t GetLabelOffset(Option_t* axis = X)
Float_t GetLabelSize(Option_t* axis = X)
Float_t GetTitleOffset(Option_t* axis = X)
Float_t GetTitleSize(Option_t* axis = X)
Float_t GetTickLength(Option_t* axis = X)
Float_t GetBarOffset()
Float_t GetBarWidth()
Axis_t GetBinCenter(Int_t bin)
Axis_t GetBinLowEdge(Int_t bin)
Axis_t GetBinWidth(Int_t bin)
void GetCenter(Axis_t* center)
TDirectory* GetDirectory()
Stat_t GetEntries()
Int_t GetDimension() const
void GetLowEdge(Axis_t* edge)
Float_t GetMaximumStored()
Float_t GetMinimumStored()
Int_t GetNbinsX() const
Int_t GetNbinsY() const
Int_t GetNbinsZ() const
Float_t GetNormFactor()
Option_t* GetOption() const
TVirtualHistPainter* GetPainter()
Int_t GetSumw2N()
TAxis* GetXaxis()
TAxis* GetYaxis()
TAxis* GetZaxis()
Stat_t Integral(Int_t, Int_t, Int_t, Int_t)
Stat_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t)
void SetAxisColor(Color_t color = 1, Option_t* axis = X)
void SetAxisRange(Float_t xmin, Float_t xmax, Option_t* axis = X)
void SetBarOffset(Float_t offset = 0.25)
void SetBarWidth(Float_t width = 0.5)
void SetBinsLength(Int_t)
void SetEntries(Stat_t n)
void SetLabelColor(Color_t color = 1, Option_t* axis = X)
void SetLabelFont(Style_t font = 62, Option_t* axis = X)
void SetLabelOffset(Float_t offset = 0.005, Option_t* axis = X)
void SetLabelSize(Float_t size = 0.02, Option_t* axis = X)
void SetNdivisions(Int_t n = 510, Option_t* axis = X)
void SetNormFactor(Float_t factor = 1)
void SetOption(Option_t* option = )
void SetTickLength(Float_t length = 0.02, Option_t* axis = X)
void SetTitleOffset(Float_t offset = 1, Option_t* axis = X)
void SetTitleSize(Float_t size = 0.02, Option_t* axis = X)
void SetXTitle(char* title)
void SetYTitle(char* title)
void SetZTitle(char* title)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
TH1 TH1(TH1&)
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Top of the page
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.