English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / DataServer: TDSNtupleD.h Source File
Uranie / DataServer  v4.10.0
/* @license-end */
TDSNtupleD.h
Go to the documentation of this file.
1 // 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 
31 namespace URANIE
32 {
33 namespace DataServer
34 {
35 class TDSNtupleD: public TTree
36 {
37 public:
38 
43  TDSNtupleD();
45 
47  ~TDSNtupleD();
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 
108  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 
194  void ResetBranchAddresses();
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 
341  ClassDef(URANIE::DataServer::TDSNtupleD, ID_DATASERVER);
342 protected:
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 
378  void ClearVectorsAndMaps();
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
ROOT.
Definition: TAttribute.h:104
UInt_t _i
iterator vastly used
Definition: TDSNtupleD.h:344
void _initTTree(const char *name, const char *title)
Initialise TTree features.
virtual Int_t GetNvar() const
Definition: TDSNtupleD.h:334
std::string _vartype
string describing the type of the variable
Definition: TDSNtupleD.h:351
std::string _varname
string describing the name of the variable
Definition: TDSNtupleD.h:350
virtual Int_t Fill()
General Fill form: return TTree::Fill()
Double_t * GetArgs()
Return only the double argument of the tuple.
int getVectSize()
Definition: TDSNtupleD.h:338
std::vector< std::string * > _vfSArgs
Vector of variable defined as char*.
Definition: TDSNtupleD.h:348
TDSNtupleD()
Standard empty constructor.
UInt_t getNVar()
Definition: TDSNtupleD.h:335
ClassDef(URANIE::DataServer::TDSNtupleD, ID_DATASERVER)
Double_t * getBranchData(const char *branchName, const char *selection="", Int_t *nbDataPtr=NULL)
Return a pointer to the selected entries of a given branch.
std::vector< Double_t > _vfDArgs
Vector of entries (memory buffer and their ccorresponding types)
Definition: TDSNtupleD.h:347
void _branchConstruction(Int_t bufsize)
Create the branches of the TDSNtupleD.
~TDSNtupleD()
Standard desctructor.
UInt_t _fNvar
Number of columns.
Definition: TDSNtupleD.h:345
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.
std::map< std::string, unsigned int > _mTypeNb
Map to store total number of variable per type.
Definition: TDSNtupleD.h:353
void ClearVectorsAndMaps()
Clear the vectors and maps.
std::vector< UEntry * > _vfArgs
Definition: TDSNtupleD.h:346
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.
std::string getVarType()
Definition: TDSNtupleD.h:337
void ResetBranchAddress(TBranch *branch)
Reset the branch addresses to the internal memory arrays.
std::vector< std::vector< Double_t > *> _vfVArgs
Vector of Vector for variable defined that should be vectordouble
Definition: TDSNtupleD.h:349
void Browse(TBrowser *b)
Parse a string using delim as a separation.
void ResetBranchAddresses()
Reset all branches addresses to the internal memory arrays.
Definition: TDSNtupleD.h:35
TBranch * Branch(const char *name, void *address, const char *leaflist, Int_t bufsize=32000)
Create a new Branch.
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.
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
Long64_t ReadFile(const char *filename)
Fill the TDSNtupleD using data from a text file.
std::string getVarName()
Definition: TDSNtupleD.h:336