English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Calibration: TCalibration.h Source File
Uranie / Calibration v4.9.0
/* @license-end */
TCalibration.h
Go to the documentation of this file.
1
2// Copyright (C) 2013-2024 CEA/DES
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as published
6// by the Free Software Foundation, either version 3 of the License, or any
7// later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
17// TCalibration
19// $Id$
20// $Author$
21// $Date$
22// $Revision$
23// $State$
25
42#ifndef TCALIBRATION_H
43#define TCALIBRATION_H
44
45// Root
46#include "TMatrixD.h"
47
48#include <iostream>
49#include <sstream>
50using std::cout;
51using std::endl;
52
53// Uranie
54#include "TDataServer.h"
55#include "TDSNtupleD.h"
56#include "TRun.h"
57#include "UExceptions.h"
58#include "Calibration.h"
59#include "TDistanceFunction.h"
60#include "TCode.h"
61
62namespace URANIE {
63namespace Calibration {
64class TCalibration: public TNamed {
65
66
67 //---------------------------------------------
72public:
73
78
79 URANIE::DataServer::TDataServer *_tdsPar;
80 URANIE::DataServer::TDataServer *_tdsObs;
81 URANIE::DataServer::TDataServer *_tdsEval;
82
85 TString _sEI;
86 TString _sEO;
87 URANIE::Launcher::TCode *_code;
88 URANIE::Relauncher::TRun *_run;
89 void (*_pFunction)(double *, double *);
90 vector<URANIE::DataServer::TStochasticAttribute*> _vatt;
91
92protected:
93
95 URANIE::DataServer::TDSNtupleD *_evTuple;
96
98
99 TCanvas *_canvas;
101
102 int _nSam;
103 int _nObs;
105 int _nPar;
106 int _nVar;
107
108 int _nSeed;
109 TString _sMethodName;
111 TString _outputName;
112 vector<string> _vrefName;
113 vector<string> _voutName;
114 TString _weightName;
115 TMatrixD _mObsCovMat;
116
121 Bool_t _blog;
123
124public:
125 //---------------------------------------------
129
137 TCalibration(URANIE::DataServer::TDataServer *tds, URANIE::Relauncher::TRun *run, int ns=1, Option_t * option = "");
138
147 TCalibration(URANIE::DataServer::TDataServer *tds, void (*fcn)(Double_t*,Double_t*), const char *varexpinput, const char *varexpoutput, int ns = 1, Option_t * option = "");
148
157 TCalibration(URANIE::DataServer::TDataServer *tds, const char *fcn, const char *varexpinput, const char *varexpoutput, int ns = 1, Option_t * option = "");
158
165 TCalibration(URANIE::DataServer::TDataServer *tds, URANIE::Launcher::TCode *fcode, int ns = 1, const char *option = "");
166
168 virtual ~TCalibration();
170
171 //---------------------------------------------
175 Int_t getID()
176 {
177 return ID_CALIBRATION;
178 }
179
181 void setSeed(UInt_t nval)
182 {
183 _nSeed = nval;
184 }
185
187 UInt_t getSeed()
188 {
189 return _nSeed;
190 }
191
193 const char * getMethodName()
194 {
195 return _sMethodName.Data();
196 }
197
203
206
211 Int_t getNPar() {
212 return _nPar;
213 }
214
216 URANIE::DataServer::TDataServer *getEvaluationTDS() {
217 return _tdsEval;
218 }
219
221
222 //---------------------------------------------
226
240 virtual void setDistanceAndReference(const char *funcName, URANIE::DataServer::TDataServer *tdsRef, const char *input, const char *reference, const char *weight="");
241
250 virtual void setDistanceAndReference(URANIE::Calibration::TDistanceFunction *distFunc, URANIE::DataServer::TDataServer *tdsRef, const char *input, const char *reference, const char *weight="");
252
253 //---------------------------------------------
257
258 /*
259 * \brief common method to estimate the parameters once all variables are set
260 * \param option : see parseOption
261 */
262 void estimateParameters(Option_t *option="");
263
264 /*
265 * \brief common method to estimate the residue on the observed dataserver given a specific set of parameter values
266 * \param resName: the name of the parameters to be stored
267 * \param n_theta: the number of parameters
268 * \param theta: the values of the parameters
269 */
270 void estimateCustomResidues(string resName, int n_theta, double *theta);
271
272
274 /*
275 * \warning Should only be used by user if one wants to provide its own DistanceFunction
276 */
277 void checkReference(URANIE::DataServer::TDataServer *tdsRef, const char *input, const char *output, const char *weight);
278
280
281 //---------------------------------------------
285
293 virtual void drawParameters(TString sTitre, const char *variable = "*", const char *select = "1>0", Option_t * option = "");// { UNUSED(sTitre, variable, select, option); cout<<"The method drawParameters is not relevant (and so not implemented) for the class "<<this->ClassName()<<endl; }
294
310 void drawResidues(TString sTitre, const char *variable = "*", const char *select="1>0", Option_t * option = "");
312
313 //---------------------------------------------
317 void setLog()
318 {
319 _blog = kTRUE;
320 }
321 void unsetLog()
322 {
323 _blog = kFALSE;
324 }
326 {
327 _blog = _blog ? kFALSE : kTRUE;
328 }
329 Bool_t getLog()
330 {
331 return _blog;
332 }
333 virtual void printLog(Option_t *option = "");
335
336
337protected:
338 //---------------------------------------------
342
344 void setMethodName(const char *str)
345 {
346 _sMethodName = TString(str);
347 }
348
350
351 //---------------------------------------------
355
359 virtual void computeParameters(Option_t *option="")=0;
360 virtual void checktdsParContent()=0;
361
363 void checkCanvasCreation(bool newcan);
364
367
369 void initResults(vector<string> *ParsedLines);
370
373
375 //---------------------------------------------
379
387 virtual void parseOption(Option_t *option = "");
389
390 ClassDef(URANIE::Calibration::TCalibration, ID_CALIBRATION)
391
392};
393
394} // Fin du namespace Calibration
395} // Fin du namespace URANIE
396
397#endif
Interface de la classe URANIE::Calibration::TDistanceFunction.
Description of the class TCalibration.
Definition TCalibration.h:64
TCalibration(URANIE::DataServer::TDataServer *tds, URANIE::Launcher::TCode *fcode, int ns=1, const char *option="")
Default Calibration constructor with the code argument: it contains the assessor to be used.
int _nIterMax
The maximum number of iteration allowed (meaning total number of code estimation is _nIterMax * _nObs...
Definition TCalibration.h:104
void initInputs()
Initialise some common inputs.
Bool_t getLog()
Definition TCalibration.h:329
TMatrixD _mObsCovMat
Observation Covariance matrix.
Definition TCalibration.h:115
bool _buseMatrix
Use matrix instead of vectors in the Distance Function.
Definition TCalibration.h:117
int _nPar
Dimension of the parameters.
Definition TCalibration.h:105
URANIE::DataServer::TDataServer * getEvaluationTDS()
Get the tds in which evaluation will be performed.
Definition TCalibration.h:216
virtual void setDistanceAndReference(URANIE::Calibration::TDistanceFunction *distFunc, URANIE::DataServer::TDataServer *tdsRef, const char *input, const char *reference, const char *weight="")
Set the distance function and some needed informations.
virtual ~TCalibration()
Default destructor.
URANIE::DataServer::TDataServer * _tdsPar
TDS containing parameters properties (parameters that should be calibrated)
Definition TCalibration.h:79
void estimateParameters(Option_t *option="")
virtual void computeParameters(Option_t *option="")=0
internal method in which the estimation is performed for all inheriting classes
void drawResidues(TString sTitre, const char *variable="*", const char *select="1>0", Option_t *option="")
virtual void drawParameters(TString sTitre, const char *variable="*", const char *select="1>0", Option_t *option="")
URANIE::DataServer::TDataServer * _tdsEval
TDS containing a priori / a posteriori evaluations.
Definition TCalibration.h:81
TString _sEO
The Name of output.
Definition TCalibration.h:86
virtual void printLog(Option_t *option="")
TList * _listOfParameters
List of the parameters to be calibrated.
Definition TCalibration.h:97
void setObservationCovarianceMatrix(TMatrixD &mat)
Set the observatiton covariance matrix.
void checkReference(URANIE::DataServer::TDataServer *tdsRef, const char *input, const char *output, const char *weight)
Check the consistency of the formation provided.
int _nSam
The number of sample in a posteriori distributions.
Definition TCalibration.h:102
void estimateCustomResidues(string resName, int n_theta, double *theta)
int _nVar
Dimension of the output and references to be compared with.
Definition TCalibration.h:106
URANIE::Relauncher::TRun * _run
Pointer to the runner to be used.
Definition TCalibration.h:88
void setLog()
Definition TCalibration.h:317
URANIE::Launcher::TCode * _code
The tcode.
Definition TCalibration.h:87
virtual void parseOption(Option_t *option="")
Read the possible options.
const char * getMethodName()
Get the method name.
Definition TCalibration.h:193
vector< string > _vrefName
The reference names.
Definition TCalibration.h:112
void computeAPosterioriForDistribution()
Compute the a posteriori residual for many-solutions method.
bool _buseMode
Use Mode instead of Mean.
Definition TCalibration.h:120
Bool_t _blog
Boolean for edit the log.
Definition TCalibration.h:121
void unsetLog()
Definition TCalibration.h:321
TString _sFunctionName
The Name of the evaluatuor.
Definition TCalibration.h:84
TString _sMethodName
The method name.
Definition TCalibration.h:109
void changeLog()
Definition TCalibration.h:325
URANIE::DataServer::TDataServer * _tdsObs
TDS containing observations used for calibration.
Definition TCalibration.h:80
UInt_t getSeed()
Get the seed of the random generator if one is used.
Definition TCalibration.h:187
Int_t getNPar()
Get the number of parameters to be calibrated.
Definition TCalibration.h:211
TCanvas * _canvas
Canvas object to deal with.
Definition TCalibration.h:99
TObjArray * _drawingGarbageCollector
Garbage collector for prints.
Definition TCalibration.h:100
Int_t getID()
Definition TCalibration.h:175
URANIE::Calibration::TDistanceFunction * _dFunc
Pointer to chosen distance function.
Definition TCalibration.h:94
TString _weightName
The weight name.
Definition TCalibration.h:114
int _nSeed
The seed of the random generator.
Definition TCalibration.h:108
TString _outputName
The output name.
Definition TCalibration.h:111
virtual void setDistanceAndReference(const char *funcName, URANIE::DataServer::TDataServer *tdsRef, const char *input, const char *reference, const char *weight="")
Set the distance function and some needed informations.
URANIE::Calibration::TDistanceFunction * getDistanceFunction()
Return the distance function.
Definition TCalibration.h:205
TCalibration(URANIE::DataServer::TDataServer *tds, void(*fcn)(Double_t *, Double_t *), const char *varexpinput, const char *varexpoutput, int ns=1, Option_t *option="")
Default Calibration constructor with the function argument: it contains the assessor to be used.
TCalibration(URANIE::DataServer::TDataServer *tds, const char *fcn, const char *varexpinput, const char *varexpoutput, int ns=1, Option_t *option="")
Default Calibration constructor with the function argument: it contains the assessor to be used.
void(* _pFunction)(double *, double *)
Function pointer.
Definition TCalibration.h:89
URANIE::DataServer::TDSNtupleD * _evTuple
Pointer to the eval ntuple.
Definition TCalibration.h:95
vector< URANIE::DataServer::TStochasticAttribute * > _vatt
internal vector of stochastic attribute for some methods
Definition TCalibration.h:90
int _nObs
The number of observations in the reference database.
Definition TCalibration.h:103
bool _bdontKeepAgreement
Remove the agreement attribute from the tdsPar object.
Definition TCalibration.h:119
void setMethodName(const char *str)
Set the Method name.
Definition TCalibration.h:344
void setSeed(UInt_t nval)
Set the seed of the random generator if one is used.
Definition TCalibration.h:181
TString _referenceName
The reference name.
Definition TCalibration.h:110
vector< string > _voutName
The output names.
Definition TCalibration.h:113
TString _sEI
The Name of input.
Definition TCalibration.h:85
void checkCanvasCreation(bool newcan)
Create a canvas if needed.
TCalibration(URANIE::DataServer::TDataServer *tds, URANIE::Relauncher::TRun *run, int ns=1, Option_t *option="")
Default constructor with the runner argument: it contains the assessor to be used.
void initResults(vector< string > *ParsedLines)
Initialise some common inputs.
ELauncher _nLauncher
The type of launcher.
Definition TCalibration.h:83
bool _bsaveAll
Whether all evaluations should be saved, not only a priori and a posteriori.
Definition TCalibration.h:118
ELauncher
Definition TCalibration.h:75
@ kCode
Definition TCalibration.h:76
@ kFunction
Definition TCalibration.h:76
@ kRun
Definition TCalibration.h:76
@ kUnknown
Definition TCalibration.h:76
Description of the class TDistanceFunction.
Definition TDistanceFunction.h:68
Definition TABC.cxx:46