(calibration_minimisation_constructing)= # Constructing the `TMinimisation` object As stated above, the only available constructor is the one whose prototype includes an instance of a **TRun**-inheriting object. This approach provides a simple way to change the evaluator (e.g., from a C++ function to a Python function or an external code) and to use either a sequential approach (for a code) or a threaded one (to distribute locally the estimates). In this case, the constructor should look like this: ````{only} cpp ```cpp // Constructor with a runner TMinimisation(TDataServer *tds, TRun *runner, Int_t ns=1, Option_t *option=""); ``` ```` ````{only} py ```python # Constructor with a runner TMinimisation(tds, runner, ns=1, option="") ``` ```` This method takes up to four arguments, two of which are optional: 1. **tds**: a {{tds}} object containing one attribute for each parameter to be calibrated. This is the {{tds}} object called `tdsPar`, defined in [](#calibration_classes_functions_observations_data_model). 2. **runner**: a `TRun`-inheriting instance that contains all the model information and whose type determines how the estimates are distributed: it can either be a `TSequentialRun` instance or `TThreadedRun` for distributed computations. 3. **ns** (optional): the number of samples to be produced. This parameter is not used in this context. 4. **option** (optional): the options that can be applied to the method. Options common to all calibration classes (those defined in the `TCalibration` class) are discussed in [](#calibration_classes_functions_observations_calibration_classes_running). A crucial step in this constructor is the creation of the instance that inherits from `TRun`. As mentioned earlier, its type determines how the estimates are distributed. To construct such an object, one needs to provide an evaluator (the available evaluators are described in detail in [](#relauncher_teval)). The final step is to construct the `TDistanceLikelihoodFunction`, a mandatory step that must always follow the constructor, using the `setDistance` method (following the prototype presented in [](#calibration_classes_functions_observations_data_and_distance_recommended_distance)). Advanced users also have the option to define a custom distance by following the prototype: ````{only} cpp ```cpp void setDistance(TDistanceLikelihoodFunction *distFunc, TDataServer *tdsRef, const char *input, const char *reference, const char *weight=""); ``` ```` ````{only} py ```python setDistance(distFunc, tdsRef, input, reference, weight="") ``` ````