13.7.12. Macro “relauncherCodeMultiTypeKeyEmptyVectorsAsFailure.C”
13.7.12.1. Objective
The objective of this macro is to test the case where vectors and strings are produced as outputs, using the code described in Producing outputs, with a Key format, obtained by doing:
multitype -mtKey -empty
Unlike what’s done to in Macro “relauncherCodeMultiTypeKey.C”, the “-empty” allows the code to
generate empty vectors and not only vectors whose size would be between 1 and 15 elements. The
resulting output file used is a key-format in a very row form, meaning that evey new element of the
vectors are written as a new key-line. This file, named _output_multitype_mt_Key_.dat could looks
like this:
w1 = nine
v1 = -0.512095
v1 = 0.039669
v1 = -1.3834
v1 = 1.37667
v1 = 0.220672
v1 = 0.633267
v1 = 1.37027
v1 = -0.765636
v2 = 14.1981
v2 = 14.0855
v2 = 10.7848
v2 = 9.45476
v2 = 9.17308
v2 = 6.60804
v2 = 10.0711
v2 = 14.1761
v2 = 10.318
v2 = 12.5095
v2 = 15.6614
v2 = 10.3452
v2 = 9.41101
v2 = 7.47887
f1 = 32.2723
w2 = eight
13.7.12.2. Macro Uranie
TDataServer *tds = new TDataServer("foo", "multitype usecase");
TCanvas *Can = new TCanvas("Can","Can",10,10,1000,800);
TPad *pad = new TPad("pad","pad",0, 0.03, 1, 1);
// Create the TDataServer and create the seed attribute
tds->addAttribute( new TUniformDistribution("seed",0,100000));
//Create DOE
TSampling *tsam = new TSampling(tds,"lhs",100);
tsam->generateSample();
// Create output attribute pointers
TAttribute *w1 = new TAttribute("w1", TAttribute::kString);
TAttribute *w2 = new TAttribute("w2", TAttribute::kString);
TAttribute *v1 = new TAttribute("v1", TAttribute::kVector);
TAttribute *v2 = new TAttribute("v2", TAttribute::kVector);
TAttribute *f1 = new TAttribute("f1");
// Create the input files
TFlatScript inputFile("multitype_input.dat");
inputFile.setInputs(1, tds->getAttribute("seed"), "seed");
// Create the output files
TKeyResult outputFile("_output_multitype_mt_Key_.dat");
outputFile.addOutput(w1, "w1");
outputFile.addOutput(v1, "v1");
outputFile.addOutput(v2, "v2");
outputFile.addOutput(f1, "f1");
outputFile.addOutput(w2, "w2");
// Create the user's evaluation function
TCodeEval eval("multitype -mtKey -empty");
eval.addInputFile(&inputFile); // Add the input file
eval.addOutputFile(&outputFile); // Add the output file
//Create the runner
TSequentialRun runner(&eval);
// Start the slaves
runner.startSlave();
if (runner.onMaster())
{
// Create the launcher
TLauncher2 lanceur(tds, &runner);
// Store the wrong calculation
TDataServer error("WrongComputations","pouet");
lanceur.setSaveError(&error);
lanceur.solverLoop();
// dump all wrong configurations
cout<<"\nFailed configurations: "<<endl;
error.getTuple()->SetScanField(-1);
error.scan("*");
// Stop the slave processes
runner.stopSlave();
}
//Produce control plot
pad->Draw();
pad->cd();
tds->drawPairs("w1:v1:v2:f1:w2");
The beginning of the code is pretty common to the macro already discussed in Macro Uranie. Apart from the command difference discussed in the objective above through the “-empty” argument, the main difference with previous macro is the failure dataserver declaration and the output console that would be discussed later-on. The former is done through the following lines:
// Store the wrong calculation
TDataServer error("WrongComputations","pouet");
lanceur.setSaveError(&error);
Once the code is run, the configuration leading to empty vectors are gathered in the failure dataserver and dumped on screen through the following lines:
// dump all wrong configurations
error.getTuple()->SetScanField(-1);
error.scan("*");
The final part is the way to represent the results: as for the use-case macro discussed in Macro “relauncherCodeMultiTypeKey.C”, all data are plotted in a pair plot and this is summarised in Figure 13.55. From this picture one should really pay attention to the number of entries to spot that some configuration are missing. Luckily when looking at the console in Console. This time (unlike the failure in Macro “relauncherCodeFlowrateSequentialFailure.C”) the code is returning a zero output status (because the code actually worked fine) but as from time to time one the two vectors is empty, no entry is written in the output whose format is too simple (as it consist only in dumping vector elements by elements) this is why the only message is the fact that, from time to time, one vector information is missing.
13.7.12.3. Graph
Figure 13.55 Graph of the macro “relauncherCodeMultiTypeKeyEmptyVectorsAsFailure.C”
13.7.12.4. Console
--- Uranie v4.11/0 --- Developed with ROOT (6.36.06)
Copyright (C) 2013-2026 CEA/DES
Contact: support-uranie@cea.fr
Date: Thu Feb 12, 2026
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v2 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v2 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v2 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v2 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v2 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v1 Not found
TKeyResult(_output_multitype_mt_Key_.dat): v2 Not found
Failed configurations:
************************************
* Row * WrongComp * seed.seed *
************************************
* 0 * 9 * 93759.29 *
* 1 * 33 * 74051.957 *
* 2 * 35 * 71909.957 *
* 3 * 50 * 4183.9188 *
* 4 * 54 * 41806.234 *
* 5 * 57 * 28298.703 *
* 6 * 66 * 64903.722 *
* 7 * 69 * 47690.947 *
* 8 * 73 * 89415.222 *
* 9 * 79 * 30656.411 *
* 10 * 84 * 31627.094 *
* 11 * 86 * 63698.481 *
* 12 * 89 * 13461.926 *
* 13 * 99 * 52994.014 *
************************************