Logo ROOT  
Reference Guide
TH2 Class Reference

Service class for 2-Dim histogram classes.

  • TH2C a 2-D histogram with one byte per cell (char)
  • TH2S a 2-D histogram with two bytes per cell (short integer)
  • TH2I a 2-D histogram with four bytes per cell (32 bits integer)
  • TH2F a 2-D histogram with four bytes per cell (float)
  • TH2D a 2-D histogram with eight bytes per cell (double)

Definition at line 30 of file TH2.h.

Public Member Functions

virtual ~TH2 ()
 Destructor. More...
 
virtual Int_t BufferEmpty (Int_t action=0)
 Fill histogram with all entries in the buffer. More...
 
virtual void Copy (TObject &hnew) const
 Copy. More...
 
virtual Int_t Fill (const char *namex, const char *namey, Double_t w)
 Increment cell defined by namex,namey by a weight w. More...
 
virtual Int_t Fill (const char *namex, Double_t y, Double_t w)
 Increment cell defined by namex,y by a weight w. More...
 
virtual Int_t Fill (Double_t x, const char *namey, Double_t w)
 Increment cell defined by x,namey by a weight w. More...
 
virtual Int_t Fill (Double_t x, Double_t y)
 Increment cell defined by x,y by 1. More...
 
virtual Int_t Fill (Double_t x, Double_t y, Double_t w)
 Increment cell defined by x,y by a weight w. More...
 
virtual void FillN (Int_t ntimes, const Double_t *x, const Double_t *y, const Double_t *w, Int_t stride=1)
 Fill a 2-D histogram with an array of values and weights. More...
 
virtual void FillN (Int_t, const Double_t *, const Double_t *, Int_t)
 Fill this histogram with an array x and weights w. More...
 
virtual void FillRandom (const char *fname, Int_t ntimes=5000)
 Fill histogram following distribution in function fname. More...
 
virtual void FillRandom (TH1 *h, Int_t ntimes=5000)
 Fill histogram following distribution in histogram h. More...
 
virtual void FitSlicesX (TF1 *f1=0, Int_t firstybin=0, Int_t lastybin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=0)
 Project slices along X in case of a 2-D histogram, then fit each slice with function f1 and make a histogram for each fit parameter Only bins along Y between firstybin and lastybin are considered. More...
 
virtual void FitSlicesY (TF1 *f1=0, Int_t firstxbin=0, Int_t lastxbin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=0)
 Project slices along Y in case of a 2-D histogram, then fit each slice with function f1 and make a histogram for each fit parameter Only bins along X between firstxbin and lastxbin are considered. More...
 
virtual Int_t GetBin (Int_t binx, Int_t biny, Int_t binz=0) const
 Return Global bin number corresponding to binx,y,z. More...
 
virtual Double_t GetBinContent (Int_t bin) const
 Return content of bin number bin. More...
 
virtual Double_t GetBinContent (Int_t binx, Int_t biny) const
 
virtual Double_t GetBinContent (Int_t binx, Int_t biny, Int_t) const
 
virtual Double_t GetBinErrorLow (Int_t bin) const
 Return lower error associated to bin number bin. More...
 
virtual Double_t GetBinErrorLow (Int_t binx, Int_t biny)
 
virtual Double_t GetBinErrorUp (Int_t bin) const
 Return upper error associated to bin number bin. More...
 
virtual Double_t GetBinErrorUp (Int_t binx, Int_t biny)
 
virtual Double_t 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
 compute first cell (binx,biny) in the range [firstxbin,lastxbin][firstybin,lastybin] for which diff = abs(cell_content-c) <= maxdiff In case several cells in the specified range with diff=0 are found the first cell found is returned in binx,biny. More...
 
virtual Double_t GetCorrelationFactor (Int_t axis1=1, Int_t axis2=2) const
 Return correlation factor between axis1 and axis2. More...
 
virtual Double_t GetCovariance (Int_t axis1=1, Int_t axis2=2) const
 Return covariance between axis1 and axis2. More...
 
virtual void GetRandom2 (Double_t &x, Double_t &y)
 Return 2 random numbers along axis x and y distributed according the cell-contents of a 2-dim histogram return a NaN if the histogram has a bin with negative content. More...
 
virtual void GetStats (Double_t *stats) const
 Fill the array stats from the contents of this histogram The array stats must be correctly dimensioned in the calling program. More...
 
virtual Double_t Integral (Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Option_t *option="") const
 Return integral of bin contents in range [firstxbin,lastxbin],[firstybin,lastybin] for a 2-D histogram By default the integral is computed as the sum of bin contents in the range. More...
 
virtual Double_t Integral (Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t *="") const
 
virtual Double_t Integral (Option_t *option="") const
 Return integral of bin contents. More...
 
virtual Double_t IntegralAndError (Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Double_t &err, Option_t *option="") const
 Return integral of bin contents in range [firstxbin,lastxbin],[firstybin,lastybin] for a 2-D histogram. More...
 
virtual Double_t Interpolate (Double_t x, Double_t y) const
 Given a point P(x,y), Interpolate approximates the value via bilinear interpolation based on the four nearest bin centers see Wikipedia, Bilinear Interpolation Andy Mastbaum 10/8/2008 vaguely based on R.Raja 6-Sep-2008. More...
 
virtual Double_t Interpolate (Double_t x, Double_t y, Double_t z) const
 illegal for a TH2 More...
 
virtual Double_t KolmogorovTest (const TH1 *h2, Option_t *option="") const
 Statistical test of compatibility in shape between THIS histogram and h2, using Kolmogorov test. More...
 
TProfileProfileX (const char *name="_pfx", Int_t firstybin=1, Int_t lastybin=-1, Option_t *option="") const
 Project a 2-D histogram into a profile histogram along X. More...
 
TProfileProfileY (const char *name="_pfy", Int_t firstxbin=1, Int_t lastxbin=-1, Option_t *option="") const
 Project a 2-D histogram into a profile histogram along Y. More...
 
TH1DProjectionX (const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const
 Project a 2-D histogram into a 1-D histogram along X. More...
 
TH1DProjectionY (const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
 Project a 2-D histogram into a 1-D histogram along Y. More...
 
virtual void PutStats (Double_t *stats)
 Replace current statistics with the values in array stats. More...
 
TH1DQuantilesX (Double_t prob=0.5, const char *name="_qx") const
 Compute the X distribution of quantiles in the other variable Y name is the name of the returned histogram prob is the probability content for the quantile (0.5 is the default for the median) An approximate error for the quantile is computed assuming that the distribution in the other variable is normal. More...
 
TH1DQuantilesY (Double_t prob=0.5, const char *name="_qy") const
 Compute the Y distribution of quantiles in the other variable X name is the name of the returned histogram prob is the probability content for the quantile (0.5 is the default for the median) An approximate error for the quantile is computed assuming that the distribution in the other variable is normal. More...
 
virtual TH2Rebin (Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
 Override TH1::Rebin as TH2::RebinX Rebinning in variable binning as for TH1 is not allowed If a non-null pointer is given an error is flagged see RebinX and Rebin2D. More...
 
virtual TH2Rebin2D (Int_t nxgroup=2, Int_t nygroup=2, const char *newname="")
 Rebin this histogram grouping nxgroup/nygroup bins along the xaxis/yaxis together. More...
 
virtual TH2RebinX (Int_t ngroup=2, const char *newname="")
 Rebin only the X axis see Rebin2D. More...
 
virtual TH2RebinY (Int_t ngroup=2, const char *newname="")
 Rebin only the Y axis see Rebin2D. More...
 
virtual void Reset (Option_t *option="")
 Reset this histogram: contents, errors, etc. More...
 
virtual void SetBinContent (Int_t bin, Double_t content)
 Set bin content. More...
 
virtual void SetBinContent (Int_t binx, Int_t biny, Double_t content)
 
virtual void SetBinContent (Int_t binx, Int_t biny, Int_t, Double_t content)
 
virtual void SetShowProjectionX (Int_t nbins=1)
 When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the projection along X corresponding to the mouse position along Y. More...
 
virtual void SetShowProjectionY (Int_t nbins=1)
 When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the projection along Y corresponding to the mouse position along X. More...
 
virtual TH1ShowBackground (Int_t niter=20, Option_t *option="same")
 This function calculates the background spectrum in this histogram. More...
 
virtual Int_t ShowPeaks (Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
 Interface to TSpectrum2::Search the function finds peaks in this histogram where the width is > sigma and the peak maximum greater than threshold*maximum bin content of this. More...
 
virtual void Smooth (Int_t ntimes=1, Option_t *option="")
 Smooth bin contents of this 2-d histogram using kernel algorithms similar to the ones used in the raster graphics community. More...
 
- Public Member Functions inherited from TH1
virtual ~TH1 ()
 Histogram default destructor. More...
 
virtual Bool_t Add (const TH1 *h, const TH1 *h2, Double_t c1=1, Double_t c2=1)
 Replace contents of this histogram by the addition of h1 and h2. More...
 
virtual Bool_t Add (const TH1 *h1, Double_t c1=1)
 Performs the operation: this = this + c1*h1 If errors are defined (see TH1::Sumw2), errors are also recalculated. More...
 
virtual Bool_t Add (TF1 *h1, Double_t c1=1, Option_t *option="")
 Performs the operation: this = this + c1*f1 if errors are defined (see TH1::Sumw2), errors are also recalculated. More...
 
virtual void AddBinContent (Int_t bin)
 Increment bin content by 1. More...
 
virtual void AddBinContent (Int_t bin, Double_t w)
 Increment bin content by a weight w. More...
 
virtual Double_t AndersonDarlingTest (const TH1 *h2, Double_t &advalue) const
 Same function as above but returning also the test statistic value. More...
 
virtual Double_t AndersonDarlingTest (const TH1 *h2, Option_t *option="") const
 Statistical test of compatibility in shape between this histogram and h2, using the Anderson-Darling 2 sample test. More...
 
virtual void Browse (TBrowser *b)
 Browse the Histogram object. More...
 
virtual Int_t BufferEmpty (Int_t action=0)
 Fill histogram with all entries in the buffer. More...
 
virtual Bool_t CanExtendAllAxes () const
 Returns true if all axes are extendable. More...
 
virtual Double_t Chi2Test (const TH1 *h2, Option_t *option="UU", Double_t *res=0) const
 \( \chi^{2} \) test for comparing weighted and unweighted histograms More...
 
virtual Double_t Chi2TestX (const TH1 *h2, Double_t &chi2, Int_t &ndf, Int_t &igood, Option_t *option="UU", Double_t *res=0) const
 The computation routine of the Chisquare test. More...
 
virtual Double_t Chisquare (TF1 *f1, Option_t *option="") const
 Compute and return the chisquare of this histogram with respect to a function The chisquare is computed by weighting each histogram point by the bin error By default the full range of the histogram is used. More...
 
virtual void ClearUnderflowAndOverflow ()
 Remove all the content from the underflow and overflow bins, without changing the number of entries After calling this method, every undeflow and overflow bins will have content 0.0 The Sumw2 is also cleared, since there is no more content in the bins. More...
 
TObjectClone (const char *newname=0) const
 Make a complete copy of the underlying object. More...
 
virtual Double_t ComputeIntegral (Bool_t onlyPositive=false)
 Compute integral (cumulative sum of bins) The result stored in fIntegral is used by the GetRandom functions. More...
 
virtual void Copy (TObject &hnew) const
 Copy this histogram structure to newth1. More...
 
virtual void DirectoryAutoAdd (TDirectory *)
 Perform the automatic addition of the histogram to the given directory. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Compute distance from point px,py to a line. More...
 
virtual Bool_t Divide (const TH1 *h1)
 Divide this histogram by h1. More...
 
virtual Bool_t Divide (const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="")
 Replace contents of this histogram by the division of h1 by h2. More...
 
virtual Bool_t Divide (TF1 *f1, Double_t c1=1)
 Performs the operation: this = this/(c1*f1) if errors are defined (see TH1::Sumw2), errors are also recalculated. More...
 
virtual void Draw (Option_t *option="")
 Draw this histogram with options. More...
 
virtual TH1DrawCopy (Option_t *option="", const char *name_postfix="_copy") const
 Copy this histogram and Draw in the current pad. More...
 
virtual TH1DrawNormalized (Option_t *option="", Double_t norm=1) const
 Draw a normalized copy of this histogram. More...
 
virtual void DrawPanel ()
 Display a panel with all histogram drawing options. More...
 
virtual void Eval (TF1 *f1, Option_t *option="")
 Evaluate function f1 at the center of bins of this histogram. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to one event. More...
 
virtual void ExtendAxis (Double_t x, TAxis *axis)
 Histogram is resized along axis such that x is in the axis range. More...
 
virtual TH1FFT (TH1 *h_output, Option_t *option)
 This function allows to do discrete Fourier transforms of TH1 and TH2. More...
 
virtual Int_t Fill (const char *name, Double_t w)
 Increment bin with namex with a weight w. More...
 
virtual Int_t Fill (Double_t x)
 Increment bin with abscissa X by 1. More...
 
virtual Int_t Fill (Double_t x, Double_t w)
 Increment bin with abscissa X with a weight w. More...
 
virtual void FillN (Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1)
 Fill this histogram with an array x and weights w. More...
 
virtual void FillN (Int_t, const Double_t *, const Double_t *, const Double_t *, Int_t)
 
virtual void FillRandom (const char *fname, Int_t ntimes=5000)
 Fill histogram following distribution in function fname. More...
 
virtual void FillRandom (TH1 *h, Int_t ntimes=5000)
 Fill histogram following distribution in histogram h. More...
 
virtual Int_t FindBin (Double_t x, Double_t y=0, Double_t z=0)
 Return Global bin number corresponding to x,y,z. More...
 
virtual Int_t FindFirstBinAbove (Double_t threshold=0, Int_t axis=1, Int_t firstBin=1, Int_t lastBin=-1) const
 Find first bin with content > threshold for axis (1=x, 2=y, 3=z) if no bins with content > threshold is found the function returns -1. More...
 
virtual Int_t FindFixBin (Double_t x, Double_t y=0, Double_t z=0) const
 Return Global bin number corresponding to x,y,z. More...
 
virtual Int_t FindLastBinAbove (Double_t threshold=0, Int_t axis=1, Int_t firstBin=1, Int_t lastBin=-1) const
 Find last bin with content > threshold for axis (1=x, 2=y, 3=z) if no bins with content > threshold is found the function returns -1. More...
 
virtual TObjectFindObject (const char *name) const
 Search object named name in the list of functions. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Search object obj in the list of functions. More...
 
virtual TFitResultPtr Fit (const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
 Fit histogram with function fname. More...
 
virtual TFitResultPtr Fit (TF1 *f1, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
 Fit histogram with function f1. More...
 
virtual void FitPanel ()
 Display a panel with all histogram fit options. More...
 
TH1GetAsymmetry (TH1 *h2, Double_t c2=1, Double_t dc2=0)
 Return an histogram containing the asymmetry of this histogram with h2, where the asymmetry is defined as: More...
 
virtual Color_t GetAxisColor (Option_t *axis="X") const
 Return the number of divisions for "axis". More...
 
virtual Float_t GetBarOffset () const
 
virtual Float_t GetBarWidth () const
 
virtual Int_t GetBin (Int_t binx, Int_t biny=0, Int_t binz=0) const
 Return Global bin number corresponding to binx,y,z. More...
 
virtual Double_t GetBinCenter (Int_t bin) const
 Return bin center for 1D histogram. More...
 
virtual Double_t GetBinContent (Int_t bin) const
 Return content of bin number bin. More...
 
virtual Double_t GetBinContent (Int_t bin, Int_t) const
 
virtual Double_t GetBinContent (Int_t bin, Int_t, Int_t) const
 
virtual Double_t GetBinError (Int_t bin) const
 Return value of error associated to bin number bin. More...
 
virtual Double_t GetBinError (Int_t binx, Int_t biny) const
 
virtual Double_t GetBinError (Int_t binx, Int_t biny, Int_t binz) const
 
virtual Double_t GetBinErrorLow (Int_t bin) const
 Return lower error associated to bin number bin. More...
 
virtual EBinErrorOpt GetBinErrorOption () const
 
virtual Double_t GetBinErrorUp (Int_t bin) const
 Return upper error associated to bin number bin. More...
 
virtual Double_t GetBinLowEdge (Int_t bin) const
 Return bin lower edge for 1D histogram. More...
 
virtual Double_t GetBinWidth (Int_t bin) const
 Return bin width for 1D histogram. More...
 
virtual Double_t GetBinWithContent (Double_t c, Int_t &binx, Int_t firstx=0, Int_t lastx=0, Double_t maxdiff=0) const
 Compute first binx in the range [firstx,lastx] for which diff = abs(bin_content-c) <= maxdiff. More...
 
virtual void GetBinXYZ (Int_t binglobal, Int_t &binx, Int_t &biny, Int_t &binz) const
 Return binx, biny, binz corresponding to the global bin number globalbin see TH1::GetBin function above. More...
 
const Double_tGetBuffer () const
 
Int_t GetBufferLength () const
 
Int_t GetBufferSize () const
 
virtual Double_t GetCellContent (Int_t binx, Int_t biny) const
 
virtual Double_t GetCellError (Int_t binx, Int_t biny) const
 
virtual void GetCenter (Double_t *center) const
 Fill array with center of bins for 1D histogram Better to use h1.GetXaxis().GetCenter(center) More...
 
virtual Int_t GetContour (Double_t *levels=0)
 Return contour values into array levels if pointer levels is non zero. More...
 
virtual Double_t GetContourLevel (Int_t level) const
 Return value of contour number level. More...
 
virtual Double_t GetContourLevelPad (Int_t level) const
 Return the value of contour number "level" in Pad coordinates. More...
 
TH1GetCumulative (Bool_t forward=kTRUE, const char *suffix="_cumulative") const
 Return a pointer to an histogram containing the cumulative The cumulative can be computed both in the forward (default) or backward direction; the name of the new histogram is constructed from the name of this histogram with the suffix suffix appended. More...
 
virtual Int_t GetDimension () const
 
TDirectoryGetDirectory () const
 
virtual Double_t GetEffectiveEntries () const
 Number of effective entries of the histogram. More...
 
virtual Double_t GetEntries () const
 Return the current number of entries. More...
 
virtual TF1GetFunction (const char *name) const
 Return pointer to function with name. More...
 
virtual Double_tGetIntegral ()
 Return a pointer to the array of bins integral. More...
 
virtual Double_t GetKurtosis (Int_t axis=1) const
 
virtual Color_t GetLabelColor (Option_t *axis="X") const
 Return the "axis" label color. More...
 
virtual Style_t GetLabelFont (Option_t *axis="X") const
 Return the "axis" label font. More...
 
virtual Float_t GetLabelOffset (Option_t *axis="X") const
 Return the "axis" label offset. More...
 
virtual Float_t GetLabelSize (Option_t *axis="X") const
 Return the "axis" label size. More...
 
TListGetListOfFunctions () const
 
virtual void GetLowEdge (Double_t *edge) const
 Fill array with low edge of bins for 1D histogram Better to use h1.GetXaxis().GetLowEdge(edge) More...
 
virtual Double_t GetMaximum (Double_t maxval=FLT_MAX) const
 Return maximum value smaller than maxval of bins in the range, unless the value has been overridden by TH1::SetMaximum, in which case it returns that value. More...
 
virtual Int_t GetMaximumBin () const
 Return location of bin with maximum value in the range. More...
 
virtual Int_t GetMaximumBin (Int_t &locmax, Int_t &locmay, Int_t &locmaz) const
 Return location of bin with maximum value in the range. More...
 
virtual Double_t GetMaximumStored () const
 
virtual Double_t GetMean (Int_t axis=1) const
 For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis. More...
 
virtual Double_t GetMeanError (Int_t axis=1) const
 Return standard error of mean of this histogram along the X axis. More...
 
virtual Double_t GetMinimum (Double_t minval=-FLT_MAX) const
 Return minimum value larger than minval of bins in the range, unless the value has been overridden by TH1::SetMinimum, in which case it returns that value. More...
 
virtual void GetMinimumAndMaximum (Double_t &min, Double_t &max) const
 Retrieve the minimum and maximum values in the histogram. More...
 
virtual Int_t GetMinimumBin () const
 Return location of bin with minimum value in the range. More...
 
virtual Int_t GetMinimumBin (Int_t &locmix, Int_t &locmiy, Int_t &locmiz) const
 Return location of bin with minimum value in the range. More...
 
virtual Double_t GetMinimumStored () const
 
virtual Int_t GetNbinsX () const
 
virtual Int_t GetNbinsY () const
 
virtual Int_t GetNbinsZ () const
 
virtual Int_t GetNcells () const
 
virtual Int_t GetNdivisions (Option_t *axis="X") const
 Return the number of divisions for "axis". More...
 
virtual Double_t GetNormFactor () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Redefines TObject::GetObjectInfo. More...
 
Option_tGetOption () const
 
TVirtualHistPainterGetPainter (Option_t *option="")
 Return pointer to painter. More...
 
virtual Int_t GetQuantiles (Int_t nprobSum, Double_t *q, const Double_t *probSum=0)
 Compute Quantiles for this histogram Quantile x_q of a probability distribution Function F is defined as. More...
 
virtual Double_t GetRandom () const
 Return a random number distributed according the histogram bin contents. More...
 
Double_t GetRMS (Int_t axis=1) const
 
Double_t GetRMSError (Int_t axis=1) const
 
virtual Double_t GetSkewness (Int_t axis=1) const
 
EStatOverflows GetStatOverflows () const
 
virtual void GetStats (Double_t *stats) const
 fill the array stats from the contents of this histogram The array stats must be correctly dimensioned in the calling program. More...
 
virtual Double_t GetStdDev (Int_t axis=1) const
 Returns the Standard Deviation (Sigma). More...
 
virtual Double_t GetStdDevError (Int_t axis=1) const
 Return error of standard deviation estimation for Normal distribution. More...
 
virtual Double_t GetSumOfWeights () const
 Return the sum of weights excluding under/overflows. More...
 
virtual TArrayDGetSumw2 ()
 
virtual const TArrayDGetSumw2 () const
 
virtual Int_t GetSumw2N () const
 
virtual Float_t GetTickLength (Option_t *axis="X") const
 Return the "axis" tick length. More...
 
virtual Style_t GetTitleFont (Option_t *axis="X") const
 Return the "axis" title font. More...
 
virtual Float_t GetTitleOffset (Option_t *axis="X") const
 Return the "axis" title offset. More...
 
virtual Float_t GetTitleSize (Option_t *axis="X") const
 Return the "axis" title size. More...
 
TAxisGetXaxis ()
 Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more information. More...
 
const TAxisGetXaxis () const
 
TAxisGetYaxis ()
 
const TAxisGetYaxis () const
 
TAxisGetZaxis ()
 
const TAxisGetZaxis () const
 
virtual Double_t Integral (Int_t binx1, Int_t binx2, Option_t *option="") const
 Return integral of bin contents in range [binx1,binx2]. More...
 
virtual Double_t Integral (Option_t *option="") const
 Return integral of bin contents. More...
 
virtual Double_t IntegralAndError (Int_t binx1, Int_t binx2, Double_t &err, Option_t *option="") const
 Return integral of bin contents in range [binx1,binx2] and its error. More...
 
virtual Double_t Interpolate (Double_t x) const
 Given a point x, approximates the value via linear interpolation based on the two nearest bin centers. More...
 
virtual Double_t Interpolate (Double_t x, Double_t y) const
 2d Interpolation. Not yet implemented. More...
 
virtual Double_t Interpolate (Double_t x, Double_t y, Double_t z) const
 3d Interpolation. Not yet implemented. More...
 
Bool_t IsBinOverflow (Int_t bin, Int_t axis=0) const
 Return true if the bin is overflow. More...
 
Bool_t IsBinUnderflow (Int_t bin, Int_t axis=0) const
 Return true if the bin is underflow. More...
 
virtual Bool_t IsHighlight () const
 
virtual Double_t KolmogorovTest (const TH1 *h2, Option_t *option="") const
 Statistical test of compatibility in shape between this histogram and h2, using Kolmogorov test. More...
 
virtual void LabelsDeflate (Option_t *axis="X")
 Reduce the number of bins for the axis passed in the option to the number of bins having a label. More...
 
virtual void LabelsInflate (Option_t *axis="X")
 Double the number of bins for axis. More...
 
virtual void LabelsOption (Option_t *option="h", Option_t *axis="X")
 Set option(s) to draw axis with labels. More...
 
virtual Long64_t Merge (TCollection *list)
 
Long64_t Merge (TCollection *list, Option_t *option)
 Add all histograms in the collection to this histogram. More...
 
virtual Bool_t Multiply (const TH1 *h1)
 Multiply this histogram by h1. More...
 
virtual Bool_t Multiply (const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="")
 Replace contents of this histogram by multiplication of h1 by h2. More...
 
virtual Bool_t Multiply (TF1 *f1, Double_t c1=1)
 Performs the operation: More...
 
virtual void Paint (Option_t *option="")
 Control routine to paint any kind of histograms. More...
 
virtual void Print (Option_t *option="") const
 Print some global quantities for this histogram. More...
 
virtual void PutStats (Double_t *stats)
 Replace current statistics with the values in array stats. More...
 
virtual TH1Rebin (Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
 Rebin this histogram. More...
 
virtual void RebinAxis (Double_t x, TAxis *axis)
 
virtual TH1RebinX (Int_t ngroup=2, const char *newname="")
 
virtual void Rebuild (Option_t *option="")
 Using the current bin info, recompute the arrays for contents and errors. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove object from the list of functions. More...
 
virtual void Reset (Option_t *option="")
 Reset this histogram: contents, errors, etc. More...
 
virtual void ResetStats ()
 Reset the statistics including the number of entries and replace with values calculates from bin content. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save primitive as a C++ statement(s) on output stream out. More...
 
virtual void Scale (Double_t c1=1, Option_t *option="")
 Multiply this histogram by a constant c1. More...
 
virtual void SetAxisColor (Color_t color=1, Option_t *axis="X")
 Set color to draw the axis line and tick marks. More...
 
virtual void SetAxisRange (Double_t xmin, Double_t xmax, Option_t *axis="X")
 Set the "axis" range. More...
 
virtual void SetBarOffset (Float_t offset=0.25)
 
virtual void SetBarWidth (Float_t width=0.5)
 
virtual 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 CanExtendAllAxes(), the number of bins is automatically doubled to accommodate the new bin. More...
 
virtual void SetBinContent (Int_t bin, Int_t, Double_t content)
 
virtual void SetBinContent (Int_t bin, Int_t, Int_t, Double_t content)
 
virtual void SetBinError (Int_t bin, Double_t error)
 Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empty bin the bin error is set by default to the square root of their content. More...
 
virtual void SetBinError (Int_t binx, Int_t biny, Double_t error)
 See convention for numbering bins in TH1::GetBin. More...
 
virtual void SetBinError (Int_t binx, Int_t biny, Int_t binz, Double_t error)
 See convention for numbering bins in TH1::GetBin. More...
 
virtual void SetBinErrorOption (EBinErrorOpt type)
 
virtual void SetBins (Int_t nx, const Double_t *xBins)
 Redefine x axis parameters with variable bin sizes. More...
 
virtual void SetBins (Int_t nx, const Double_t *xBins, Int_t ny, const Double_t *yBins)
 Redefine x and y axis parameters with variable bin sizes. More...
 
virtual void SetBins (Int_t nx, const Double_t *xBins, Int_t ny, const Double_t *yBins, Int_t nz, const Double_t *zBins)
 Redefine x, y and z axis parameters with variable bin sizes. More...
 
virtual void SetBins (Int_t nx, Double_t xmin, Double_t xmax)
 Redefine x axis parameters. More...
 
virtual void SetBins (Int_t nx, Double_t xmin, Double_t xmax, Int_t ny, Double_t ymin, Double_t ymax)
 Redefine x and y axis parameters. More...
 
virtual void 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)
 Redefine x, y and z axis parameters. More...
 
virtual void SetBinsLength (Int_t=-1)
 
virtual void SetBuffer (Int_t buffersize, Option_t *option="")
 Set the maximum number of entries to be kept in the buffer. More...
 
virtual UInt_t SetCanExtend (UInt_t extendBitMask)
 Make the histogram axes extendable / not extendable according to the bit mask returns the previous bit mask specifying which axes are extendable. More...
 
virtual void SetCellContent (Int_t binx, Int_t biny, Double_t content)
 
virtual void SetCellError (Int_t binx, Int_t biny, Double_t content)
 
virtual void SetContent (const Double_t *content)
 Replace bin contents by the contents of array content. More...
 
virtual void SetContour (Int_t nlevels, const Double_t *levels=0)
 Set the number and values of contour levels. More...
 
virtual void SetContourLevel (Int_t level, Double_t value)
 Set value for one contour level. More...
 
virtual 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. More...
 
virtual void SetEntries (Double_t n)
 
virtual void SetError (const Double_t *error)
 Replace bin errors by values in array error. More...
 
virtual void SetHighlight (Bool_t set=kTRUE)
 Set highlight (enable/disable) mode for the histogram by default highlight mode is disable. More...
 
virtual void SetLabelColor (Color_t color=1, Option_t *axis="X")
 Set axis labels color. More...
 
virtual void SetLabelFont (Style_t font=62, Option_t *axis="X")
 Set font number used to draw axis labels. More...
 
virtual void SetLabelOffset (Float_t offset=0.005, Option_t *axis="X")
 Set offset between axis and axis' labels. More...
 
virtual void SetLabelSize (Float_t size=0.02, Option_t *axis="X")
 Set size of axis' labels. More...
 
virtual void SetMaximum (Double_t maximum=-1111)
 
virtual void SetMinimum (Double_t minimum=-1111)
 
virtual void SetName (const char *name)
 Change the name of this histogram. More...
 
virtual void SetNameTitle (const char *name, const char *title)
 Change the name and title of this histogram. More...
 
virtual void SetNdivisions (Int_t n=510, Option_t *axis="X")
 Set the number of divisions to draw an axis. More...
 
virtual void SetNormFactor (Double_t factor=1)
 
virtual void SetOption (Option_t *option=" ")
 
void SetStatOverflows (EStatOverflows statOverflows)
 
virtual void SetStats (Bool_t stats=kTRUE)
 Set statistics option on/off. More...
 
virtual void SetTickLength (Float_t length=0.02, Option_t *axis="X")
 Set the axis' tick marks length. More...
 
virtual void SetTitle (const char *title)
 See GetStatOverflows for more information. More...
 
virtual void SetTitleFont (Style_t font=62, Option_t *axis="X")
 Set the axis' title font. More...
 
virtual void SetTitleOffset (Float_t offset=1, Option_t *axis="X")
 Specify a parameter offset to control the distance between the axis and the axis' title. More...
 
virtual void SetTitleSize (Float_t size=0.02, Option_t *axis="X")
 Set the axis' title size. More...
 
virtual void SetXTitle (const char *title)
 
virtual void SetYTitle (const char *title)
 
virtual void SetZTitle (const char *title)
 
virtual TH1ShowBackground (Int_t niter=20, Option_t *option="same")
 This function calculates the background spectrum in this histogram. More...
 
virtual Int_t ShowPeaks (Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
 Interface to TSpectrum::Search. More...
 
virtual void Smooth (Int_t ntimes=1, Option_t *option="")
 Smooth bin contents of this histogram. More...
 
virtual void Sumw2 (Bool_t flag=kTRUE)
 Create structure to store sum of squares of weights. More...
 
void UseCurrentStyle ()
 Copy current attributes from/to current style. More...
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 TNamed copy ctor. More...
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 TNamed destructor. More...
 
virtual void Clear (Option_t *option="")
 Set name and title to empty strings (""). More...
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare two TNamed objects. More...
 
virtual void Copy (TObject &named) const
 Copy this to obj. More...
 
virtual void FillBuffer (char *&buffer)
 Encode TNamed into output buffer. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
virtual Bool_t IsSortable () const
 
virtual void ls (Option_t *option="") const
 List TNamed name and title. More...
 
TNamedoperator= (const TNamed &rhs)
 TNamed assignment operator. More...
 
virtual void Print (Option_t *option="") const
 Print TNamed name and title. More...
 
virtual void SetName (const char *name)
 Set the name of the TNamed. More...
 
virtual void SetNameTitle (const char *name, const char *title)
 Set all the TNamed parameters (name and title). More...
 
virtual void SetTitle (const char *title="")
 Set the title of the TNamed. More...
 
virtual Int_t Sizeof () const
 Return size of the TNamed part of the TObject. More...
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor. More...
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
ULong_t CheckedHash ()
 Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More...
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
virtual Bool_t IsSortable () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 
- Public Member Functions inherited from TAttLine
 TAttLine ()
 AttLine default constructor. More...
 
 TAttLine (Color_t lcolor, Style_t lstyle, Width_t lwidth)
 AttLine normal constructor. More...
 
virtual ~TAttLine ()
 AttLine destructor. More...
 
void Copy (TAttLine &attline) const
 Copy this line attributes to a new TAttLine. More...
 
Int_t DistancetoLine (Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
 Compute distance from point px,py to a line. More...
 
virtual Color_t GetLineColor () const
 Return the line color. More...
 
virtual Style_t GetLineStyle () const
 Return the line style. More...
 
virtual Width_t GetLineWidth () const
 Return the line width. More...
 
virtual void Modify ()
 Change current line attributes if necessary. More...
 
virtual void ResetAttLine (Option_t *option="")
 Reset this line attributes to default values. More...
 
virtual void SaveLineAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
 Save line attributes as C++ statement(s) on output stream out. More...
 
virtual void SetLineAttributes ()
 Invoke the DialogCanvas Line attributes. More...
 
virtual void SetLineColor (Color_t lcolor)
 Set the line color. More...
 
virtual void SetLineColorAlpha (Color_t lcolor, Float_t lalpha)
 Set a transparent line color. More...
 
virtual void SetLineStyle (Style_t lstyle)
 Set the line style. More...
 
virtual void SetLineWidth (Width_t lwidth)
 Set the line width. More...
 
- Public Member Functions inherited from TAttFill
 TAttFill ()
 AttFill default constructor. More...
 
 TAttFill (Color_t fcolor, Style_t fstyle)
 AttFill normal constructor. More...
 
virtual ~TAttFill ()
 AttFill destructor. More...
 
void Copy (TAttFill &attfill) const
 Copy this fill attributes to a new TAttFill. More...
 
virtual Color_t GetFillColor () const
 Return the fill area color. More...
 
virtual Style_t GetFillStyle () const
 Return the fill area style. More...
 
virtual Bool_t IsTransparent () const
 
virtual void Modify ()
 Change current fill area attributes if necessary. More...
 
virtual void ResetAttFill (Option_t *option="")
 Reset this fill attributes to default values. More...
 
virtual void SaveFillAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
 Save fill attributes as C++ statement(s) on output stream out. More...
 
virtual void SetFillAttributes ()
 Invoke the DialogCanvas Fill attributes. More...
 
virtual void SetFillColor (Color_t fcolor)
 Set the fill area color. More...
 
virtual void SetFillColorAlpha (Color_t fcolor, Float_t falpha)
 Set a transparent fill color. More...
 
virtual void SetFillStyle (Style_t fstyle)
 Set the fill area style. More...
 
- Public Member Functions inherited from TAttMarker
 TAttMarker ()
 TAttMarker default constructor. More...
 
 TAttMarker (Color_t color, Style_t style, Size_t msize)
 TAttMarker normal constructor. More...
 
virtual ~TAttMarker ()
 TAttMarker destructor. More...
 
void Copy (TAttMarker &attmarker) const
 Copy this marker attributes to a new TAttMarker. More...
 
virtual Color_t GetMarkerColor () const
 Return the marker color. More...
 
virtual Size_t GetMarkerSize () const
 Return the marker size. More...
 
virtual Style_t GetMarkerStyle () const
 Return the marker style. More...
 
virtual void Modify ()
 Change current marker attributes if necessary. More...
 
virtual void ResetAttMarker (Option_t *toption="")
 Reset this marker attributes to the default values. More...
 
virtual void SaveMarkerAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
 Save line attributes as C++ statement(s) on output stream out. More...
 
virtual void SetMarkerAttributes ()
 Invoke the DialogCanvas Marker attributes. More...
 
virtual void SetMarkerColor (Color_t mcolor=1)
 Set the marker color. More...
 
virtual void SetMarkerColorAlpha (Color_t mcolor, Float_t malpha)
 Set a transparent marker color. More...
 
virtual void SetMarkerSize (Size_t msize=1)
 Set the marker size. More...
 
virtual void SetMarkerStyle (Style_t mstyle=1)
 Set the marker style. More...
 

Protected Member Functions

 TH2 ()
 Constructor. More...
 
 TH2 (const char *name, const char *title, Int_t nbinsx, const Double_t *xbins, Int_t nbinsy, const Double_t *ybins)
 See comments in the TH1 base class constructors. More...
 
 TH2 (const char *name, const char *title, Int_t nbinsx, const Double_t *xbins, Int_t nbinsy, Double_t ylow, Double_t yup)
 See comments in the TH1 base class constructors. More...
 
 TH2 (const char *name, const char *title, Int_t nbinsx, const Float_t *xbins, Int_t nbinsy, const Float_t *ybins)
 See comments in the TH1 base class constructors. More...
 
 TH2 (const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, const Double_t *ybins)
 See comments in the TH1 base class constructors. More...
 
 TH2 (const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup)
 See comments in the TH1 base class constructors. More...
 
virtual Int_t BufferFill (Double_t x, Double_t y, Double_t w)
 accumulate arguments in buffer. More...
 
Int_t BufferFill (Double_t, Double_t)
 accumulate arguments in buffer. More...
 
virtual void DoFitSlices (bool onX, TF1 *f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t *option, TObjArray *arr)
 
virtual TProfileDoProfile (bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
 
virtual TH1DDoProjection (bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
 Internal (protected) method for performing projection on the X or Y axis called by ProjectionX or ProjectionY. More...
 
virtual TH1DDoQuantiles (bool onX, const char *name, Double_t prob) const
 Implementation of quantiles for x or y. More...
 
Int_t Fill (const char *, Double_t)
 Increment bin with namex with a weight w. More...
 
Int_t Fill (Double_t)
 Invalid Fill method. More...
 
virtual Double_t Interpolate (Double_t x) const
 illegal for a TH2 More...
 
- Protected Member Functions inherited from TH1
 TH1 ()
 Histogram default constructor. More...
 
 TH1 (const char *name, const char *title, Int_t nbinsx, const Double_t *xbins)
 Normal constructor for variable bin size histograms. More...
 
 TH1 (const char *name, const char *title, Int_t nbinsx, const Float_t *xbins)
 Normal constructor for variable bin size histograms. More...
 
 TH1 (const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup)
 Normal constructor for fix bin size histograms. More...
 
virtual Int_t AutoP2FindLimits (Double_t min, Double_t max)
 Buffer-based estimate of the histogram range using the power of 2 algorithm. More...
 
virtual Int_t BufferFill (Double_t x, Double_t w)
 accumulate arguments in buffer. More...
 
virtual void DoFillN (Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1)
 Internal method to fill histogram content from a vector called directly by TH1::BufferEmpty. More...
 
virtual Double_t 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
 Internal function compute integral and optionally the error between the limits specified by the bin number values working for all histograms (1D, 2D and 3D) More...
 
virtual Bool_t FindNewAxisLimits (const TAxis *axis, const Double_t point, Double_t &newMin, Double_t &newMax)
 finds new limits for the axis so that point is within the range and the limits are compatible with the previous ones (see TH1::Merge). More...
 
virtual Double_t GetBinErrorSqUnchecked (Int_t bin) const
 
Bool_t GetStatOverflowsBehaviour () const
 
Bool_t IsEmpty () const
 Check if an histogram is empty (this a protected method used mainly by TH1Merger ) More...
 
virtual Double_t RetrieveBinContent (Int_t bin) const
 Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::GetBin. More...
 
virtual void SavePrimitiveHelp (std::ostream &out, const char *hname, Option_t *option="")
 Helper function for the SavePrimitive functions from TH1 or classes derived from TH1, eg TProfile, TProfile2D. More...
 
virtual void UpdateBinContent (Int_t bin, Double_t content)
 Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin. More...
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 
void MakeZombie ()
 

Protected Attributes

Double_t fScalefactor
 
Double_t fTsumwxy
 
Double_t fTsumwy
 
Double_t fTsumwy2
 
- Protected Attributes inherited from TH1
Short_t fBarOffset
 (1000*offset) for bar charts or legos More...
 
Short_t fBarWidth
 (1000*width) for bar charts or legos More...
 
EBinErrorOpt fBinStatErrOpt
 option for bin statistical errors More...
 
Double_tfBuffer
 [fBufferSize] entry buffer More...
 
Int_t fBufferSize
 fBuffer size More...
 
TArrayD fContour
 Array to display contour levels. More...
 
Int_t fDimension
 !Histogram dimension (1, 2 or 3 dim) More...
 
TDirectoryfDirectory
 !Pointer to directory holding this histogram More...
 
Double_t fEntries
 Number of entries. More...
 
TListfFunctions
 ->Pointer to list of functions (fits and user) More...
 
Double_tfIntegral
 !Integral of bins used by GetRandom More...
 
Double_t fMaximum
 Maximum value for plotting. More...
 
Double_t fMinimum
 Minimum value for plotting. More...
 
Int_t fNcells
 number of bins(1D), cells (2D) +U/Overflows More...
 
Double_t fNormFactor
 Normalization factor. More...
 
TString fOption
 histogram options More...
 
TVirtualHistPainterfPainter
 !pointer to histogram painter More...
 
EStatOverflows fStatOverflows
 per object flag to use under/overflows in statistics More...
 
TArrayD fSumw2
 Array of sum of squares of weights. More...
 
Double_t fTsumw
 Total Sum of weights. More...
 
Double_t fTsumw2
 Total Sum of squares of weights. More...
 
Double_t fTsumwx
 Total Sum of weight*X. More...
 
Double_t fTsumwx2
 Total Sum of weight*X*X. More...
 
TAxis fXaxis
 X axis descriptor. More...
 
TAxis fYaxis
 Y axis descriptor. More...
 
TAxis fZaxis
 Z axis descriptor. More...
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 
- Protected Attributes inherited from TAttLine
Color_t fLineColor
 Line color. More...
 
Style_t fLineStyle
 Line style. More...
 
Width_t fLineWidth
 Line width. More...
 
- Protected Attributes inherited from TAttFill
Color_t fFillColor
 Fill area color. More...
 
Style_t fFillStyle
 Fill area style. More...
 
- Protected Attributes inherited from TAttMarker
Color_t fMarkerColor
 Marker color. More...
 
Size_t fMarkerSize
 Marker size. More...
 
Style_t fMarkerStyle
 Marker style. More...
 

Private Member Functions

 TH2 (const TH2 &)
 Copy constructor. More...
 
virtual Double_t Integral (Int_t binx1, Int_t binx2, Option_t *option="") const
 Return integral of bin contents in range [binx1,binx2]. More...
 
virtual Double_t Integral (Option_t *option="") const
 Return integral of bin contents. More...
 
virtual Double_t IntegralAndError (Int_t binx1, Int_t binx2, Double_t &err, Option_t *option="") const
 Return integral of bin contents in range [binx1,binx2] and its error. More...
 
TH2operator= (const TH2 &)
 

Additional Inherited Members

- Public Types inherited from TH1
enum  {
  kNoAxis = 0 , kXaxis = BIT(0) , kYaxis = BIT(1) , kZaxis = BIT(2) ,
  kAllAxes = kXaxis | kYaxis | kZaxis
}
 
enum  { kNstat = 13 }
 
enum  EBinErrorOpt { kNormal = 0 , kPoisson = 1 , kPoisson2 = 2 }
 
enum  EStatOverflows { kIgnore = 0 , kConsider = 1 , kNeutral = 2 }
 Enumeration specifying the way to treat statoverflow. More...
 
enum  EStatusBits {
  kNoStats = BIT(9) , kUserContour = BIT(10) , kLogX = BIT(15) , kIsZoomed = BIT(16) ,
  kNoTitle = BIT(17) , kIsAverage = BIT(18) , kIsNotW = BIT(19) , kAutoBinPTwo = BIT(20) ,
  kIsHighlight = BIT(21)
}
 
- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = BIT(0) , kOverwrite = BIT(1) , kWriteDelete = BIT(2) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = BIT(3) }
 
enum  EStatusBits {
  kCanDelete = BIT(0) , kMustCleanup = BIT(3) , kIsReferenced = BIT(4) , kHasUUID = BIT(5) ,
  kCannotPick = BIT(6) , kNoContextMenu = BIT(8) , kInvalidObject = BIT(13)
}
 
- Static Public Member Functions inherited from TH1
static void AddDirectory (Bool_t add=kTRUE)
 Sets the flag controlling the automatic add of histograms in memory. More...
 
static Bool_t AddDirectoryStatus ()
 Static function: cannot be inlined on Windows/NT. More...
 
static Int_t FitOptionsMake (Option_t *option, Foption_t &Foption)
 Decode string choptin and fill fitOption structure. More...
 
static Int_t GetDefaultBufferSize ()
 Static function return the default buffer size for automatic histograms the parameter fgBufferSize may be changed via SetDefaultBufferSize. More...
 
static Bool_t GetDefaultSumw2 ()
 Return kTRUE if TH1::Sumw2 must be called when creating new histograms. More...
 
static void SetDefaultBufferSize (Int_t buffersize=1000)
 Static function to set the default buffer size for automatic histograms. More...
 
static void SetDefaultSumw2 (Bool_t sumw2=kTRUE)
 When this static function is called with sumw2=kTRUE, all new histograms will automatically activate the storage of the sum of squares of errors, ie TH1::Sumw2 is automatically called. More...
 
static void SmoothArray (Int_t NN, Double_t *XX, Int_t ntimes=1)
 Smooth array xx, translation of Hbook routine hsmoof.F based on algorithm 353QH twice presented by J. More...
 
static void StatOverflows (Bool_t flag=kTRUE)
 if flag=kTRUE, underflows and overflows are used by the Fill functions in the computation of statistics (mean value, StdDev). More...
 
static TH1TransformHisto (TVirtualFFT *fft, TH1 *h_output, Option_t *option)
 For a given transform (first parameter), fills the histogram (second parameter) with the transform output data, specified in the third parameter If the 2nd parameter h_output is empty, a new histogram (TH1D or TH2D) is created and the user is responsible for deleting it. More...
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 
- Static Public Member Functions inherited from TAttMarker
static Width_t GetMarkerLineWidth (Style_t style)
 Internal helper function that returns the line width of the given marker style (0 = filled marker) More...
 
static Style_t GetMarkerStyleBase (Style_t style)
 Internal helper function that returns the corresponding marker style with line width 1 for the given style. More...
 
- Protected Types inherited from TObject
enum  { kOnlyPrepStep = BIT(3) }
 
- Static Protected Member Functions inherited from TH1
static Int_t AutoP2GetBins (Int_t n)
 Auxilliary function to get the next power of 2 integer value larger then n. More...
 
static Double_t AutoP2GetPower2 (Double_t x, Bool_t next=kTRUE)
 Auxilliary function to get the power of 2 next (larger) or previous (smaller) a given x. More...
 
static bool CheckAxisLimits (const TAxis *a1, const TAxis *a2)
 Check that the axis limits of the histograms are the same. More...
 
static bool CheckBinLabels (const TAxis *a1, const TAxis *a2)
 Check that axis have same labels. More...
 
static bool CheckBinLimits (const TAxis *a1, const TAxis *a2)
 Check bin limits. More...
 
static bool CheckConsistency (const TH1 *h1, const TH1 *h2)
 Check histogram compatibility. More...
 
static bool CheckConsistentSubAxes (const TAxis *a1, Int_t firstBin1, Int_t lastBin1, const TAxis *a2, Int_t firstBin2=0, Int_t lastBin2=0)
 Check that two sub axis are the same. More...
 
static bool CheckEqualAxes (const TAxis *a1, const TAxis *a2)
 Check that the axis are the same. More...
 
static Bool_t RecomputeAxisLimits (TAxis &destAxis, const TAxis &anAxis)
 Finds new limits for the axis for the Merge function. More...
 
static Bool_t SameLimitsAndNBins (const TAxis &axis1, const TAxis &axis2)
 Same limits and bins. More...
 
- Static Protected Attributes inherited from TH1
static Bool_t fgAddDirectory = kTRUE
 !flag to add histograms to the directory More...
 
static Int_t fgBufferSize = 1000
 !default buffer size for automatic histograms More...
 
static Bool_t fgDefaultSumw2 = kFALSE
 !flag to call TH1::Sumw2 automatically at histogram creation time More...
 
static Bool_t fgStatOverflows = kFALSE
 !flag to use under/overflows in statistics More...
 

#include <TH2.h>

Inheritance diagram for TH2:
[legend]

Constructor & Destructor Documentation

◆ TH2() [1/7]

TH2::TH2 ( )
protected

Constructor.

Definition at line 62 of file TH2.cxx.

◆ TH2() [2/7]

TH2::TH2 ( const char *  name,
const char *  title,
Int_t  nbinsx,
Double_t  xlow,
Double_t  xup,
Int_t  nbinsy,
Double_t  ylow,
Double_t  yup 
)
protected

See comments in the TH1 base class constructors.

Definition at line 73 of file TH2.cxx.

◆ TH2() [3/7]

TH2::TH2 ( const char *  name,
const char *  title,
Int_t  nbinsx,
const Double_t xbins,
Int_t  nbinsy,
Double_t  ylow,
Double_t  yup 
)
protected

See comments in the TH1 base class constructors.

Definition at line 89 of file TH2.cxx.

◆ TH2() [4/7]

TH2::TH2 ( const char *  name,
const char *  title,
Int_t  nbinsx,
Double_t  xlow,
Double_t  xup,
Int_t  nbinsy,
const Double_t ybins 
)
protected

See comments in the TH1 base class constructors.

Definition at line 105 of file TH2.cxx.

◆ TH2() [5/7]

TH2::TH2 ( const char *  name,
const char *  title,
Int_t  nbinsx,
const Double_t xbins,
Int_t  nbinsy,
const Double_t ybins 
)
protected

See comments in the TH1 base class constructors.

Definition at line 122 of file TH2.cxx.

◆ TH2() [6/7]

TH2::TH2 ( const char *  name,
const char *  title,
Int_t  nbinsx,
const Float_t xbins,
Int_t  nbinsy,
const Float_t ybins 
)
protected

See comments in the TH1 base class constructors.

Definition at line 139 of file TH2.cxx.

◆ TH2() [7/7]

TH2::TH2 ( const TH2 h)
private

Copy constructor.

The list of functions is not copied. (Use Clone if needed)

Definition at line 157 of file TH2.cxx.

◆ ~TH2()

TH2::~TH2 ( )
virtual

Destructor.

Definition at line 166 of file TH2.cxx.

Member Function Documentation

◆ BufferEmpty()

Int_t TH2::BufferEmpty ( Int_t  action = 0)
virtual

Fill histogram with all entries in the buffer.

  • action = -1 histogram is reset and refilled from the buffer (called by THistPainter::Paint)
  • action = 0 histogram is filled from the buffer
  • action = 1 histogram is filled and buffer is deleted The buffer is automatically deleted when the number of entries in the buffer is greater than the number of entries in the histogram

Reimplemented from TH1.

Reimplemented in TProfile2D.

Definition at line 179 of file TH2.cxx.

◆ BufferFill() [1/2]

Int_t TH2::BufferFill ( Double_t  x,
Double_t  y,
Double_t  w 
)
protectedvirtual

accumulate arguments in buffer.

When buffer is full, empty the buffer

fBuffer[0] = number of entries in buffer
fBuffer[1] = w of first entry
fBuffer[2] = x of first entry
fBuffer[3] = y of first entry
Double_t * fBuffer
[fBufferSize] entry buffer
Definition: TH1.h:105
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Definition: first.py:1

Reimplemented in TProfile2D.

Definition at line 253 of file TH2.cxx.

◆ BufferFill() [2/2]

Int_t TH2::BufferFill ( Double_t  x,
Double_t  w 
)
inlineprotectedvirtual

accumulate arguments in buffer.

When buffer is full, empty the buffer

  • fBuffer[0] = number of entries in buffer
  • fBuffer[1] = w of first entry
  • fBuffer[2] = x of first entry

Reimplemented from TH1.

Reimplemented in TProfile2D.

Definition at line 56 of file TH2.h.

◆ Copy()

void TH2::Copy ( TObject hnew) const
virtual

Copy.

Reimplemented from TH1.

Reimplemented in TH2C, TH2S, TH2I, TH2F, TH2D, and TProfile2D.

Definition at line 281 of file TH2.cxx.

◆ DoFitSlices()

void TH2::DoFitSlices ( bool  onX,
TF1 f1,
Int_t  firstbin,
Int_t  lastbin,
Int_t  cut,
Option_t option,
TObjArray arr 
)
protectedvirtual

Definition at line 695 of file TH2.cxx.

◆ DoProfile()

TProfile * TH2::DoProfile ( bool  onX,
const char *  name,
Int_t  firstbin,
Int_t  lastbin,
Option_t option 
) const
protectedvirtual

Reimplemented in TProfile2D.

Definition at line 1751 of file TH2.cxx.

◆ DoProjection()

TH1D * TH2::DoProjection ( bool  onX,
const char *  name,
Int_t  firstbin,
Int_t  lastbin,
Option_t option 
) const
protectedvirtual

Internal (protected) method for performing projection on the X or Y axis called by ProjectionX or ProjectionY.

Definition at line 2034 of file TH2.cxx.

◆ DoQuantiles()

TH1D * TH2::DoQuantiles ( bool  onX,
const char *  name,
Double_t  prob 
) const
protectedvirtual

Implementation of quantiles for x or y.

Definition at line 2391 of file TH2.cxx.

◆ Fill() [1/7]

Int_t TH2::Fill ( const char *  namex,
Double_t  w 
)
inlineprotectedvirtual

Increment bin with namex with a weight w.

if x is less than the low-edge of the first bin, the Underflow bin is incremented if x is equal to or greater than the upper edge of last bin, the Overflow bin is incremented

If the weight is not equal to 1, the storage of the sum of squares of weights is automatically triggered and the sum of the squares of weights is incremented by \( w^2 \) in the bin corresponding to x.

The function returns the corresponding bin number which has its content incremented by w.

Reimplemented from TH1.

Reimplemented in TProfile2D, TH2Poly, and TProfile2Poly.

Definition at line 58 of file TH2.h.

◆ Fill() [2/7]

Int_t TH2::Fill ( const char *  namex,
const char *  namey,
Double_t  w 
)
virtual

Increment cell defined by namex,namey by a weight w.

  • if x or/and y is less than the low-edge of the corresponding axis first bin, the Underflow cell is incremented.
  • if x or/and y is equal to or greater than the upper edge of corresponding axis last bin, the Overflow cell is incremented.
    • If the weight is not equal to 1, the storage of the sum of squares of weights is automatically triggered and the sum of the squares of weights is incremented by w^2 in the bin corresponding to namex,namey

The function returns the corresponding global bin number which has its content incremented by w

Reimplemented in TH2Poly, TProfile2Poly, TProfile2D, and TProfile2D.

Definition at line 406 of file TH2.cxx.

◆ Fill() [3/7]

Int_t TH2::Fill ( const char *  namex,
Double_t  y,
Double_t  w 
)
virtual

Increment cell defined by namex,y by a weight w.

  • if x or/and y is less than the low-edge of the corresponding axis first bin, the Underflow cell is incremented.
  • if x or/and y is equal to or greater than the upper edge of corresponding axis last bin, the Overflow cell is incremented.
  • If the weight is not equal to 1, the storage of the sum of squares of weights is automatically triggered and the sum of the squares of weights is incremented by w^2 in the bin corresponding to namex,y

The function returns the corresponding global bin number which has its content incremented by w

Reimplemented in TH2Poly, TProfile2Poly, TProfile2D, and TProfile2D.

Definition at line 448 of file TH2.cxx.

◆ Fill() [4/7]

Int_t TH2::Fill ( Double_t  x,
const char *  namey,
Double_t  w 
)
virtual

Increment cell defined by x,namey by a weight w.

  • if x or/and y is less than the low-edge of the corresponding axis first bin, the Underflow cell is incremented.
  • if x or/and y is equal to or greater than the upper edge of corresponding axis last bin, the Overflow cell is incremented.
  • If the weight is not equal to 1, the storage of the sum of squares of weights is automatically triggered and the sum of the squares of weights is incremented by w^2 in the bin corresponding to x,y.

The function returns the corresponding global bin number which has its content incremented by w

Reimplemented in TProfile2D, TProfile2D, TH2Poly, and TProfile2Poly.

Definition at line 491 of file TH2.cxx.

◆ Fill() [5/7]

Int_t TH2::Fill ( Double_t  x,
Double_t  y 
)
virtual

Increment cell defined by x,y by 1.

  • if x or/and y is less than the low-edge of the corresponding axis first bin, the Underflow cell is incremented.
  • if x or/and y is equal to or greater than the upper edge of corresponding axis last bin, the Overflow cell 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 cell corresponding to x,y.

The function returns the corresponding global bin number which has its content incremented by 1

Reimplemented from TH1.

Reimplemented in TH2Poly, TProfile2D, TProfile2Poly, and TProfile2D.

Definition at line 316 of file TH2.cxx.

◆ Fill() [6/7]

Int_t TH2::Fill ( Double_t  x,
Double_t  y,
Double_t  w 
)
virtual

Increment cell defined by x,y by a weight w.

  • if x or/and y is less than the low-edge of the corresponding axis first bin, the Underflow cell is incremented.
  • if x or/and y is equal to or greater than the upper edge of corresponding axis last bin, the Overflow cell is incremented.
    • If the weight is not equal to 1, the storage of the sum of squares of weights is automatically triggered and the sum of the squares of weights is incremented by w^2 in the bin corresponding to x,y

The function returns the corresponding global bin number which has its content incremented by w

Reimplemented in TH2Poly, TProfile2D, TProfile2Poly, TProfile2D, and TProfile2Poly.

Definition at line 360 of file TH2.cxx.

◆ Fill() [7/7]

Int_t TH2::Fill ( Double_t  )
protectedvirtual

Invalid Fill method.

Reimplemented from TH1.

Reimplemented in TH2Poly, TProfile2D, and TProfile2Poly.

Definition at line 294 of file TH2.cxx.

◆ FillN() [1/2]

void TH2::FillN ( Int_t  ntimes,
const Double_t x,
const Double_t y,
const Double_t w,
Int_t  stride = 1 
)
virtual

Fill 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
    • If the weight is not equal to 1, the storage of the sum of squares of weights is automatically triggered and the sum of the squares of weights is incremented by w[i]^2 in the bin corresponding to x[i],y[i].
    • If w is NULL each entry is assumed a weight=1

NB: function only valid for a TH2x object

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 535 of file TH2.cxx.

◆ FillN() [2/2]

virtual void TH2::FillN ( Int_t  ntimes,
const Double_t x,
const Double_t w,
Int_t  stride 
)
inlinevirtual

Fill this histogram with an array x and weights w.

Parameters
[in]ntimesnumber of entries in arrays x and w (array size must be ntimes*stride)
[in]xarray of values to be histogrammed
[in]warray of weighs
[in]stridestep size through arrays x and w

If the weight is not equal to 1, the storage of the sum of squares of weights is automatically triggered and the sum of the squares of weights is incremented by \( w^2 \) in the bin corresponding to x. if w is NULL each entry is assumed a weight=1

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 80 of file TH2.h.

◆ FillRandom() [1/2]

void TH2::FillRandom ( const char *  fname,
Int_t  ntimes = 5000 
)
virtual

Fill histogram following distribution in function fname.

The distribution contained in the function fname (TF2) 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 TF2::GetRandom2 to get a random variate from a function.

Reimplemented from TH1.

Definition at line 599 of file TH2.cxx.

◆ FillRandom() [2/2]

void TH2::FillRandom ( TH1 h,
Int_t  ntimes = 5000 
)
virtual

Fill histogram following distribution in histogram h.

The distribution contained in the histogram h (TH2) 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

Reimplemented from TH1.

Definition at line 674 of file TH2.cxx.

◆ FitSlicesX()

void TH2::FitSlicesX ( TF1 f1 = 0,
Int_t  firstybin = 0,
Int_t  lastybin = -1,
Int_t  cut = 0,
Option_t option = "QNR",
TObjArray arr = 0 
)
virtual

Project slices along X in case of a 2-D histogram, then fit each slice with function f1 and make a histogram for each fit parameter Only bins along Y between firstybin and lastybin are considered.

By default (firstybin == 0, lastybin == -1), all bins in y including over- and underflows are taken into account. If f1=0, a gaussian is assumed Before invoking this function, one can set a subrange to be fitted along X via f1->SetRange(xmin,xmax) The argument option (default="QNR") can be used to change the fit options.

  • "Q" means Quiet mode
  • "N" means do not show the result of the fit
  • "R" means fit the function in the specified function range
  • "G2" merge 2 consecutive bins along X
  • "G3" merge 3 consecutive bins along X
  • "G4" merge 4 consecutive bins along X
  • "G5" merge 5 consecutive bins along X
  • "S" sliding merge: merge n consecutive bins along X accordingly to what Gn is given. It makes sense when used together with a Gn option

The generated histograms are returned by adding them to arr, if arr is not NULL. arr's SetOwner() is called, to signal that it is the user's responsibility to delete the histograms, possibly by deleting the array.

TObjArray aSlices;
h2->FitSlicesX(func, 0, -1, 0, "QNR", &aSlices);
An array of TObjects.
Definition: TObjArray.h:37

will already delete the histograms once aSlice goes out of scope. aSlices will contain the histogram for the i-th parameter of the fit function at aSlices[i]; aSlices[n] (n being the number of parameters) contains the chi2 distribution of the fits.

If arr is NULL, the generated histograms are added to the list of objects in the current directory. It is the user's responsibility to delete these histograms.

Example: Assume a 2-d histogram h2

Root > h2->FitSlicesX(); produces 4 TH1D histograms
with h2_0 containing parameter 0(Constant) for a Gaus fit
of each bin in Y projected along X
with h2_1 containing parameter 1(Mean) for a gaus fit
with h2_2 containing parameter 2(StdDev) for a gaus fit
with h2_chi2 containing the chisquare/number of degrees of freedom for a gaus fit
Root > h2->FitSlicesX(0,15,22,10);
same as above, but only for bins 15 to 22 along Y
and only for bins in Y for which the corresponding projection
along X has more than cut bins filled.
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:614
Double_t Gaus(Double_t x, Double_t mean, Double_t sigma)
Gauss.
TString as(SEXP s)
Definition: RExports.h:71
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Return the weighted mean of an array a with length n.
Definition: TMath.h:1063
Double_t StdDev(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:518
const char * Root
Definition: TXMLSetup.cxx:46
auto * a
Definition: textangle.C:12

NOTE: To access the generated histograms in the current directory, do eg:

TH1D *h2_1 = (TH1D*)gDirectory->Get("h2_1");
#define gDirectory
Definition: TDirectory.h:229

Definition at line 897 of file TH2.cxx.

◆ FitSlicesY()

void TH2::FitSlicesY ( TF1 f1 = 0,
Int_t  firstxbin = 0,
Int_t  lastxbin = -1,
Int_t  cut = 0,
Option_t option = "QNR",
TObjArray arr = 0 
)
virtual

Project slices along Y in case of a 2-D histogram, then fit each slice with function f1 and make a histogram for each fit parameter Only bins along X between firstxbin and lastxbin are considered.

By default (firstxbin == 0, lastxbin == -1), all bins in x including over- and underflows are taken into account. If f1=0, a gaussian is assumed Before invoking this function, one can set a subrange to be fitted along Y via f1->SetRange(ymin,ymax) The argument option (default="QNR") can be used to change the fit options.

  • "Q" means Quiet mode
  • "N" means do not show the result of the fit
  • "R" means fit the function in the specified function range
  • "G2" merge 2 consecutive bins along Y
  • "G3" merge 3 consecutive bins along Y
  • "G4" merge 4 consecutive bins along Y
  • "G5" merge 5 consecutive bins along Y
  • "S" sliding merge: merge n consecutive bins along Y accordingly to what Gn is given. It makes sense when used together with a Gn option

The generated histograms are returned by adding them to arr, if arr is not NULL. arr's SetOwner() is called, to signal that it is the user's responsibility to delete the histograms, possibly by deleting the array.

TObjArray aSlices;
h2->FitSlicesY(func, 0, -1, 0, "QNR", &aSlices);

will already delete the histograms once aSlice goes out of scope. aSlices will contain the histogram for the i-th parameter of the fit function at aSlices[i]; aSlices[n] (n being the number of parameters) contains the chi2 distribution of the fits.

If arr is NULL, the generated histograms are added to the list of objects in the current directory. It is the user's responsibility to delete these histograms.

Example: Assume a 2-d histogram h2

Root > h2->FitSlicesY(); produces 4 TH1D histograms
with h2_0 containing parameter 0(Constant) for a Gaus fit
of each bin in X projected along Y
with h2_1 containing parameter 1(Mean) for a gaus fit
with h2_2 containing parameter 2(StdDev) for a gaus fit
with h2_chi2 containing the chisquare/number of degrees of freedom for a gaus fit
Root > h2->FitSlicesY(0,15,22,10);
same as above, but only for bins 15 to 22 along X
and only for bins in X for which the corresponding projection
along Y has more than cut bins filled.

NOTE: To access the generated histograms in the current directory, do eg:

TH1D *h2_1 = (TH1D*)gDirectory->Get("h2_1");

A complete example of this function is given in tutorial:fitslicesy.C.

Definition at line 962 of file TH2.cxx.

◆ GetBin()

Int_t TH2::GetBin ( Int_t  binx,
Int_t  biny,
Int_t  binz = 0 
) const
virtual

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. see TH1::GetBinXYZ for the inverse transformation.

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 bin = h->GetBin(binx,biny,binz);
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:43

returns a global/linearized bin number. This global bin is useful to access the bin information independently of the dimension.

Reimplemented from TH1.

Definition at line 967 of file TH2.cxx.

◆ GetBinContent() [1/3]

virtual Double_t TH2::GetBinContent ( Int_t  bin) const
inlinevirtual

Return content of bin number bin.

Implemented in TH1C,S,F,D

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 bin = h->GetBin(binx,biny,binz);

returns a global/linearized bin number. This global bin is useful to access the bin information independently of the dimension.

Reimplemented from TH1.

Reimplemented in TH2Poly, TProfile2D, TProfile2Poly, and TProfile2Poly.

Definition at line 88 of file TH2.h.

◆ GetBinContent() [2/3]

virtual Double_t TH2::GetBinContent ( Int_t  binx,
Int_t  biny 
) const
inlinevirtual

Reimplemented from TH1.

Reimplemented in TProfile2D, TH2Poly, and TProfile2Poly.

Definition at line 89 of file TH2.h.

◆ GetBinContent() [3/3]

virtual Double_t TH2::GetBinContent ( Int_t  binx,
Int_t  biny,
Int_t   
) const
inlinevirtual

Reimplemented from TH1.

Reimplemented in TProfile2D, TH2Poly, and TProfile2Poly.

Definition at line 90 of file TH2.h.

◆ GetBinErrorLow() [1/2]

Double_t TH1::GetBinErrorLow ( Int_t  bin) const
virtual

Return lower error associated to bin number bin.

The error will depend on the statistic option used will return the binContent - lower interval value

Reimplemented from TH1.

Definition at line 266 of file TH1.cxx.

◆ GetBinErrorLow() [2/2]

virtual Double_t TH2::GetBinErrorLow ( Int_t  binx,
Int_t  biny 
)
inlinevirtual

Definition at line 93 of file TH2.h.

◆ GetBinErrorUp() [1/2]

Double_t TH1::GetBinErrorUp ( Int_t  bin) const
virtual

Return upper error associated to bin number bin.

The error will depend on the statistic option used will return the binContent - upper interval value

Reimplemented from TH1.

Definition at line 267 of file TH1.cxx.

◆ GetBinErrorUp() [2/2]

virtual Double_t TH2::GetBinErrorUp ( Int_t  binx,
Int_t  biny 
)
inlinevirtual

Definition at line 94 of file TH2.h.

◆ GetBinWithContent2()

Double_t TH2::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

compute first cell (binx,biny) in the range [firstxbin,lastxbin][firstybin,lastybin] for which diff = abs(cell_content-c) <= maxdiff In case several cells in the specified range with diff=0 are found the first cell found is returned in binx,biny.

In case several cells in the specified range satisfy diff <=maxdiff the cell with the smallest difference is returned in binx,biny. In all cases the function returns the smallest difference.

NOTE1: if firstxbin < 0, firstxbin is set to 1 if (lastxbin < firstxbin then lastxbin is set to the number of bins in X ie if firstxbin=1 and lastxbin=0 (default) the search is on all bins in X except for X's under- and overflow bins. if firstybin < 0, firstybin is set to 1 if (lastybin < firstybin then lastybin is set to the number of bins in Y ie if firstybin=1 and lastybin=0 (default) the search is on all bins in Y except for Y's under- and overflow bins.

NOTE2: if maxdiff=0 (default), the first cell with content=c is returned.

Definition at line 998 of file TH2.cxx.

◆ GetCorrelationFactor()

Double_t TH2::GetCorrelationFactor ( Int_t  axis1 = 1,
Int_t  axis2 = 2 
) const
virtual

Return correlation factor between axis1 and axis2.

Definition at line 1026 of file TH2.cxx.

◆ GetCovariance()

Double_t TH2::GetCovariance ( Int_t  axis1 = 1,
Int_t  axis2 = 2 
) const
virtual

Return covariance between axis1 and axis2.

Definition at line 1044 of file TH2.cxx.

◆ GetRandom2()

void TH2::GetRandom2 ( Double_t x,
Double_t y 
)
virtual

Return 2 random numbers along axis x and y distributed according the cell-contents of a 2-dim histogram return a NaN if the histogram has a bin with negative content.

Definition at line 1076 of file TH2.cxx.

◆ GetStats()

void TH2::GetStats ( Double_t stats) const
virtual

Fill the array stats from the contents of this histogram The array stats must be correctly dimensioned in the calling program.

stats[0] = sumw
stats[1] = sumw2
stats[2] = sumwx
stats[3] = sumwx2
stats[4] = sumwy
stats[5] = sumwy2
stats[6] = sumwxy

If no axis-subranges are specified (via TAxis::SetRange), the array stats is simply a copy of the statistics quantities computed at filling time. If sub-ranges are specified, the function recomputes these quantities from the bin contents in the current axis ranges.

Note that the mean value/StdDev is computed using the bins in the currently defined ranges (see TAxis::SetRange). By default the ranges include all bins from 1 to nbins included, excluding underflows and overflows. To force the underflows and overflows in the computation, one must call the static function TH1::StatOverflows(kTRUE) before filling the histogram.

Reimplemented from TH1.

Reimplemented in TH2Poly, TProfile2D, and TProfile2Poly.

Definition at line 1129 of file TH2.cxx.

◆ Integral() [1/5]

Double_t TH2::Integral ( Int_t  firstxbin,
Int_t  lastxbin,
Int_t  firstybin,
Int_t  lastybin,
Option_t option = "" 
) const
virtual

Return integral of bin contents in range [firstxbin,lastxbin],[firstybin,lastybin] for a 2-D histogram By default the integral is computed as the sum of bin contents in the range.

if option "width" is specified, the integral is the sum of the bin contents multiplied by the bin width in x and in y.

Definition at line 1202 of file TH2.cxx.

◆ Integral() [2/5]

Double_t TH1::Integral ( Int_t  binx1,
Int_t  binx2,
Option_t option = "" 
) const
privatevirtual

Return integral of bin contents in range [binx1,binx2].

By default the integral is computed as the sum of bin contents in the range. if option "width" is specified, the integral is the sum of the bin contents multiplied by the bin width in x.

Reimplemented from TH1.

Definition at line 323 of file TH1.cxx.

◆ Integral() [3/5]

virtual Double_t TH2::Integral ( Int_t  ,
Int_t  ,
Int_t  ,
Int_t  ,
Int_t  ,
Int_t  ,
Option_t = "" 
) const
inlinevirtual

Definition at line 102 of file TH2.h.

◆ Integral() [4/5]

Double_t TH1::Integral ( Option_t option = "") const
privatevirtual

Return integral of bin contents.

Only bins in the bins range are considered.

By default the integral is computed as the sum of bin contents in the range. if option "width" is specified, the integral is the sum of the bin contents multiplied by the bin width in x.

Reimplemented from TH1.

Definition at line 322 of file TH1.cxx.

◆ Integral() [5/5]

Double_t TH2::Integral ( Option_t option = "") const
virtual

Return integral of bin contents.

Only bins in the bins range are considered. By default the integral is computed as the sum of bin contents in the range. if option "width" is specified, the integral is the sum of the bin contents multiplied by the bin width in x and in y.

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 1188 of file TH2.cxx.

◆ IntegralAndError() [1/2]

Double_t TH1::IntegralAndError ( Int_t  binx1,
Int_t  binx2,
Double_t error,
Option_t option = "" 
) const
privatevirtual

Return integral of bin contents in range [binx1,binx2] and its error.

By default the integral is computed as the sum of bin contents in the range. if option "width" is specified, the integral is the sum of the bin contents multiplied by the bin width in x. the error is computed using error propagation from the bin errors assuming that all the bins are uncorrelated

Reimplemented from TH1.

Definition at line 324 of file TH1.cxx.

◆ IntegralAndError() [2/2]

Double_t TH2::IntegralAndError ( Int_t  firstxbin,
Int_t  lastxbin,
Int_t  firstybin,
Int_t  lastybin,
Double_t error,
Option_t option = "" 
) const
virtual

Return integral of bin contents in range [firstxbin,lastxbin],[firstybin,lastybin] for a 2-D histogram.

Calculates also the integral error using error propagation from the bin errors assuming that all the bins are uncorrelated. By default the integral is computed as the sum of bin contents in the range. if option "width" is specified, the integral is the sum of the bin contents multiplied by the bin width in x and in y.

Definition at line 1216 of file TH2.cxx.

◆ Interpolate() [1/3]

Double_t TH2::Interpolate ( Double_t  x) const
protectedvirtual

illegal for a TH2

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 1224 of file TH2.cxx.

◆ Interpolate() [2/3]

Double_t TH2::Interpolate ( Double_t  x,
Double_t  y 
) const
virtual

Given a point P(x,y), Interpolate approximates the value via bilinear interpolation based on the four nearest bin centers see Wikipedia, Bilinear Interpolation Andy Mastbaum 10/8/2008 vaguely based on R.Raja 6-Sep-2008.

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 1237 of file TH2.cxx.

◆ Interpolate() [3/3]

Double_t TH2::Interpolate ( Double_t  x,
Double_t  y,
Double_t  z 
) const
virtual

illegal for a TH2

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 1311 of file TH2.cxx.

◆ KolmogorovTest()

Double_t TH2::KolmogorovTest ( const TH1 h2,
Option_t option = "" 
) const
virtual

Statistical test of compatibility in shape between THIS histogram and h2, using Kolmogorov test.

Default: Ignore under- and overflow bins in comparison

option is a character string to specify options

  • "U" include Underflows in test
  • "O" include Overflows
  • "N" include comparison of normalizations
  • "D" Put out a line of "Debug" printout
  • "M" Return the Maximum Kolmogorov distance instead of prob

The returned function value is the probability of test (much less than one means NOT compatible)

The KS test uses the distance between the pseudo-CDF's obtained from the histogram. Since in 2D the order for generating the pseudo-CDF is arbitrary, two pairs of pseudo-CDF are used, one starting from the x axis the other from the y axis and the maximum distance is the average of the two maximum distances obtained.

Code adapted by Rene Brun from original HBOOK routine HDIFF

Reimplemented from TH1.

Definition at line 1341 of file TH2.cxx.

◆ operator=()

TH2 & TH2::operator= ( const TH2 )
private

◆ ProfileX()

TProfile * TH2::ProfileX ( const char *  name = "_pfx",
Int_t  firstybin = 1,
Int_t  lastybin = -1,
Option_t option = "" 
) const

Project a 2-D histogram into a profile histogram along X.

The projection is made from the channels along the Y axis ranging from firstybin to lastybin included. By default, bins 1 to ny are included When all bins are included, the number of entries in the projection is set to the number of entries of the 2-D histogram, otherwise the number of entries is incremented by 1 for all non empty cells.

if option "d" is specified, the profile is drawn in the current pad.

if option "o" original axis range of the target axes will be kept, but only bins inside the selected range will be filled.

The option can also be used to specify the projected profile error type. Values which can be used are 's', 'i', or 'g'. See TProfile::BuildOptions for details

Using a TCutG object, it is possible to select a sub-range of a 2-D histogram. One must create a graphical cut (mouse or C++) and specify the name of the cut between [] in the option. For example, with a TCutG named "cutg", one can call: myhist->ProfileX(" ",firstybin,lastybin,"[cutg]"); To invert the cut, it is enough to put a "-" in front of its name: myhist->ProfileX(" ",firstybin,lastybin,"[-cutg]"); It is possible to apply several cuts ("," means logical AND): myhist->ProfileX(" ",firstybin,lastybin,"[cutg1,cutg2]");

NOTE that if a TProfile named "name" exists in the current directory or pad with a compatible axis the profile is reset and filled again with the projected contents of the TH2. In the case of axis incompatibility an error is reported and a NULL pointer is returned.

NOTE that the X axis attributes of the TH2 are copied to the X axis of the profile.

NOTE that the default under- / overflow behavior differs from what ProjectionX does! Profiles take the bin center into account, so here the under- and overflow bins are ignored by default.

NOTE that the return profile histogram is computed using the Y bin center values instead of the real Y values which are used to fill the 2d histogram. Therefore the obtained profile is just an approximation of the correct profile histogram that would be obtained when filling it directly with the original data (see ROOT-7770)

Definition at line 1974 of file TH2.cxx.

◆ ProfileY()

TProfile * TH2::ProfileY ( const char *  name = "_pfy",
Int_t  firstxbin = 1,
Int_t  lastxbin = -1,
Option_t option = "" 
) const

Project a 2-D histogram into a profile histogram along Y.

The projection is made from the channels along the X axis ranging from firstxbin to lastxbin included. By default, bins 1 to nx are included When all bins are included, the number of entries in the projection is set to the number of entries of the 2-D histogram, otherwise the number of entries is incremented by 1 for all non empty cells.

if option "d" is specified, the profile is drawn in the current pad.

if option "o" , the original axis range of the target axis will be kept, but only bins inside the selected range will be filled.

The option can also be used to specify the projected profile error type. Values which can be used are 's', 'i', or 'g'. See TProfile::BuildOptions for details Using a TCutG object, it is possible to select a sub-range of a 2-D histogram.

One must create a graphical cut (mouse or C++) and specify the name of the cut between [] in the option. For example, with a TCutG named "cutg", one can call: myhist->ProfileY(" ",firstybin,lastybin,"[cutg]"); To invert the cut, it is enough to put a "-" in front of its name: myhist->ProfileY(" ",firstybin,lastybin,"[-cutg]"); It is possible to apply several cuts: myhist->ProfileY(" ",firstybin,lastybin,"[cutg1,cutg2]");

NOTE that if a TProfile named "name" exists in the current directory or pad with a compatible axis the profile is reset and filled again with the projected contents of the TH2. In the case of axis incompatibility an error is reported and a NULL pointer is returned.

NOTE that the Y axis attributes of the TH2 are copied to the X axis of the profile.

NOTE that the default under- / overflow behavior differs from what ProjectionX does! Profiles take the bin center into account, so here the under- and overflow bins are ignored by default.

NOTE that the return profile histogram is computed using the X bin center values instead of the real X values which are used to fill the 2d histogram. Therefore the obtained profile is just an approximation of the correct profile histogram that would be obtained when filling it directly with the original data (see ROOT-7770)

Definition at line 2024 of file TH2.cxx.

◆ ProjectionX()

TH1D * TH2::ProjectionX ( const char *  name = "_px",
Int_t  firstybin = 0,
Int_t  lastybin = -1,
Option_t option = "" 
) const

Project a 2-D histogram into a 1-D histogram along X.

The projection is always of the type TH1D. The projection is made from the channels along the Y axis ranging from firstybin to lastybin included. By default, all bins including under- and overflow are included. The number of entries in the projection is estimated from the number of effective entries for all the cells included in the projection.

To exclude the underflow bins in Y, use firstybin=1. To exclude the overflow bins in Y, use lastybin=nx.

if option "e" is specified, the errors are computed. if option "d" is specified, the projection is drawn in the current pad. if option "o" original axis range of the taget axes will be kept, but only bins inside the selected range will be filled.

Using a TCutG object, it is possible to select a sub-range of a 2-D histogram. One must create a graphical cut (mouse or C++) and specify the name of the cut between [] in the option. For example, with a TCutG named "cutg", one can call: myhist->ProjectionX(" ",firstybin,lastybin,"[cutg]"); To invert the cut, it is enough to put a "-" in front of its name: myhist->ProjectionX(" ",firstybin,lastybin,"[-cutg]"); It is possible to apply several cuts: myhist->ProjectionX(" ",firstybin,lastybin,"[cutg1,cutg2]");

NOTE that if a TH1D named "name" exists in the current directory or pad the histogram is reset and filled again with the projected contents of the TH2.

NOTE that the X axis attributes of the TH2 are copied to the X axis of the projection.

Definition at line 2300 of file TH2.cxx.

◆ ProjectionY()

TH1D * TH2::ProjectionY ( const char *  name = "_py",
Int_t  firstxbin = 0,
Int_t  lastxbin = -1,
Option_t option = "" 
) const

Project a 2-D histogram into a 1-D histogram along Y.

The projection is always of the type TH1D. The projection is made from the channels along the X axis ranging from firstxbin to lastxbin included. By default, all bins including under- and overflow are included. The number of entries in the projection is estimated from the number of effective entries for all the cells included in the projection

To exclude the underflow bins in X, use firstxbin=1. To exclude the overflow bins in X, use lastxbin=nx.

if option "e" is specified, the errors are computed. if option "d" is specified, the projection is drawn in the current pad. if option "o" original axis range of the taget axes will be kept, but only bins inside the selected range will be filled.

Using a TCutG object, it is possible to select a sub-range of a 2-D histogram. One must create a graphical cut (mouse or C++) and specify the name of the cut between [] in the option. For example, with a TCutG named "cutg", one can call: myhist->ProjectionY(" ",firstxbin,lastxbin,"[cutg]"); To invert the cut, it is enough to put a "-" in front of its name: myhist->ProjectionY(" ",firstxbin,lastxbin,"[-cutg]"); It is possible to apply several cuts: myhist->ProjectionY(" ",firstxbin,lastxbin,"[cutg1,cutg2]");

NOTE that if a TH1D named "name" exists in the current directory or pad and having a compatible axis, the histogram is reset and filled again with the projected contents of the TH2. In the case of axis incompatibility, an error is reported and a NULL pointer is returned.

NOTE that the Y axis attributes of the TH2 are copied to the X axis of the projection.

Definition at line 2340 of file TH2.cxx.

◆ PutStats()

void TH2::PutStats ( Double_t stats)
virtual

Replace current statistics with the values in array stats.

Reimplemented from TH1.

Reimplemented in TProfile2D.

Definition at line 2349 of file TH2.cxx.

◆ QuantilesX()

TH1D * TH2::QuantilesX ( Double_t  prob = 0.5,
const char *  name = "_qx" 
) const

Compute the X distribution of quantiles in the other variable Y name is the name of the returned histogram prob is the probability content for the quantile (0.5 is the default for the median) An approximate error for the quantile is computed assuming that the distribution in the other variable is normal.

According to this approximate formula the error on the quantile is estimated as sqrt( p (1-p) / ( n * f(q)^2) ), where p is the probability content of the quantile and n is the number of events used to compute the quantile and f(q) is the probability distribution for the other variable evaluated at the obtained quantile. In the error estimation the probability is then assumed to be a normal distribution.

Definition at line 2369 of file TH2.cxx.

◆ QuantilesY()

TH1D * TH2::QuantilesY ( Double_t  prob = 0.5,
const char *  name = "_qy" 
) const

Compute the Y distribution of quantiles in the other variable X name is the name of the returned histogram prob is the probability content for the quantile (0.5 is the default for the median) An approximate error for the quantile is computed assuming that the distribution in the other variable is normal.

Definition at line 2382 of file TH2.cxx.

◆ Rebin()

TH2 * TH2::Rebin ( Int_t  ngroup = 2,
const char *  newname = "",
const Double_t xbins = 0 
)
virtual

Override TH1::Rebin as TH2::RebinX Rebinning in variable binning as for TH1 is not allowed If a non-null pointer is given an error is flagged see RebinX and Rebin2D.

Reimplemented from TH1.

Definition at line 1534 of file TH2.cxx.

◆ Rebin2D()

TH2 * TH2::Rebin2D ( Int_t  nxgroup = 2,
Int_t  nygroup = 2,
const char *  newname = "" 
)
virtual

Rebin this histogram grouping nxgroup/nygroup bins along the xaxis/yaxis together.

if newname is not blank a new temporary histogram hnew is created. else the current histogram is modified (default) The parameter nxgroup/nygroup indicate how many bins along the xaxis/yaxis 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 hpxpy is an existing TH2 histogram with 40 x 40 bins

hpxpy->Rebin2D(); // merges two bins along the xaxis and yaxis in one in hpxpy
// Carefull: previous contents of hpxpy are lost
hpxpy->RebinX(5); //merges five bins along the xaxis in one in hpxpy
TH2 *hnew = hpxpy->RebinY(5,"hnew"); // creates a new histogram hnew
// merging 5 bins of h1 along the yaxis in one bin
Service class for 2-Dim histogram classes.
Definition: TH2.h:30
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin2D.
Definition: TH2.cxx:1523

NOTE : If nxgroup/nygroup is not an exact divider of the number of bins, along the xaxis/yaxis the top limit(s) of the rebinned histogram is changed to the upper edge of the xbin=newxbins*nxgroup resp. ybin=newybins*nygroup and the corresponding bins are added to the overflow bin. Statistics will be recomputed from the new bin contents.

Reimplemented in TProfile2D.

Definition at line 1569 of file TH2.cxx.

◆ RebinX()

TH2 * TH2::RebinX ( Int_t  ngroup = 2,
const char *  newname = "" 
)
virtual

Rebin only the X axis see Rebin2D.

Reimplemented from TH1.

Reimplemented in TProfile2D.

Definition at line 1513 of file TH2.cxx.

◆ RebinY()

TH2 * TH2::RebinY ( Int_t  ngroup = 2,
const char *  newname = "" 
)
virtual

Rebin only the Y axis see Rebin2D.

Reimplemented in TProfile2D.

Definition at line 1523 of file TH2.cxx.

◆ Reset()

void TH2::Reset ( Option_t option = "")
virtual

Reset this histogram: contents, errors, etc.

Reimplemented from TH1.

Reimplemented in TH2Poly, TH2C, TH2S, TH2I, TH2F, TH2D, TProfile2D, and TProfile2Poly.

Definition at line 2464 of file TH2.cxx.

◆ SetBinContent() [1/3]

void TH2::SetBinContent ( Int_t  bin,
Double_t  content 
)
virtual

Set bin content.

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 2480 of file TH2.cxx.

◆ SetBinContent() [2/3]

virtual void TH2::SetBinContent ( Int_t  binx,
Int_t  biny,
Double_t  content 
)
inlinevirtual

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 120 of file TH2.h.

◆ SetBinContent() [3/3]

virtual void TH2::SetBinContent ( Int_t  binx,
Int_t  biny,
Int_t  ,
Double_t  content 
)
inlinevirtual

Reimplemented from TH1.

Reimplemented in TH2Poly.

Definition at line 121 of file TH2.h.

◆ SetShowProjectionX()

void TH2::SetShowProjectionX ( Int_t  nbins = 1)
virtual

When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the projection along X corresponding to the mouse position along Y.

To stop the generation of the projections, delete the canvas containing the projection.

Definition at line 2497 of file TH2.cxx.

◆ SetShowProjectionY()

void TH2::SetShowProjectionY ( Int_t  nbins = 1)
virtual

When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the projection along Y corresponding to the mouse position along X.

To stop the generation of the projections, delete the canvas containing the projection.

Definition at line 2512 of file TH2.cxx.

◆ ShowBackground()

TH1 * TH2::ShowBackground ( Int_t  niter = 20,
Option_t option = "same" 
)
virtual

This function calculates the background spectrum in this histogram.

The background is returned as a histogram. to be implemented (may be)

Reimplemented from TH1.

Definition at line 2525 of file TH2.cxx.

◆ ShowPeaks()

Int_t TH2::ShowPeaks ( Double_t  sigma = 2,
Option_t option = "",
Double_t  threshold = 0.05 
)
virtual

Interface to TSpectrum2::Search the function finds peaks in this histogram where the width is > sigma and the peak maximum greater than threshold*maximum bin content of this.

for more details see TSpectrum::Search. note the difference in the default value for option compared to TSpectrum2::Search option="" by default (instead of "goff")

Reimplemented from TH1.

Definition at line 2541 of file TH2.cxx.

◆ Smooth()

void TH2::Smooth ( Int_t  ntimes = 1,
Option_t option = "" 
)
virtual

Smooth bin contents of this 2-d histogram using kernel algorithms similar to the ones used in the raster graphics community.

Bin contents in the active range are replaced by their smooth values. If Errors are defined via Sumw2, they are also scaled and computed. However, note the resulting errors will be correlated between different-bins, so the errors should not be used blindly to perform any calculation involving several bins, like fitting the histogram. One would need to compute also the bin by bin correlation matrix.

3 kernels are proposed k5a, k5b and k3a. k5a and k5b act on 5x5 cells (i-2,i-1,i,i+1,i+2, and same for j) k5b is a bit more stronger in smoothing k3a acts only on 3x3 cells (i-1,i,i+1, and same for j). By default the kernel "k5a" is used. You can select the kernels "k5b" or "k3a" via the option argument. If TAxis::SetRange has been called on the x or/and y axis, only the bins in the specified range are smoothed. In the current implementation if the first argument is not used (default value=1).

implementation by David McKee (dmcke.nosp@m.e@ba.nosp@m.ma.ua.nosp@m..edu). Extended by Rene Brun

Reimplemented from TH1.

Definition at line 2570 of file TH2.cxx.

Member Data Documentation

◆ fScalefactor

Double_t TH2::fScalefactor
protected

Definition at line 33 of file TH2.h.

◆ fTsumwxy

Double_t TH2::fTsumwxy
protected

Definition at line 36 of file TH2.h.

◆ fTsumwy

Double_t TH2::fTsumwy
protected

Definition at line 34 of file TH2.h.

◆ fTsumwy2

Double_t TH2::fTsumwy2
protected

Definition at line 35 of file TH2.h.

Libraries for TH2:
[legend]

The documentation for this class was generated from the following files: