11.2.3.3. Construction for a function with the Launcher architecture

This constructor uses the Launcher architecture and is designed for C++ functions with the standard prototype.

In this case, the constructors have the following forms:

// Constructor with a function pointer using Launcher
TCalClass(TDataServer *tds, void (*fcn)(Double_t*,Double_t*), const char *varexpinput, const char *varexpoutput, int ns=1, Option_t *option="");
// Constructor with a function name using Launcher
TCalClass(TDataServer *tds, const char *fcn, const char *varexpinput, const char *varexpoutput, int ns=1, Option_t *option="");

It takes up to six arguments, two of which are optional:

  1. tds: a TDataServer object containing one attribute for each parameter to be calibrated. This is the TDataServer object called tdsPar, defined in General introduction to data and model definition.

  2. fcn: the second argument is either the name of the function or a pointer to this function. The user must know the exact order of the input and output variables of this function.

  3. varexinput: a colon-separated list of input variables, in the correct order, mixing reference attributes and parameter attributes.

  4. varexpoutput: a colon-separated list of output variables.

  5. ns (optional): the number of samples to be produced. This parameter is only relevant for methods that return multiple configurations (either multiple solutions to the minimisation problem or samples from the posterior distribution). It is not used for local minimisation with single-point initialisation, nor for linear Bayesian analysis (see Analytical linear Bayesian estimation). The default value is 1.

  6. option (optional): the option that can be applied to the method. Options common to all calibration classes (those defined in the TCalibration class) are discussed in Running the estimate.

This is the simplest constructor: all information is provided in a single line, no extra options need to be defined, and no files must be created. Using the formalism introduced in Recommended distance and likelihood functions, construction method, the calibration object can be constructed using a function-pointer prototype of the code Foo as shown below. This example assumes the model takes three inputs (“ref_var1”, “par1”, “ref_var2”) and it produces a single output, which is compared with the reference output “ref_out1” via the distance or likelihood function (see Recommended distance and likelihood functions, construction method).

// Define the dataservers
TDataServer *tdsRef = new TDataServer("reference","myReferenceData");
// Load the data, both inputs (ref_var1 and ref_var2) and a single output (ref_out1).
tdsRef->fileDataRead("myInputData.dat");
...
TDataServer *tdsPar = new TDataServer("parameters","myParameters");
tdsPar->addAttribute( new TNormalDistribution("par1",0,1) ); // the parameter to calibrate
...
// Create the instance of TCalClass
int ns=1;
TCalClass *cal = new TCalClass(tdsPar, Foo, "ref_var1:par1:ref_var2", "out", ns, "");