English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / DataServer: TDSNtupleD.h Source File
Uranie / DataServer v4.9.0
/* @license-end */
TDSNtupleD.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#ifndef TDSNtupleD_H
18#define TDSNtupleD_H
19
20// ROOT
21#include "TROOT.h"
22#include "TTree.h"
23#include "TMatrixD.h"
24
25// URANIE
26#include "DataServer.h"
27#include "UEntry.h"
28
29#define SIZENAME std::string("size")
30
31namespace URANIE
32{
33namespace DataServer
34{
35class TDSNtupleD: public TTree
36{
37public:
38
45
48
50
58 TDSNtupleD(TTree* ntd, const char* varlist="*", const char* cut="", bool NewIsMainOne=false);
59
61
70 TDSNtupleD(const char* name, const char* title, const char* varlist,
71 const char *vartype, Int_t bufsize = 32000);
72
74
83 TDSNtupleD(const char* name, const char* title, const char* varlist,
84 Int_t bufsize = 32000);
85
87
98 TDSNtupleD(const char* name, const char* title, const char* varlist,
99 TMatrixD data, Int_t bufsize = 32000);
100
102
103
109 virtual Int_t Fill();
110
112
117 Int_t Fill(Double_t* AllValues);
118
120
126 Int_t Fill(Double_t x0, Double_t x1, Double_t x2=0, Double_t x3=0, Double_t x4=0,
127 Double_t x5=0, Double_t x6=0, Double_t x7=0, Double_t x8=0, Double_t x9=0,
128 Double_t x10=0, Double_t x11=0, Double_t x12=0, Double_t x13=0, Double_t x14=0);
129
130
132
136 Int_t Fill(std::string line, int IterIndex=-1);
137
139
142 Int_t Fill(std::vector<URANIE::DataServer::UEntry*> *event);
143
145
149 Int_t Fill(std::vector<URANIE::DataServer::UEntry*> *vinput, std::vector<URANIE::DataServer::UEntry*> *voutput);
150
152
153
158
160
180 TBranch* Branch(const char* name, void* address, const char* leaflist,
181 Int_t bufsize = 32000);
182
184
189 void ResetBranchAddress(TBranch *branch);
191
196
197
202
204
207 Double_t *GetArgs();
208
210
224 Double_t* getBranchData(const char* branchName, const char* selection = "",
225 Int_t* nbDataPtr = NULL);
226
228
248 void copyBranchData(Double_t* copyArray, int arraySize,
249 const char* branchName, const char* selection = "",
250 Int_t* nbDataPtr = NULL);
251
253
282 void extractData(Double_t* dataOut, Int_t arraySize,
283 const char* varexpinput = "*", const char* selection = "",
284 const Option_t* option = "line", Int_t *nbDataPtr = NULL);
285
287
298 void extractData(TMatrixD* matrix, const char* varexpinput = "*",
299 const char* selection = "");
300
302
307 Long64_t ReadFile(const char* filename);
309
314
316 void Merger(TDSNtupleD *file, const std::string newbrname, const std::string oldbrname, bool tdsmerge=false, const char* iter1="", const char* iter2="");
318
325 void Browse(TBrowser *b);
327
328
329
334 virtual Int_t GetNvar() const { return _fNvar; }
335 UInt_t getNVar(){return _fNvar;};
336 std::string getVarName(){return _varname;};
337 std::string getVarType(){return _vartype;};
338 int getVectSize(){return _vfArgs.size();};
340
342protected:
343
344 UInt_t _i;
345 UInt_t _fNvar;
346 std::vector<UEntry*> _vfArgs;
347 std::vector<Double_t> _vfDArgs;
348 std::vector<std::string*> _vfSArgs;
349 std::vector<std::vector<Double_t>* > _vfVArgs;
350 std::string _varname;
351 std::string _vartype;
352
353 std::map<std::string,unsigned int> _mTypeNb;
354 std::map<unsigned int,unsigned int> _mVarTypeNb;
355
360
362
366 void _initTTree(const char* name, const char* title);
367
369
372 void _branchConstruction(Int_t bufsize);
373
375
380
381
382 //Flag special because windows complains a lot
383#ifdef WIN32
384 Int_t Branch(TCollection* list, Int_t bufsize = 32000, Int_t splitlevel = 99, const char* name = "")
385 {
386 return TTree::Branch(list, bufsize, splitlevel, name );
387 }
388 Int_t Branch(TList* list, Int_t bufsize = 32000, Int_t splitlevel = 99)
389 {
390 return TTree::Branch(list, bufsize , splitlevel );
391 }
392 Int_t Branch(const char* folder, Int_t bufsize = 32000, Int_t splitlevel = 99)
393 {
394 return TTree::Branch(folder, bufsize , splitlevel );
395 }
396 TBranch* Branch(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 99)
397 {
398 return TTree::Branch(name, classname, addobj, bufsize, splitlevel );
399 }
400#endif
401
402};
403
404}
405}
406
407#endif
Definition TDSNtupleD.h:36
~TDSNtupleD()
Standard desctructor.
void _branchConstruction(Int_t bufsize)
Create the branches of the TDSNtupleD.
void Browse(TBrowser *b)
Parse a string using delim as a separation.
virtual Int_t Fill()
General Fill form: return TTree::Fill()
TDSNtupleD()
Standard empty constructor.
std::vector< std::vector< Double_t > * > _vfVArgs
Vector of Vector for variable defined that should be vector[double] (i.e. levele temporal)
Definition TDSNtupleD.h:349
TBranch * Branch(const char *name, void *address, const char *leaflist, Int_t bufsize=32000)
Create a new Branch.
std::vector< std::string * > _vfSArgs
Vector of variable defined as char*.
Definition TDSNtupleD.h:348
Int_t Fill(Double_t *AllValues)
Fill tuple with values in AllValues.
std::map< std::string, unsigned int > _mTypeNb
Map to store total number of variable per type.
Definition TDSNtupleD.h:353
ClassDef(URANIE::DataServer::TDSNtupleD, ID_DATASERVER)
TDSNtupleD(const char *name, const char *title, const char *varlist, const char *vartype, Int_t bufsize=32000)
Construct a new TDSNtupleD from a list of variable.
Double_t * GetArgs()
Return only the double argument of the tuple.
TDSNtupleD(TTree *ntd, const char *varlist="*", const char *cut="", bool NewIsMainOne=false)
Construct a new TDSNtupleD from an existing TTree/TDSNtupleD.
void ResetBranchAddresses()
Reset all branches addresses to the internal memory arrays.
Int_t Fill(std::string line, int IterIndex=-1)
Fill tuple with a line from an input file.
void extractData(Double_t *dataOut, Int_t arraySize, const char *varexpinput="*", const char *selection="", const Option_t *option="line", Int_t *nbDataPtr=NULL)
Extract selected data from the tuple to a flat array.
TDSNtupleD(const char *name, const char *title, const char *varlist, TMatrixD data, Int_t bufsize=32000)
Construct a new TDSNtupleD from a list of variable and a TMatrixD.
void copyBranchData(Double_t *copyArray, int arraySize, const char *branchName, const char *selection="", Int_t *nbDataPtr=NULL)
Copy the values of the selected entries of a given branch into the provided array.
void ResetBranchAddress(TBranch *branch)
Reset the branch addresses to the internal memory arrays.
Long64_t ReadFile(const char *filename)
Fill the TDSNtupleD using data from a text file.
std::vector< Double_t > _vfDArgs
Vector of entries (memory buffer and their ccorresponding types)
Definition TDSNtupleD.h:347
Int_t Fill(Double_t x0, Double_t x1, Double_t x2=0, Double_t x3=0, Double_t x4=0, Double_t x5=0, Double_t x6=0, Double_t x7=0, Double_t x8=0, Double_t x9=0, Double_t x10=0, Double_t x11=0, Double_t x12=0, Double_t x13=0, Double_t x14=0)
Fill tuple with values, up to 15 arguments.
void _initTTree(const char *name, const char *title)
Initialise TTree features.
UInt_t _fNvar
Number of columns.
Definition TDSNtupleD.h:345
Double_t * getBranchData(const char *branchName, const char *selection="", Int_t *nbDataPtr=NULL)
Return a pointer to the selected entries of a given branch.
void ClearVectorsAndMaps()
Clear the vectors and maps.
std::string _vartype
string describing the type of the variable
Definition TDSNtupleD.h:351
void extractData(TMatrixD *matrix, const char *varexpinput="*", const char *selection="")
Extract selected data from the tuple to a TMatrixD.
Int_t Fill(std::vector< URANIE::DataServer::UEntry * > *vinput, std::vector< URANIE::DataServer::UEntry * > *voutput)
Fill tuple with two vectors of UEntry.
TDSNtupleD(const char *name, const char *title, const char *varlist, Int_t bufsize=32000)
Construct a new TDSNtupleD from a list of variable.
std::string _varname
string describing the name of the variable
Definition TDSNtupleD.h:350
UInt_t getNVar()
Definition TDSNtupleD.h:335
Int_t Fill(std::vector< URANIE::DataServer::UEntry * > *event)
Fill tuple with a vector of UEntry.
std::vector< UEntry * > _vfArgs
Definition TDSNtupleD.h:346
std::string getVarName()
Definition TDSNtupleD.h:336
void Merger(TDSNtupleD *file, const std::string newbrname, const std::string oldbrname, bool tdsmerge=false, const char *iter1="", const char *iter2="")
To be written, might be very usefull :D.
virtual Int_t GetNvar() const
Definition TDSNtupleD.h:334
std::map< unsigned int, unsigned int > _mVarTypeNb
Map to the specific type index for the index i in total variable reference
Definition TDSNtupleD.h:354
int getVectSize()
Definition TDSNtupleD.h:338
std::string getVarType()
Definition TDSNtupleD.h:337
UInt_t _i
iterator vastly used
Definition TDSNtupleD.h:344
ROOT.
Definition TAttribute.h:106