1.3.5.4. Pass argument “by-reference”

This sections shows how to use function that would have been defined using the “by-reference” prototype, which is specific to C++. This macro is also detailled Macro “howtoPassReference.py”.

"""
Example of C++style reference usage
"""
from ctypes import c_double  # for ROOT version greater or equal to 6.20
from URANIE import DataServer

# create a dataserver and read data
tds = DataServer.TDataServer("pouet", "foo")
tds.fileDataRead("myData.dat")

# compute quantile (this method get the results 'by reference')
proba = 0.9  # ROOT.Double(0.9) for ROOT version lower than 6.20
quant = c_double(0.0)  # ROOT.Double(0.0) for ROOT version lower than 6.20

# Compute the quantile and dump the value returned by reference
tds.computeQuantile("x", proba, quant)
print("Result is ")
print(quant.value)

The macro shown above, is an example of how to load a function and use it in a single-point estimation. Its result is discussed in Macro “howtoPassReference.py”.