English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Sensitivity: TSensitivity.h Source File
Uranie / Sensitivity v4.9.0
/* @license-end */
TSensitivity.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// TSensitivity jeu sep 14 09:01:14 CEST 2006
19// $Id$
20// $Author$
21// $Date$
22// $Revision$
23// $State$
25
80#ifndef TSENSITIVITY_H
81#define TSENSITIVITY_H
82
84#include "TMethodCall.h"
85#include "TTree.h"
86#include "TMatrixD.h"
87#include "TRandom3.h"
88#include "TNamed.h"
89#include "TNtupleD.h"
90#include "TMath.h"
91
92#include <iostream>
93#include <sstream>
94using std::cout;
95using std::endl;
96
97// Uranie
98#include "TDataServer.h"
99#include "TCode.h"
100#include "TRun.h"
101#include "UExceptions.h"
102#include "Sensitivity.h"
103#ifdef WITH_LIBSSH
104#include "TCluster.h"
105#endif
106
107#define MAXLENGTHSTRING 50
108
109namespace URANIE {
110namespace Sensitivity {
111class TSensitivity: public TNamed
112{
113
114 // Attributes
115 //---------------------------------------------
123protected:
129 Double_t _valSobolCrt;
132 TMatrixD _minputCorr;
135
137
138 //---------------------------------------------
143public:
148
149 URANIE::DataServer::TDataServer *_tds;
153
154#ifdef WITH_LIBSSH
155 URANIE::Launcher::TCluster* _cluster;
156 URANIE::Launcher::TCluster* getCluster(){
157 return _cluster;
158 };
159
160 void addCluster(URANIE::Launcher::TCluster* cluster){
161 _cluster = cluster;
162 _cluster->setDataServer(_tds);
163 };
164#endif
165
166 Int_t _nS;
167 Int_t _nX;
168 UInt_t _nY;
169 UInt_t _nElY;
170 Int_t _nbOut;
171 Int_t _iOut;
172 unsigned int _iy;
173 unsigned int _iely;
174
177 URANIE::Launcher::TCode *_code;
178 URANIE::Relauncher::TRun *_run;
179
181 Int_t _nSeed;
182
184 Bool_t _blog;
187
189 TString _sMethodName;
190
193
194 map<string, unsigned int> _mAttributeSize;
195 map<string, vector<int> > _mAttributeElements;
196 vector<string> _vOutputNames;
197
198 void setNLauncher(ELauncher codeLauncher){
199 _nLauncher = codeLauncher;
200 };
201
202 TCanvas *_canvas;
203
204#ifdef ROOT5
205 TMethodCall *fMethodCall; //Pointer to MethodCall in case of interpreted function
206 void (*fMethod)(Double_t *x, Double_t *y);
207#else
208 void (*_pFunction)(double *, double *);
209#endif
210 TTree* _ntresult;
212
213 // Operations
214private:
219
220protected:
221 //---------------------------------------------
225
226 void checkCanvasCreation(bool newcan);
228 void drawIndexesHistogram(TString sTitre, const char *select = "", Option_t * option = "");
230 void drawIndexesPie(TString sTitre, const char *select = "", Option_t * option = "");
232
234
237 virtual void preTreatment(){}
238
240
243 virtual void postTreatment(){}
244
246
251 void setNoIntermediateSaved(Bool_t bbool = kTRUE){
252 _bnoIntermediateSaved = bbool;
253 }
254
255public:
256 //---------------------------------------------
260
263 TSensitivity(URANIE::DataServer::TDataServer *tds, const char *fcn, Int_t ns,
264 const char *varexpinput = "", const char *varexpoutput = "",
265 Option_t * option = "");
266#ifdef ROOT5
268 TSensitivity(URANIE::DataServer::TDataServer *tds, void *fcn, Int_t ns,
269 const char *varexpinput = "", const char *varexpoutput = "",
270 Option_t * option = "");
271#else
272 TSensitivity(URANIE::DataServer::TDataServer *tds,
273 void (*fcn)(Double_t*,Double_t*),
274 const char *varexpinput, const char *varexpoutput,
275 Int_t ns, Option_t * option = "");
276#endif
278 TSensitivity(URANIE::DataServer::TDataServer *tds, const char *varexpinput,
279 const char *varexpoutput, Option_t * option = "");
281
283 TSensitivity(URANIE::DataServer::TDataServer *tds,
284 URANIE::Launcher::TCode *code, Int_t ns, Option_t * option = "");
286
288 TSensitivity(URANIE::DataServer::TDataServer *tds,
289 URANIE::Relauncher::TRun *run, Int_t ns, Option_t * option = "");
291 virtual ~TSensitivity();
293
294 //---------------------------------------------
298 Int_t getID(){
299 return ID_SENSITIVITY;
300 }
302 virtual TTree * getResultTuple(bool commonresulttuple=true){
303 UNUSED(commonresulttuple);
304 return _ntresult;
305 }
306
307 double getValue(const char * sorder ="", const char * sinputname="", const char * sselect="");
308
309 vector<int>* getAttributeElements(string str){
310 return ((_mAttributeElements.count(str)==0)?NULL:&_mAttributeElements[str]);
311 }
312
313#ifdef ROOT5
314 TMethodCall *GetMethodCall() const{
315 return fMethodCall;
316 }
317 void setFunction(void *fcn, Int_t nx = -1, Int_t ny = 1);
318#else
319 void setFunction(void (*fct)(Double_t*, Double_t*), Int_t nx = -1, Int_t ny = 1);
320#endif
322 return _sFunctionName;
323 }
324 void setSeed(UInt_t nval){
325 _nSeed = nval;
326 }
327 UInt_t getSeed(){
328 return _nSeed;
329 }
331 virtual void setMethodName(const char *str){
332 _sMethodName = TString(str);
333 }
335 const char * getMethodName(){
336 return _sMethodName.Data();
337 }
338
340
346
348 const char * getIteratorName(){
349 return _sIteratorName.Data();
350 }
352 void setSensitivityIteratorName(const char *str){
353 _sIteratorName = TString(str);
354 }
359 void setTimeName(TString sname);
364 TString getTimeName() { return _sTimeAttribute;}
366
370 virtual void setDrawProgressBar(Bool_t bbool = kTRUE){
371 _bdrawProgressBar = bbool;
372 }
373
375
378 void setUsingErrors(bool thebool){ _bgoingThroughError=thebool;}
379
381
385 return _bdrawProgressBar;
386 }
392 return _bisInputCorrelated;
393 }
399 return _minputCorr;
400 }
401
406 Int_t getNInput() {
407 return _nX;
408 }
409
414 Int_t getNOutput() {
415 return _nY;
416 }
418
419 //---------------------------------------------
423 virtual void generateSample(Option_t * option = "") = 0;
424 void setInputCorrelationMatrix(TMatrixD Corr);
426
427 //---------------------------------------------
431
437 virtual void parseOption(Option_t *option = "");
439
440 //---------------------------------------------
444
450 void checkOutputRequested(string attlist, bool fromoption=false);
452
453 //---------------------------------------------
457
463 void computeIndexes(Option_t * option = "");
464
476 virtual void evaluateIndexes(Option_t * option = "") = 0;
477
488 void fillIndex(const char * sinputname, const char * sorder,
489 Double_t dval, const char* algo = "",
490 Double_t dvalCILower = -1.0, Double_t dvalCIUpper = -1.0);
492
493 //---------------------------------------------
497 virtual void createTuple(Option_t *option = "");
499 virtual void drawIndexes(TString sTitre, const char *select = "",
500 Option_t * option = "");
502
503 //---------------------------------------------
507 virtual void setLog(){
508 _blog = kTRUE;
509 }
510 void unsetLog(){
511 _blog = kFALSE;
512 }
513 void changeLog(){
514 _blog = _blog ? kFALSE : kTRUE;
515 }
516 Bool_t getLog(){
517 return _blog;
518 }
519 virtual void printLog(Option_t *option = "");
521
522 ClassDef(URANIE::Sensitivity::TSensitivity, ID_SENSITIVITY)
523
524};
525
526} // Fin du namespace Sensitivity
527} // Fin du namespace URANIE
528
529#ifdef ROOT5
530R__EXTERN URANIE::Sensitivity::TSensitivity *gSensitivity;
531#endif
532
533#endif
#define MAXLENGTHSTRING
Definition TSensitivity.h:107
Description of the class TSensitivity.
Definition TSensitivity.h:112
TList * _listOfInputAttributes
List of the input branches.
Definition TSensitivity.h:150
TMatrixD getMatrixInputCorrelation()
Definition TSensitivity.h:398
Char_t _sOrder[MAXLENGTHSTRING]
The order of sensitivity indexes.
Definition TSensitivity.h:126
Int_t _nSeed
The seed of the random generator.
Definition TSensitivity.h:181
vector< int > * getAttributeElements(string str)
Definition TSensitivity.h:309
TSensitivity(URANIE::DataServer::TDataServer *tds, const char *fcn, Int_t ns, const char *varexpinput="", const char *varexpoutput="", Option_t *option="")
Default constructor with the name of a function.
void setSeed(UInt_t nval)
Definition TSensitivity.h:324
Int_t _nS
The number of simulation or other information depend on the used method.
Definition TSensitivity.h:166
TString _sSelectedOutput
The output.
Definition TSensitivity.h:191
void unsetLog()
Definition TSensitivity.h:510
TSensitivity(URANIE::DataServer::TDataServer *tds, URANIE::Launcher::TCode *code, Int_t ns, Option_t *option="")
Default constructor with TCode arg.
void checkOutputRequested(string attlist, bool fromoption=false)
Check the output list requested by the user.
unsigned int _iely
iterator over number of element
Definition TSensitivity.h:173
Double_t _valSobolCrt
The value of sensitivity indexes.
Definition TSensitivity.h:129
void checkCanvasCreation(bool newcan)
Create a canvas if needed.
TSensitivity(URANIE::DataServer::TDataServer *tds, URANIE::Relauncher::TRun *run, Int_t ns, Option_t *option="")
Default constructor with TRun arg.
Bool_t _bisInputCorrelated
State whether the input correlation matrix is set.
Definition TSensitivity.h:133
map< string, vector< int > > _mAttributeElements
Map of Elements number to run (if vector subselection is requested)
Definition TSensitivity.h:195
Int_t getID()
Definition TSensitivity.h:298
virtual void setLog()
Definition TSensitivity.h:507
double getValue(const char *sorder="", const char *sinputname="", const char *sselect="")
Int_t getNInput()
Get the number of input attributes.
Definition TSensitivity.h:406
Bool_t _bnoIntermediateSaved
Boolean to know if the progress bar has to be drawn.
Definition TSensitivity.h:186
UInt_t _nElY
Number of element for one selected output.
Definition TSensitivity.h:169
Double_t _valSobolCILower
The value of lower Condidence Interval (95)
Definition TSensitivity.h:130
virtual void preTreatment()
PreTreatment for every output.
Definition TSensitivity.h:237
virtual void setMethodName(const char *str)
Set the Method name.
Definition TSensitivity.h:331
Double_t _valSobolCIUpper
The value of upper Condidence Interval (95)
Definition TSensitivity.h:131
Bool_t getNoIntermediateSaved()
Get the noIntermediateSaved flag.
Definition TSensitivity.h:343
void(* _pFunction)(double *, double *)
Definition TSensitivity.h:208
TObjArray * _drawingGarbageCollector
Garbage collector for prints.
Definition TSensitivity.h:180
virtual ~TSensitivity()
Default destructor.
Bool_t getLog()
Definition TSensitivity.h:516
TString _sSelectedInput
The input.
Definition TSensitivity.h:192
TCanvas * _canvas
Canvas object to deal with.
Definition TSensitivity.h:202
virtual void drawIndexes(TString sTitre, const char *select="", Option_t *option="")
Draws the indexes.
void setUsingErrors(bool thebool)
Set the "using error results anyway" option.
Definition TSensitivity.h:378
virtual void generateSample(Option_t *option="")=0
Int_t getNOutput()
Get the number of output attributes.
Definition TSensitivity.h:414
void fillIndex(const char *sinputname, const char *sorder, Double_t dval, const char *algo="", Double_t dvalCILower=-1.0, Double_t dvalCIUpper=-1.0)
Method to fill in the tree the value of Sensitivity indexes for an input attribute.
virtual void printLog(Option_t *option="")
TSensitivity()
Default constructor.
virtual TTree * getResultTuple(bool commonresulttuple=true)
Get the result ntuple (default parameter unused but for Morris method)
Definition TSensitivity.h:302
Bool_t _bChosenOutputs
Fact that the input list is provided or not.
Definition TSensitivity.h:183
TString _sFunctionName
The Name of the evaluatuor.
Definition TSensitivity.h:176
TString getFunctionName()
Definition TSensitivity.h:321
virtual void parseOption(Option_t *option="")
Read the possible options.
map< string, unsigned int > _mAttributeSize
Map of size of element for attribute;.
Definition TSensitivity.h:194
void setSensitivityIteratorName(const char *str)
Set the iterator name devoted to compute sensitivity indexes.
Definition TSensitivity.h:352
Int_t _iOut
counter for output
Definition TSensitivity.h:171
void drawIndexesHistogram(TString sTitre, const char *select="", Option_t *option="")
Draws indexes with an histogram.
TList * _listOfOutputAttributes
List of the input branches.
Definition TSensitivity.h:151
Char_t _sMethod[MAXLENGTHSTRING]
The name of the method.
Definition TSensitivity.h:127
unsigned int _iy
iterator over number of element
Definition TSensitivity.h:172
TSensitivity(URANIE::DataServer::TDataServer *tds, void(*fcn)(Double_t *, Double_t *), const char *varexpinput, const char *varexpoutput, Int_t ns, Option_t *option="")
TTree * _ntresult
The TTree of results.
Definition TSensitivity.h:210
virtual void setDrawProgressBar(Bool_t bbool=kTRUE)
Set the "draw progress bar" flag.
Definition TSensitivity.h:370
void setInputCorrelationMatrix(TMatrixD Corr)
virtual void evaluateIndexes(Option_t *option="")=0
Evaluates the index from a Specific TDataServer.
void drawIndexesPie(TString sTitre, const char *select="", Option_t *option="")
Draws indexes with an pie chart.
ELauncher _nLauncher
The type of launcher.
Definition TSensitivity.h:175
void setTimeName(TString sname)
Set the name of the time attribute (only one)
void setNoIntermediateSaved(Bool_t bbool=kTRUE)
Set the "only final file" flag.
Definition TSensitivity.h:251
TSensitivity(URANIE::DataServer::TDataServer *tds, const char *varexpinput, const char *varexpoutput, Option_t *option="")
Default constructor.
Bool_t getDrawProgressBar()
Get the clean flag.
Definition TSensitivity.h:384
UInt_t getSeed()
Definition TSensitivity.h:327
TString _sMethodName
The method name.
Definition TSensitivity.h:189
Char_t _sOutputAttribute[MAXLENGTHSTRING]
The name of the output attribute.
Definition TSensitivity.h:124
Char_t _sInputAttribute[MAXLENGTHSTRING]
The name of the input attribute.
Definition TSensitivity.h:125
void changeLog()
Definition TSensitivity.h:513
virtual void postTreatment()
PostTreatment for every output.
Definition TSensitivity.h:243
vector< string > _vOutputNames
Name of the output.
Definition TSensitivity.h:196
Bool_t isInputCorrelated()
Definition TSensitivity.h:391
void setFunction(void(*fct)(Double_t *, Double_t *), Int_t nx=-1, Int_t ny=1)
TString _sIteratorName
The specific iterator attribute for the method.
Definition TSensitivity.h:188
Bool_t _bdrawProgressBar
Boolean to know if the progress bar has to be drawn.
Definition TSensitivity.h:185
URANIE::Relauncher::TRun * _run
Definition TSensitivity.h:178
Int_t _nbOut
Total number of Output to be considered.
Definition TSensitivity.h:170
virtual void createTuple(Option_t *option="")
URANIE::DataServer::TDataServer * _tds
Pointeur vers un TDS.
Definition TSensitivity.h:149
Char_t _sAlgorithm[MAXLENGTHSTRING]
The name of the algorithm to compute the index.
Definition TSensitivity.h:128
const char * getMethodName()
Get the method name.
Definition TSensitivity.h:335
Bool_t _blog
Boolean for edit the log.
Definition TSensitivity.h:184
void computeIndexes(Option_t *option="")
Compute the Sensitivity Indexes.
ELauncher
Definition TSensitivity.h:145
@ kRun
Definition TSensitivity.h:146
@ kCodeRemote
Definition TSensitivity.h:146
@ kUnknown
Definition TSensitivity.h:146
@ kFunction
Definition TSensitivity.h:146
@ kCode
Definition TSensitivity.h:146
Int_t _nX
Dimension of the input.
Definition TSensitivity.h:167
TString getTimeName()
Get the name of the time attribute.
Definition TSensitivity.h:364
TMatrixD _minputCorr
Input correlation matrix if sample needs to be correlated.
Definition TSensitivity.h:132
Bool_t _bgoingThroughError
State whether the error must not block the computation.
Definition TSensitivity.h:134
UInt_t _nY
Dimension of the target.
Definition TSensitivity.h:168
const char * getIteratorName()
Get the name of the iterator attribut of the method.
Definition TSensitivity.h:348
void setNLauncher(ELauncher codeLauncher)
Definition TSensitivity.h:198
TString _sTimeAttribute
The name of the Time attribute.
Definition TSensitivity.h:152
URANIE::Launcher::TCode * _code
The tcode.
Definition TSensitivity.h:177
ROOT.
Definition TCMN.h:45