luaXroot Wiki

This section present the binders to the ROOT classes natively supported by luaXroot.

It is possible for the user to add custom binders to other ROOT classes or extend the ones provided. This is the subject of this section.

Reminders:

  • Each argument is specified using the following nomenclature: < type, default value if any >
    Examples: , < float, 3.14157 >, < string, "O_RDONLY | O_NONBLOCK" >, ...
  • A [o] in front of an argument means that it's optional.
  • Some functions takes an arguments table. In this case the arguments are enclosed with { ... }. Each argument inside the table has a name that MUST be specified when calling the function. The advantage of arguments tables is that optional arguments can be omitted completely when calling the function, and passed in any order.

Index of the ROOT libraries binders section:

  • General binders
    click to expand

  • TCanvas
    click to expand

  • TFile
    click to expand

  • TF1
    click to expand

  • TGraphErrors
    click to expand

  • TH1D
    click to expand

  • TH2D
    click to expand

  • TSpectrum
    click to expand

  • TCutG
    click to expand

  • TTree
    click to expand


  • General binders

    ListCurrentDirectory

    ( )
    Return values: nil

    Display the list of the object in the active directory.

    go back to top

    GetObject

    ( type=< string >, name=< string > )
    Return values: requested type

    Search the active directory for a ROOT object with named name and with the type type.

    go back to top

    TObject.SetName

    ( name=< string > )
    Return values: nil

    Set the name as the name of object. The name cannot contain any space or special character. This function is a common method to all ROOT objects. It is a method and need an object to be called.

    Example

    	 local hist = TH1()
    	 
    	 hist:SetName("new_histogram_name")
    

    go back to top

    TObject.GetName

    ( )
    Return values: string

    Retrieve the name of object. This function is a common method to all ROOT objects. It is a method and need an object to be called.

    Example

    	 local hist = TH1()
    	 
    	 hist:GetName()
    

    go back to top

    TObject.Write

    ( )
    Return values: nil

    Writes object to the current active directory or file. This function is a common method to all ROOT objects. It is a method and need an object to be called.

    Example

    	 local file = TFile("myfile.root", "recreate")
    	 local hist = TH1()
    	 
    	 file:cd()
    	 hist:Write()
    	 file:Close()
    

    go back to top

    TObject.Draw

    ( opts=< string, "" > )
    Return values: nil

    Send a request to theApp to display and update this object.

    Example

    	 local hist = TH1()
    	 
    	 hist:Fill(4)
    		 
    	 hist:Draw()
    

    go back to top

    TObject.Update

    ( )
    Return values: nil

    Send a request to the theApp to update this object. If an histogram has recently been filled or the range changed, this will notify theApp that the object should be updated.
    This function is a common method to all ROOT objects. It is a method and need an object to be called.

    Example

    	 local hist = TH1()
    	 
    	 hist:Draw()
    	 
    	 hist:Fill(4)   -- the histogram will still appear empty on the screen
    	 hist:Update()  -- the histogram request an update, theApp will process it and update the display on screen 
    

    go back to top


    TCanvas

    TCanvas (constructor no arguments)

    ( )
    Return values: TCanvas

    Creates a new object of type TCanvas.

    go back to top

    TCanvas.SetTitle

    ( title=< string > )
    Return values: nil

    Set the title of the canvas to title.

    go back to top

    TCanvas.GetTitle

    ( )
    Return values: string

    Returns the title of the canvas.

    go back to top

    TCanvas.Divide

    ( nrow=< int >, ncol=< int > )
    Return values: nil

    Divide the TCanvas into nrow rows and ncol columns, creating as many sub-canvas.

    go back to top

    TCanvas.Draw

    ( root_obj=< any drawable ROOT object >, draw_opts=< string >, nrow=< int >, ncol=< int > )
    Return values: nil

    Draw root_obj with the options draw_opts in the sub-canvas of the canvas (nrow, ncol).

    luaXroot-canvasdivide

    go back to top

    TCanvas.Update

    ( )
    Return values: nil

    Refresh the canvas and all its sub-canvas.

    go back to top

    TCanvas.Clear

    ( )
    Return values: nil

    Clears the content of the canvas, deleting all its sub-canvas.

    go back to top

    TCanvas.Close

    ( )
    Return values: nil

    Closes the canvas.

    go back to top

    TCanvas.SetSize

    ( cw=< int >, ch=< int > )
    Return values: nil

    Resize the canvas, setting its width to cw and its height to ch.

    This does not resize the window, ONLY the canvas.

    go back to top

    TCanvas.SetWindowSize

    ( ww=< int >, wh=< int > )
    Return values: nil

    Resize the window containing the canvas, setting its width to ww and its height to wh.

    go back to top

    TCanvas.SetLogScale

    ( axis=< string >, val=< bool > )

    ( row=< int >, col=< int >, axis=< string >, val=< bool > )
    Return values: nil

    Switch the axis specified by the argument axis to logscale if val is true, and revert it back to linear if false.

    If the canvas is divided, an axis of a sub-canvas can be set to logscale/linear by specifying first the row and column of that sub-canvas.

    go back to top


    TFile

    TFile (constructor no arguments)

    ( )
    Return values: TFile

    Creates a new object of type TFile.

    go back to top

    TFile (constructor 2 arguments)

    ( name=< string >, opts= < string > )
    Return values: TFile

    Creates a new object of type TFile and opens it using argument name.

    opts are:

    • read : open the file to be read only.
    • update : open the file and keep any previous content. The file is created if it did not exist before.
    • recreate : create the file and erase any previous content if the file already existed.

    go back to top

    TFile (constructor arguments table)

    ( { name=< string >, mode=< string > } )
    Return values: TFile

    Creates a new object of type TFile and opens it using argument name.

    mode can be:

    • read : open the file to be read only.
    • update : open the file and keep any previous content. The file is created if it did not exist before.
    • recreate : create the file and erase any previous content if the file already existed.

    go back to top

    TFile.ls

    ( )
    Return values: nil

    List the content of a file and print it on the screen.

    go back to top

    TFile.cd

    ( )
    Return values: nil

    Set this TFile to be the active file.

    go back to top

    TFile.Open

    ( name=< string >, opts= < string > )
    Return values: nil

    Open a file using argument name.

    opts are:

    • read : open the file to be read only.
    • update : open the file and keep any previous content. The file is created if it did not exist before.
    • recreate : create the file and erase any previous content if the file already existed.

    go back to top

    TFile.Close

    ( )
    Return values: nil

    Closes the file.

    go back to top

    TFile.GetObject

    ( type=< string >, name=< string > )
    Return values: type of the object OR nil if no object is found

    Performs the same operation as the static GetObject but does not require that this file is the current active file.

    go back to top

    TFile.Write

    ( name=< string > )
    Return values: nil

    Write the object with name name to the file. If an object with the same name is already present, both are kept and ";n" is appended to the name, where n is the name cycle.

    go back to top

    TFile.Overwrite

    ( name=< string > )
    Return values: nil

    Write the object with name name to the file. If an object with the same name is already present, it is deleted and replaced by the new one.

    go back to top

    TFile.Flush

    ( )
    Return values: nil

    Syncronize the status of the file in memory and on disk. Useful when that file is supposed to be accessed by other process for reading while the writing process is still editing it.

    go back to top

    TFile.ReadKeys

    ( )
    Return values: nil

    Read the keys from the file. It allows a reading process to update the informations about the objects in the file and read them while the file is still being edited.

    go back to top

    TFile.Refresh

    ( name=< string >, dest=< ROOT object > )
    Return values: ROOT object

    Attempt to get an object with name name from the file and assign it to dest. For this operation to be successful, a call to TFile.ReadKeys must have been performed recently. Occasionaly this call can fail if the read happens while the writing process is updating the file.

    go back to top


    TF1

    TF1 (constructor no arguments)

    ( )
    Return values: TF1

    Creates a new object of type TF1

    go back to top

    TF1 (constructor 2 arguments)

    ( name=< string >, formula=< string > )
    Return values: TF1

    Creates a new object of type TF1 and set its name to name.

    formula must be a string specifying a predefined ROOT function or a simple formula

    Example

    	 local f1 = TF1("func1", "gaus")         -- will create a gaussian function
    	 
    	 local f2 = TF1("func2", "[0]*x + [1]")  -- will create a simple polynomial function of order 1
    

    See this link for more infos.

    go back to top

    TF1 (constructor 4 arguments)

    ( name=< string >, formula=< string >, xmin=< double >, xmax=< double > )
    Return values: TF1

    Creates a TF1 similarly to TF1 with 2 arguments. The additionnal xmin and xmax arguments set the boundaries of the function.

    See this link for more infos.

    go back to top

    TF1 (constructor 5 arguments)

    ( name=< string >, fn=< function >, xmin=< double >, xmax=< double >, npars=< int > )
    Return values: TF1

    Creates a new object of type TF1 and set its name to name, while xmin and xmax arguments set the boundaries of the function

    fn must be a Lua function and npars the number of parameters in the function.

    Example

    	 local function poly1(x, a, b)
    	 	   return a*x + b
      	 end
    	 
    	 local f2 = TF1("func2", poly1, -5, 5, 2)  -- the number of parameters of poly1 MUST be specified. 
                                                   	  -- It is equal to 2 here as x is NOT a parameter
    

    go back to top

    TF1 (constructor 6 arguments)

    ( name=< string >, formula=< function >, xmin=< double >, xmax=< double >, npars=< int >, ndim=< int > )
    Return values: TF1

    Creates a new object of type TF1 similarly to TF1 with 5 arguments. The additional ndim arguments specify the dimension of the function.

    go back to top

    TF1 (constructor arguments table)

    ( { name=< string >, [o] formula=< string >, [o] fn=< function >, [o] xmin=< double>, [o] xmax=< double >, [o] npars=< int >, [o] ndim=< int > } )
    Return values: TF1

    Creates a new object of type TF1 and sets its name to name.

    The arguments are exactly the same as for the previously discussed constructors. The formula OR fn field must be provided. Only 1 of the 2 can be specified.

    If fn is specified, it must be a function and xmin, xmax and npars are required.

    Example

    	 local function poly1(x, a, b)
    	 	   return a*x + b
      	 end
    	 
    	 local f1 = TF1({ name = "func1", fn = poly1, xmin = -5, xmax = 5, npars = 2 })
    

    go back to top

    TF1.SetParameter

    ( parn=< int >, val=< double > )
    Return values: nil

    Set value parameter number parn using value.

    go back to top

    TF1.SetParameters

    ( vals=< table > )
    Return values: nil

    Set the values of all the parameters using the table vals.

    Example

    	 local function poly2(x, a, b, c)
    	 	   return a*x^2 + b*x +c
      	 end
    	 
    	 local f1 = TF1({ name = "my_pol2", fn = poly2, xmin = -5, xmax = 5, npars = 3)
    	 
    	 f1:SetParameters( { 2, 6, -4 } )  -- this will set a to 2, b to 6 and c to -4
    

    go back to top

    TF1.SetRange

    ( xmin=< double >, xmax< double > )
    Return values: nil

    Set the the range of the TF1 to [xmin - xmax].

    go back to top

    TF1.SetNpx

    ( npx=< double > )
    Return values: nil

    Set the amount of points used to display the function. A higher number of points means a smoother looking function but too many points for the display can harm processing time.

    go back to top

    TF1.GetParameter

    ( parn=< int >)
    Return values: double

    Retrieve the value of parameter number parn.

    go back to top

    TF1.GetParameters

    ( )
    Return values: table

    Retrieve the value of all the parameters and returns them in a table.

    go back to top

    TF1.GetChi2

    ( )
    Return values: double

    Retrieve the value of all the Chi2 associated to the last performed fit using this function (see TGraph.Fit or TH1D.Fit).

    go back to top

    TF1.Eval

    ( x=< double > )
    Return values: double

    Evaluate the coordinate for the abscissa x.

    go back to top

    TF1.GetX

    ( fy=< double > )
    Return values: double

    Find the abscissa corresponding to the coordinate fy. Basically performs the opposite of TF1.Eval.

    go back to top

    TF1.Integral

    ( xmin=< double >, xmax=< double > )
    Return values: double

    Integrate the function between xmin and xmax and returns the result.

    go back to top

    TF1.GetRandom

    ( [o] xmin=< double >, [o] xmax=< double > )
    Return values: double

    Generate a random number following this function shape. If xmin and xmax are specified, these values are used as boundaries by the random number generator.

    go back to top


    TGraphErrors

    TGraph (constructor no arguments)

    ( )
    Return values: TGraph

    Creates a new object of type TGraph.

    go back to top

    TGraph (constructor 1 argument)

    ( npoints=< int > } )
    Return values: TGraph

    Creates a new object of type TGraph and sets its amount of points to npoints.

    go back to top

    TGraph (constructor 3 arguments)

    ( npoints=< int >, xs=< table >, ys=< table > } )
    Return values: TGraph

    Creates a new object of type TGraph and sets its amount of points to npoints.

    It then uses the tables xs and ys to set the values of these points. The size of xs and ys must be npoints.

    go back to top

    TGraph (constructor 3 arguments)

    ( npoints=< int >, xs=< table >, ys=< table >, errxs=< table >, errys=< table > } )
    Return values: TGraph

    Creates a new object of type TGraph and sets its amount of points to npoints.

    It then uses the tables xs and ys to set the values of these points and errxs and errys to set the errors respectively. The size of xs, ys, errxs and errys must be npoints.

    go back to top

    TGraph (constructor arguments table)

    ( { npoints=< int >, [o] xs=< table >, [o] ys=< table >, [o] errxs=< table>, [o] errys=< table > } )
    Return values: TGaph

    Creates a new object of type TGraph and sets its amount of points to npoints.

    If xs is specified, then ys is required as well. Same goes for errxs and errys.

    The meaning of xs, ys, errxs and errys is the same as in the previous constructors.

    go back to top

    TGraph.SetTitle

    ( title=< string > )
    Return values: nil

    Set the title of the TGraph using title.

    go back to top

    TGraph.GetTitle

    ( )
    Return values: string

    Retrieve the title of the TGraph.

    go back to top

    TGraph.GetMaxSize

    ( )
    Return values: int

    Retrieve the maximum amount of points in the TGraph.

    go back to top

    TGraph.GetPoint

    ( n=< int > )
    Return values: table

    Retrieve the x and y value of point n and returns them in a table as

    	 {
    	   [1] = x,
    	   [2] = y
    	 }
    

    go back to top

    TGraph.GetPointError

    ( n=< int > )
    Return values: table

    Retrieve the errors associated to x and y for the point n and returns them in a table as

    	 {
    	   [1] = errx,
    	   [2] = erry
    	 }
    

    go back to top

    TGraph.SetNPoint

    ( n=< int > )
    Return values: nil

    Modify the maximum number of point in the TGraph and set it to n. If n is smaller than the previous size, any extra points are discarded. If n is smaller than the previous the new points are initialized at ( 0 , 0).

    go back to top

    TGraph.SetPoint

    ( n=< int >, x=, y=< double > )
    Return values: nil

    Set the x and y values of point n using x and y.

    go back to top

    TGraph.SetPointError

    ( n=< int >, errx=, erry=< double > )
    Return values: nil

    Set the errors on the x and y values of point n using errx and erry.

    go back to top

    TGraph.RemovePoint

    ( n=< int > )
    Return values: nil

    Removes point number n.

    go back to top

    TGraph.Eval

    ( x=< double > )
    Return values: double

    Evaluates the coordinate associated to the abscissa x using interpolation.

    go back to top

    TGraph.Fit<

    ( { fn=< TF1 >, [o] xmin=< double >, [o] xmax=< double >, [o] opts=< string > } )
    Return values: nil

    Fit the TGraph using the function fn. If xmin and xmax are specified, the fit will consider only that range.

    opts is a string specifying options for the fit. See this link for more information.

    go back to top

    TGraph.Clone

    ( )
    Return values: TGraph

    Creates a clone of this TGraph.

    go back to top


    TH1D

    TH1 (constructor no arguments)

    ( )
    Return values: TH1

    Creates a new object of type TH1.

    go back to top

    TH1 (constructor 5 arguments)

    ( name=< string >, title=< string >, nbinsx=< int >, xmin=< double>, xmax=< double > )
    Return values: TH1

    Creates a new object of type TH1 and sets its name and title to name and title respectively.

    The TH1 will be created with nbinsx for a the range xmin to xmax.

    go back to top

    TH1 (constructor arguments table)

    ( { name=< string >, title=< string >, nbinsx=< int >, xmin=< double>, xmax=< double > } )
    Return values: TH1

    Same as above but with the arguments passed inside a table instead.

    go back to top

    TH1.SetTitle

    ( title=< string > )
    Return values: nil

    Set the title of the TH1 to title.

    go back to top

    TH1.GetTitle

    ( )
    Return values: string

    Retrieves the title of the TH1.

    go back to top

    TH1.Fill

    ( x=< double>, [o] weight=< int, 1 > )
    Return values: nil

    Increment the bin containing the abscissa x by weight.

    go back to top

    TH1.Reset

    ( )
    Return values: nil

    Reset the histogram, deleting all its content.

    go back to top

    TH1.Rebuild

    ( )
    Return values: nil

    Recompute the arrays for contents and errors.

    go back to top

    TH1.Scale

    ( s=< double > )
    Return values: nil

    Rescale the histogram by a factor of s.

    go back to top

    TH1.SetRangeUserX

    ( xmin=< double >, xmax=< double > )
    Return values: nil

    Set the range of the X axis using user values. This means that xmin and xmax should be the actual value on the X axis and not bin numbers.

    go back to top

    TH1.SetRangeUserY

    ( ymin=< double >, ymax=< double > )
    Return values: nil

    Set the range of the Y axis using user values. This means that ymin and ymax should be the actual value on the Y axis and not bin numbers.

    go back to top

    TH1.SetXProperties

    ( nbinsx=< int>, xmin=< double >, xmax=< double > )
    Return values: nil

    Change the properties of the X axis allowing to effectively expand the X axis further than when originally set.

    Unlike the ROOT function SetBins which shifts the content of the histograms, this function leaves it untouched. The downside is that it can be be a heavy computation when dealing with large histograms.

    go back to top

    TH1.GetXProperties

    ( )
    Return values: table

    Retrieve the current properties of the X axis and returns them in a table:

    	 {
    	   [1] = nbinsx,
    	   [2] = xmin,
    	   [3] = xmax
    	 }
    

    go back to top

    TH1.GetContent

    ( )
    Return values: table

    Retrieve the content of the histograms and returns it as a table:

    	 {
    	   [1] = table containing the bins with a content > 0,
    	   [2] = table containing the content of the bins stored in [1]
    	 }
    

    go back to top

    TH1.Fit

    ( { fn=< TF1 >, [o] xmin=< double >, [o] xmax=< double >, [o] opts=< string > } )
    Return values: nil

    Fit the TH1 using the function fn. If xmin and xmax are specified, the fit will consider only that range.

    opts is a string specifying options for the fit. See this link for more information.

    go back to top

    TH1.Clone

    ( )
    Return values: TH1

    Returns a clone of the TH1.

    go back to top

    TH1.Add

    ( hist=< TH1 >, [o] s=< double >)
    Return values: nil

    Add the histogram hist to the TH1 using the scale s. A scale of -1 would perform a substraction of the 2 histograms.

    go back to top

    TH1.SetLogScale

    ( axis=< string >, val=< bool > )
    Return values: nil

    Switch the axis specified by the argument axis to logscale if val is true, and revert it back to linear if false.

    go back to top

    TH1.Integral

    ( [o] xmin=< double >, [o] xmax=< double > )
    Return values: double

    Returns the integral of the histogram between xmin and xmax. If no values are specified for xmin and xmax, the current display range is used.

    Integral won't be computed for bins outside of the current display range, regardless of what the user specified for the boundaries.

    go back to top


    TH2D

    TH2 objects have the same methods as TH1 and are not repeated here. Only the methods exclusive to TH2 or the ones which share a same name but are different are explicitely described.

    TH2 (constructor no arguments)

    ( )
    Return values: TH2

    Creates a new object of type TH2.

    go back to top

    TH2 (constructor 7 arguments)

    ( name=< string >, title=< string >, nbinsx=< int >, xmin=< double>, xmax=< double >, nbinsy=< int >, ymin=< double>, ymax=< double > )
    Return values: TH2

    Creates a new object of type TH2 and sets its name and title to name and title respectively.

    The TH2 will be created with:

    • nbinsx for a the range xmin to xmax for the X axis.
    • nbinsy for a the range ymin to ymax for the Y axis.

    go back to top

    TH2 (constructor arguments table)

    ( { name=< string >, title=< string >, nbinsx=< int >, xmin=< double>, xmax=< double >, nbinsy=< int >, ymin=< double>, ymax=< double > } )
    Return values: TH2

    Same as above but with the arguments passed inside a table instead.

    go back to top

    TH2.Fill

    ( x=< double>, y=< double>, [o] weight=< int, 1 > )
    Return values: nil

    Increment the bin containing the abscissa x and the coordinate y by weight.

    go back to top

    TH2.ProjectX

    ( ymin=< double>, ymax=< double> )
    Return values: TH1

    Returns the projection on the X axis of the range ymin to ymax.

    go back to top

    TH2.ProjectY

    ( xmin=< double>, xmax=< double> )
    Return values: TH1

    Returns the projection on the Y axis of the range xmin to xmax.

    go back to top

    TH2.GetProjectionX

    ( )
    Return values: TH1

    Returns the last projection performed on the X axis.

    go back to top

    TH2.GetProjectionY

    ( )
    Return values: TH1

    Returns the last projection performed on the Y axis.

    go back to top

    TH2.SetYProperties

    ( nbinsy=< int>, ymin=< double >, ymax=< double > )
    Return values: nil

    Change the properties of the Y axis allowing to effectively expand the Y axis further than when originally set.

    Unlike the ROOT function SetBins which shifts the content of the histograms, this function leaves it untouched. The downside is that it can be be a heavy computation when dealing with large histograms.

    go back to top

    TH2.GetYProperties

    ( )
    Return values: table

    Retrieve the current properties of the Y axis and returns them in a table:

    	 {
    	   [1] = nbinsy,
    	   [2] = ymin,
    	   [3] = ymax
    	 }
    

    go back to top

    TH2.Integral

    ( [o] xmin=< double >, [o] xmax=< double >, [o] ymin=< double >, [o] ymax=< double > )
    Return values: double

    Returns the integral of the histogram between xmin and xmax on the X axis, ymin and ymax on the Y axis. If no values are specified for xmin and xmax and/or ymin and ymax, the current display range is used.

    Integral won't be computed for bins outside of the current display range, regardless of what the user specified for the boundaries.

    go back to top


    TSpectrum

    TSpectrum (constructor no arguments)

    ( )
    Return values: TSpectrum

    Creates a new object of type TSpectrum.

    go back to top

    TSpectrum (constructor no arguments)

    ( npeaks=< int > )
    Return values: TSpectrum

    Creates a new object of type TSpectrum and set the amount of peaks to use when performing a Search.

    go back to top

    TSpectrum.Background

    ( histname=< string >, niter=< int >, [o] opts=< string, "" > )
    Return values: TH1

    Evaluate the background and returns it as a TH1. More information on the process can be found here.

    go back to top

    TSpectrum.DrawBackground

    ( )
    Return values: nil

    Draw the result of the last background estimation.

    go back to top

    TSpectrum.GetBackground

    ( )
    Return values: TH1

    Returns the result of the last background estimation. If no background estimation has been performed yet, it retusn nil.

    go back to top

    ( histname=< string >, sigma=< double >, opts=< string >, threshold=< double > )
    Return values: nil

    Performs a peak search in the histogram identified by histname. The parameter npeaks used when constructing the TSpectrum is used as the maximum number of peaks that can be found.

    sigma is the expected sigma of the peaks that the function should find.

    threshold is setting the minimum amplitude that a peak needs to have to be considered in the search. This threshold is set as a percentage of the peak with the biggest amplitude.

    opts are options described here. If none is required, set this argument to "".

    go back to top

    TSpectrum.GetNPeaks

    ( )
    Return values: int

    Returns the amount of peaks found during the last Search.

    go back to top

    TSpectrum.GetPositionX

    ( )
    Return values: table

    Returns the positions of the peaks found during the last Search and returns them in a table.

    go back to top

    TSpectrum.GetPositionY

    ( )
    Return values: table

    Returns the amplitude of peaks found during the last Search and returns them in a table. The ordering of these amplitudes corresponds to the ordering of the peaks position returned by GetPositionX.

    go back to top


    TCutG

    TCutG (constructor no arguments)

    ( )
    Return values: TCutG

    Creates a new object of type TCutG.

    go back to top

    TCutG.SetPoint

    ( n=< int >, x=< double >, y=< double > )
    Return values: nil

    Set the x and y values of point number n using arguments x and y.

    For a TCutG to be valid, its first and last points must have the save x and y values.

    go back to top

    TCutG.SetNPoint

    ( n=< int > )
    Return values: nil

    Set the amount of points used by this TCutG.

    go back to top

    TCutG.IsInside

    ( x=< double >, y=< double > )
    Return values: bool

    Check wether or not the point with the coordinates ( x, y ) is inside the graphical cut defined by TCutG.

    go back to top

    TCutG.Clone

    ( )
    Return values: TCutG

    Creates clone of the TCutG.

    go back to top

    TCutG.Area

    ( )
    Return values: double

    Returns the area enclosed by the TCutG.

    go back to top

    TCutG.IntegralHist

    ( hist=< TH2 > )
    Return values: double

    Returns the integral of the histogram hist using only the bins contained in the area defined by the TCutG.

    go back to top


    TTree

    TTree (constructor no arguments)

    ( )
    Return values: TTree

    Creates a new object of type TTree.

    go back to top

    TTree (constructor 2 arguments)

    ( name=< string >, title=< string > )
    Return values: TTree

    Creates a new object of type TTree and set its name and title to name and title respectively.

    go back to top

    TTree (constructor arguments table)

    ( { name=< string >, title=< string > } )
    Return values: TTree

    Creates a new object of type TTree and set its name and title to name and title respectively.

    go back to top

    TTree.GetEntries

    ( )
    Return values: unsigned long long int

    Returns the total number of entries in the TTree.

    go back to top

    TTree.GetEntry

    ( n=< unsigned long long int > )
    Return values: nil

    Retrieves the values of the branches of the TTree for the entry number n and accordingly sets the values of the variables that attached to these branches ( see TTree.NewBranch and TTree.GetBranch). Entry numbers starts from 0.

    go back to top

    TTree.Fill

    ( )
    Return values: nil

    Uses the values of the variables that are attached to the branches of the TTree ( see TTree.NewBranch and TTree.GetBranch) to create a new entry.

    go back to top

    TTree.NewBranch

    ( { type=< string >, name=< string > } )
    Return values: userdata of type specified by type

    Creates a new branch for the TTree of type type. This function returns an object of type type that can be used to either set the value of the branch or reads from it. It means that if the type specified for the branch is "int", it won't return a plain integer but a userdata associated to an int as discussed here.

    Example:

    	 local tree = TTree("mytree", "a example of tree")
    	 
    	 local b1 = tree:NewBranch( { name="branch1", type="int"} )
    	 
    	 b1:Set(6)
    	 tree:Fill()  -- the tree now contains one entry for which the value of branch1 is 6
    	 
    	 b1:Set(17)
    	 tree:Fill()  -- the tree contains now 2 entries. First one has a value of 6 for branch1
    	              -- the second one has a value of 17 for branch 1.
    

    go back to top

    TTree.GetBranch

    ( { name=< string > } )
    Return values: userdata of type of the branch with the name name

    Retrieves an existing branch of the TTree with name name. This function returns an object which will act as a link to this branch.

    Example:

    	 -- [ ... assuming we have the TTree created in the example of TTree.NewBranch ... ]
    	 
    	 local br = tree:GetBranch( { name="branch1" } )
    	 
    	 tree:GetEntry(1)
    	 print(br:Get())   -- will print 17 as the value of branch1 for the second entry was 17
    	 
    	 tree:GetEntry(0)
    	 print(br:Get())   -- will print 6 as the value of branch1 for the first entry was 6
    

    go back to top

    TTree.Draw

    ( varexp=< string >, [o] cond=< string >, [o] opts=< string >, [o] nentries=< unsigned long long >, [o] firstentry=< unsigned long long > )
    Return values: nil

    Calls the standard Draw command for a TTree. A detailed documentation of this function can be found here.

    go back to top