11.2.2.3. Available options for every distance and likelihood function

All distance and likelihood function classes inherit from TDistanceLikelihoodFunction, and the only difference among them lies in the implementation of the localeval function. As a result, a large portion of the code is shared across all the distance and likelihood function objects, including the parts handling their configuration and options.

This subsection gathers all the shared options, which can be configured either through the optional “Option” parameter in several methods and constructors, or by accessing the distance or likelihood function object directly once it has been created. To do so, the user can call the getDistanceLikelihoodFunction method, which returns the distance or likelihood function instance stored within the calibration object. The following lines provide an example using an instance cal of the mock class TCalClass (as if it inherited from the TCalibration class).

// Creating the calibration instance from a TDataServer and a Relauncher::TRun
TCalClass *cal = new TCalClass(tdsPar,runner,1,"");
// Creating the distance function (a least square one)
cal->setDistance("LS",tdsRef,"logRe:logPr","logNu");
// Retrieving the instance to be able to change options
TLSDistanceFunction *dFunc = (TLSDistanceFunction*)cal->getDistanceLikelihoodFunction();

In the last line of the previous code block, the right-hand side of the equality begins with a cast of the pointer returned by getDistanceLikelihoodFunction. Since this method returns a pointer to a TDistanceLikelihoodFunction, the user must specify that the object is actually an instance of TLSDistanceFunction.