English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / DataServer: URANIE::DataServer::TDSNtupleD Class Reference
Uranie / DataServer v4.9.0
/* @license-end */
URANIE::DataServer::TDSNtupleD Class Reference

#include <TDSNtupleD.h>

Inheritance diagram for URANIE::DataServer::TDSNtupleD:
Collaboration diagram for URANIE::DataServer::TDSNtupleD:

Public Member Functions

Constructors & destructor

The possible constructors

 TDSNtupleD ()
 Standard empty constructor.
 
 ~TDSNtupleD ()
 Standard desctructor.
 
 TDSNtupleD (TTree *ntd, const char *varlist="*", const char *cut="", bool NewIsMainOne=false)
 Construct a new TDSNtupleD from an existing TTree/TDSNtupleD.
 
 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.
 
 TDSNtupleD (const char *name, const char *title, const char *varlist, Int_t bufsize=32000)
 Construct a new TDSNtupleD from a list of variable.
 
 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.
 
Fillers

Function used to fill data

virtual Int_t Fill ()
 General Fill form: return TTree::Fill()
 
Int_t Fill (Double_t *AllValues)
 Fill tuple with values in AllValues.
 
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.
 
Int_t Fill (std::string line, int IterIndex=-1)
 Fill tuple with a line from an input file.
 
Int_t Fill (std::vector< URANIE::DataServer::UEntry * > *event)
 Fill tuple with a vector of UEntry.
 
Int_t Fill (std::vector< URANIE::DataServer::UEntry * > *vinput, std::vector< URANIE::DataServer::UEntry * > *voutput)
 Fill tuple with two vectors of UEntry.
 
Operation on branches

Creation of new branches and reassignement of their addresses

TBranch * Branch (const char *name, void *address, const char *leaflist, Int_t bufsize=32000)
 Create a new Branch.
 
void ResetBranchAddress (TBranch *branch)
 Reset the branch addresses to the internal memory arrays.
 
void ResetBranchAddresses ()
 Reset all branches addresses to the internal memory arrays.
 
Get data / extract data / readfiles

Methods to read and extract data for file, tuples...

Double_t * GetArgs ()
 Return only the double argument of the tuple.
 
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 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 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.
 
void extractData (TMatrixD *matrix, const char *varexpinput="*", const char *selection="")
 Extract selected data from the tuple to a TMatrixD.
 
Long64_t ReadFile (const char *filename)
 Fill the TDSNtupleD using data from a text file.
 
Utility

Utility function used mostly by other methods.

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.
 
void Browse (TBrowser *b)
 Parse a string using delim as a separation.
 

Protected Member Functions

Initialisation

Internal method used to initialise the ntuples

void _initTTree (const char *name, const char *title)
 Initialise TTree features.
 
void _branchConstruction (Int_t bufsize)
 Create the branches of the TDSNtupleD.
 
void ClearVectorsAndMaps ()
 Clear the vectors and maps.
 

Getters

Getters simple function

UInt_t _i
 iterator vastly used
 
UInt_t _fNvar
 Number of columns.
 
std::vector< UEntry * > _vfArgs
 
std::vector< Double_t > _vfDArgs
 Vector of entries (memory buffer and their ccorresponding types)
 
std::vector< std::string * > _vfSArgs
 Vector of variable defined as char*.
 
std::vector< std::vector< Double_t > * > _vfVArgs
 Vector of Vector for variable defined that should be vector[double] (i.e. levele temporal)
 
std::string _varname
 string describing the name of the variable
 
std::string _vartype
 string describing the type of the variable
 
std::map< std::string, unsigned int > _mTypeNb
 Map to store total number of variable per type.
 
std::map< unsigned int, unsigned int > _mVarTypeNb
 Map to the specific type index for the index i in total variable reference

 
virtual Int_t GetNvar () const
 
UInt_t getNVar ()
 
std::string getVarName ()
 
std::string getVarType ()
 
int getVectSize ()
 
 ClassDef (URANIE::DataServer::TDSNtupleD, ID_DATASERVER)
 

Constructor & Destructor Documentation

◆ TDSNtupleD() [1/5]

URANIE::DataServer::TDSNtupleD::TDSNtupleD ( )

Standard empty constructor.

Referenced by ClassImp().

◆ ~TDSNtupleD()

URANIE::DataServer::TDSNtupleD::~TDSNtupleD ( )

Standard desctructor.

Referenced by ClassImp(), and ClassImp().

◆ TDSNtupleD() [2/5]

URANIE::DataServer::TDSNtupleD::TDSNtupleD ( TTree *  ntd,
const char *  varlist = "*",
const char *  cut = "",
bool  NewIsMainOne = false 
)

Construct a new TDSNtupleD from an existing TTree/TDSNtupleD.

It is used for compatibility reasons. The contents of the TTree are copied (i.e. duplicated) into the TDSNtupleD.

Parameters
ntd(TTree*): a pointer to the TTree to be copied.
varlistlist of variable to be read separated by ":".
cutTTreeeFormula used to REJECT events
NewIsMainOneMAke the new tree have the regular name, the original one will then be GetName()+"_copied". Otherwise the new one will be GetNAme()+"_copy"

◆ TDSNtupleD() [3/5]

URANIE::DataServer::TDSNtupleD::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.

This is the main constructor of the TDSNtupleD.

Parameters
name(const char*): name of the object.
title(const char*): title of the object.
varlist(const char*): a list of branch names separated by ":".
vartype(const char*): a list of branch types separated by ":". Types are "D" for double, "V" for vectpr<double>, "S" for string.
bufsize(Int_t): buffer size (default = 32000).

◆ TDSNtupleD() [4/5]

URANIE::DataServer::TDSNtupleD::TDSNtupleD ( const char *  name,
const char *  title,
const char *  varlist,
Int_t  bufsize = 32000 
)

Construct a new TDSNtupleD from a list of variable.

Other version kept for back-compatibility assume that all variable are double

Warning
: vartype is defined as "D" by construction !!
Parameters
name(const char*): name of the object.
title(const char*): title of the object.
varlist(const char*): a list of branch names separated by ":". Types are "D" for double, "V" for vectpr<double>, "S" for string.
bufsize(Int_t): buffer size (default = 32000).

◆ TDSNtupleD() [5/5]

URANIE::DataServer::TDSNtupleD::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.

This constructor allows to create a TDSNtupleD and fill it with data contained in a TMatrixD. The number of columns of the matrix must match the number of variables of the TDSNtupleD.

Warning
: Assume that all variable are double (==> vartype is made with "D" only)
Parameters
name(const char*): name of the object.
title(const char*): title of the object.
varlist(const char*): a list of branch names separated by ":".
data(TMatrixD): a matrix containing the data.
bufsize(Int_t): buffer size (default = 32000).
Exceptions
UranieErrorif the number of variables in varlist is different from the number of columns of data.

Member Function Documentation

◆ _branchConstruction()

void URANIE::DataServer::TDSNtupleD::_branchConstruction ( Int_t  bufsize)
protected

Create the branches of the TDSNtupleD.

Parameters
bufsize(Int_t): buffer size.

Referenced by ClassImp().

◆ _initTTree()

void URANIE::DataServer::TDSNtupleD::_initTTree ( const char *  name,
const char *  title 
)
protected

Initialise TTree features.

Parameters
name(const char*): name of the object.
title(const char*): title of the object.

Referenced by ClassImp().

◆ Branch()

TBranch * URANIE::DataServer::TDSNtupleD::Branch ( const char *  name,
void *  address,
const char *  leaflist,
Int_t  bufsize = 32000 
)

Create a new Branch.

This function properly add a new Branch in the TDSNtupleD. The parameter _fNvar is incremented, the memory repository (_fDArgs or _vfVArgs) is resized accordingly depending on the nature of the new branch, and the addresses of the existing branches are reset. This function is written for the addAttribute method and does not concern the string branch (no TTreeFormula can be computed).

Warning
do not forget to call TNtupleD::ResetBranchAddress(TBranch*) or TNtupleD::ResetBranchAddresses() after you are done with the data filling. This will insure that the new branch is properly accessible by filler function.
Parameters
name(const char*): name of the new variable
address(void*): pointer to a Double_t variable which will be used to fill the new branch.
leaflist(const char*): this parameter is left for compatibility reasons. It is advised to leave this string empty (default = "").
bufsize(Int_t): buffer size (default = 32000)

Referenced by ClassImp(), and ClassImp().

◆ Browse()

void URANIE::DataServer::TDSNtupleD::Browse ( TBrowser *  b)

Parse a string using delim as a separation.

This function parse a string using delim as a seperation and stores the results in the given vector

Parameters
inputthe string to be parsed
delimthe separation to be used
resthe vector to be used to store all substring

Referenced by ClassImp().

◆ ClassDef()

URANIE::DataServer::TDSNtupleD::ClassDef ( URANIE::DataServer::TDSNtupleD  ,
ID_DATASERVER   
)

◆ ClearVectorsAndMaps()

void URANIE::DataServer::TDSNtupleD::ClearVectorsAndMaps ( )
protected

Clear the vectors and maps.

Clear the internal vectors and maps

Referenced by ClassImp().

◆ copyBranchData()

void URANIE::DataServer::TDSNtupleD::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.

Contrary to "getBranchData" which does not copy the data, this function allows to safely retrieve the selected data of a given branch. The user must provide an array with enough allocated memory to contains all the data to copy.

Parameters
copyArray(Double_t*): an array of double allocated by the user. Unless the size of the selection is known, it is advised to allocate the maximum number of data in the branch.
arraySize(Int_t): the size of the "copyArray".
branchName(const char*): the name of the branch from which we want to retrieve the data.
selection(const char*): a selection (in ROOT style) of the data to retrieve (default = "").
nbDataPtr(Int_t *): address of an integer variable which will receive the number of selected data (default = NULL).
Exceptions
UErrorExceptionif the branch does not exist.
UErrorExceptionif the branch is not a branch filled with regular double.
UErrorExceptionif the number of selected data is greater than the size of the array.

Referenced by ClassImp().

◆ extractData() [1/2]

void URANIE::DataServer::TDSNtupleD::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.

The extracted data are stored in a Double_t array passed as parameter and allocated by the user. This is a "flat" array, i.e. if more than one attribute is selected, the user need to be aware of the order in which the values are stored. This order is given as option:

  • option == "line": dataOut[i * nbCol + j] = tds[i,j]
  • option == "column": dataOut[i + j * nbLine] = tds[i,j] where i is the event index, j is the attribute index, nbCol is the number of selected attributes and nbLine the number of selected events. PLEASE NOTE that the expression "tds[i,j]" does not exist in URANIE. It is used only for simplicity.
    Parameters
    dataOut(double_t*): an array of double which will store the extracted data.
    arraySize(Int_t): the size of the array dataOut. It must be at least nCol * nLines, where nCol is the number of selected variables, and nLines is the number of selected elements.
    varexpinput(const char*): a list of attribute names separated by semicolons (":"). If "" or "*", all the variables of the tuple are used (default = "*").
    selection(const char*): a selection (in ROOT style) of the data to retrieve (default = "").
    option(const Option_t*): a character string defining how multi-dimensionnal data are stored in dataOut (cf. description above) (default: "line").
    nbDataPtr(Int_t *): address of an integer variable which will receive the number of selected data (default = NULL).
    Exceptions
    UErrorExceptionif one of the selected branches does not exist.
    UErrorExceptionif one of the branches is not a branch filled with regular double.
    UErrorExceptionif the number of selected data is greater than the size of the array.

Referenced by ClassImp().

◆ extractData() [2/2]

void URANIE::DataServer::TDSNtupleD::extractData ( TMatrixD *  matrix,
const char *  varexpinput = "*",
const char *  selection = "" 
)

Extract selected data from the tuple to a TMatrixD.

The extracted data are stored in a TMatrixD. The matrix will be resized as necessary and all its previous contents will be lost. Each column of the matrix corresponds to an input variable, and each line to an event.

Parameters
matrix(TMatrixD*): pointer to a matrix of double that will store the extracted values.
varexpinput(const char*): a list of attribute names separated by semicolons (":"). If "" or "*", all the variables of the tuple are used (default = "*").
selection(const char*): a selection (in ROOT style) of the data to retrieve (default = "").
Exceptions
UErrorExceptionif one of the selected branches does not exist.
UErrorExceptionif one of the branches is not a branch filled with regular double.

◆ Fill() [1/6]

virtual Int_t URANIE::DataServer::TDSNtupleD::Fill ( )
virtual

General Fill form: return TTree::Fill()

Referenced by ClassImp(), ClassImp(), ClassImp(), and ClassImp().

◆ Fill() [2/6]

Int_t URANIE::DataServer::TDSNtupleD::Fill ( Double_t *  AllValues)

Fill tuple with values in AllValues.

Parameters
AllValuesvalues to be stored in the tuple
Exceptions
UranieErrorif the number of variables in varlist is different from the number of columns of data, or if string or vector<double> are available in the tuple

◆ Fill() [3/6]

Int_t URANIE::DataServer::TDSNtupleD::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.

Back compatibility with the older version of TDSNtupleD that inherited this method from TNtupleD

Parameters
x0,x1,..,x14values to be stored in the tuple
Exceptions
UranieErrorif the number of variables in varlist is different from the number of columns of data, or if string or vector<double> are available in the tuple

◆ Fill() [4/6]

Int_t URANIE::DataServer::TDSNtupleD::Fill ( std::string  line,
int  IterIndex = -1 
)

Fill tuple with a line from an input file.

Parameters
linecontain an entry for all attribute of the tree
IterIndexgive the index in the line of the iterator (if there is one)

◆ Fill() [5/6]

Int_t URANIE::DataServer::TDSNtupleD::Fill ( std::vector< URANIE::DataServer::UEntry * > *  event)

Fill tuple with a vector of UEntry.

Parameters
evtVector of UEntry that will be used to

◆ Fill() [6/6]

Int_t URANIE::DataServer::TDSNtupleD::Fill ( std::vector< URANIE::DataServer::UEntry * > *  vinput,
std::vector< URANIE::DataServer::UEntry * > *  voutput 
)

Fill tuple with two vectors of UEntry.

Parameters
vinputVector of UEntry that will be used to fill inputs
voutputVector of UEntry that will be used to fill outputs

◆ GetArgs()

Double_t * URANIE::DataServer::TDSNtupleD::GetArgs ( )

Return only the double argument of the tuple.

Check whether this should be kept !!

Referenced by ClassImp().

◆ getBranchData()

Double_t * URANIE::DataServer::TDSNtupleD::getBranchData ( const char *  branchName,
const char *  selection = "",
Int_t *  nbDataPtr = NULL 
)

Return a pointer to the selected entries of a given branch.

Warning
the returned pointer redirects to the results of a "TDSNtupleD::Draw()" call, which means that any new call will modify the contents. If you need to protect the values of the retrieved data, you either need to copy the contents of the returned array or use the function "copyBranchData".
Parameters
branchName(const char*): the name of the branch from which we want to retrieve the data.
selection(const char*): a selection (in ROOT style) of the data to retrieve (default = "").
nbDataPtr(Int_t *): address of an integer variable which will receive the number of selected data (default = NULL).
Exceptions
UErrorExceptionif the branch does not exist.
UErrorExceptionif the branch is not a branch filled with regular double.

Referenced by ClassImp().

◆ getNVar()

UInt_t URANIE::DataServer::TDSNtupleD::getNVar ( )
inline

References _fNvar.

◆ GetNvar()

virtual Int_t URANIE::DataServer::TDSNtupleD::GetNvar ( ) const
inlinevirtual

References _fNvar.

◆ getVarName()

std::string URANIE::DataServer::TDSNtupleD::getVarName ( )
inline

References _varname.

◆ getVarType()

std::string URANIE::DataServer::TDSNtupleD::getVarType ( )
inline

References _vartype.

◆ getVectSize()

int URANIE::DataServer::TDSNtupleD::getVectSize ( )
inline

References _vfArgs.

◆ Merger()

void URANIE::DataServer::TDSNtupleD::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.

Referenced by ClassImp(), ClassImp(), and ClassImp().

◆ ReadFile()

Long64_t URANIE::DataServer::TDSNtupleD::ReadFile ( const char *  filename)

Fill the TDSNtupleD using data from a text file.

This function overrides the TNtupleD's one. There is no limit in the number of characters that can be read in a row.

Parameters
filename(const char*): the name of the file containign the data.

Referenced by ClassImp().

◆ ResetBranchAddress()

void URANIE::DataServer::TDSNtupleD::ResetBranchAddress ( TBranch *  branch)

Reset the branch addresses to the internal memory arrays.

Use this method when the addresses were changed via calls to SetBranchAddress().

Parameters
branch(TBranch*): the pointer to the branch we want to reset the addresses

Referenced by ClassImp().

◆ ResetBranchAddresses()

void URANIE::DataServer::TDSNtupleD::ResetBranchAddresses ( )

Reset all branches addresses to the internal memory arrays.

Use this method when the addresses were changed via calls to SetBranchAddress().

Referenced by ClassImp().

Member Data Documentation

◆ _fNvar

UInt_t URANIE::DataServer::TDSNtupleD::_fNvar
protected

Number of columns.

Referenced by ClassImp(), getNVar(), and GetNvar().

◆ _i

UInt_t URANIE::DataServer::TDSNtupleD::_i
protected

iterator vastly used

Referenced by ClassImp().

◆ _mTypeNb

std::map<std::string,unsigned int> URANIE::DataServer::TDSNtupleD::_mTypeNb
protected

Map to store total number of variable per type.

Referenced by ClassImp().

◆ _mVarTypeNb

std::map<unsigned int,unsigned int> URANIE::DataServer::TDSNtupleD::_mVarTypeNb
protected

Map to the specific type index for the index i in total variable reference

Referenced by ClassImp().

◆ _varname

std::string URANIE::DataServer::TDSNtupleD::_varname
protected

string describing the name of the variable

Referenced by ClassImp(), and getVarName().

◆ _vartype

std::string URANIE::DataServer::TDSNtupleD::_vartype
protected

string describing the type of the variable

Referenced by ClassImp(), and getVarType().

◆ _vfArgs

std::vector<UEntry*> URANIE::DataServer::TDSNtupleD::_vfArgs
protected

Referenced by ClassImp(), and getVectSize().

◆ _vfDArgs

std::vector<Double_t> URANIE::DataServer::TDSNtupleD::_vfDArgs
protected

Vector of entries (memory buffer and their ccorresponding types)

Array of variables defined as double

Referenced by ClassImp().

◆ _vfSArgs

std::vector<std::string*> URANIE::DataServer::TDSNtupleD::_vfSArgs
protected

Vector of variable defined as char*.

Referenced by ClassImp().

◆ _vfVArgs

std::vector<std::vector<Double_t>* > URANIE::DataServer::TDSNtupleD::_vfVArgs
protected

Vector of Vector for variable defined that should be vector[double] (i.e. levele temporal)

Referenced by ClassImp().