13.2.1. Macro “dataserverAttributes.C

13.2.1.1. Objective

The goal of this macro is only to master the objects TAttribute and TDataServer of Uranie. Three attributes will be created and linked to a TDataServer object, then the log of this object will be printed to check internal data of this TDataServer.

13.2.1.2. Macro Uranie

    // Define the DataServer of the study
    TDataServer *tds = new TDataServer("tds", "my first TDS");

    // Define the attribute "x"
    TAttribute *px = new TAttribute("x", -2.0, 4.0);
    px->setTitle("#Delta P^{#sigma}");
    px->setUnity("#frac{mm^{2}}{s}");

    // Define the attribute "y"
    TAttribute *py = new TAttribute("y", 0.0, 1.0);

    // Add the attributes in the TDataServer
    tds->addAttribute(px);
    tds->addAttribute(py);

    tds->addAttribute(new TAttribute("z", 0.25, 0.50));

    tds->printLog();

The first attribute “x” is defined on [-2.0, 4.0]; its title is \(\Delta P^{\sigma}\) and unity \(\frac{mm^{2}}{s}\)

    TAttribute *px = new TAttribute("x", -2.0, 4.0);
    px->setTitle("#Delta P^{#sigma}");
    px->setUnity("#frac{mm^{2}}{s}");

The second attribute “y” is defined on [0.0,1.0]; it will be set with its name as title but without unity.

    TAttribute *py = new TAttribute("y", 0.0, 1.0);

Secondly, a TDataServer object is created and the two attributes x and y created before are linked to this one.

    TDataServer *tds = new TDataServer("tds", "my first TDS");
    tds->addAttribute(px);
    tds->addAttribute(py);

Finally, the last attribute z (defined on [0.25,0.50]) is directly added to the TDataServer (its title will be its name and it will be set without unity) by creating it. An attribute could, indeed, be added to a TDataServer meanwhile creating it, but then no other information than those available in the constructor would be set.

    tds->addAttribute(new TAttribute("z", 0.25, 0.50));

Then, the log of the TDataServer object is printed.

    tds->printLog();

Generally speaking, all Uranie objects have the printLog method which allows to print internal data of the object.

13.2.1.3. Console

--- Uranie v4.11/0 --- Developed with ROOT (6.36.06)
                      Copyright (C) 2013-2026 CEA/DES 
                      Contact: support-uranie@cea.fr 
                      Date: Thu Feb 12, 2026

TDataServer::printLog[]
Name[tds] Title[my first TDS]
Origin[Unknown]
 _sdatafile[] 
 _sarchivefile[_dataserver_.root]
*******************************
** TDataSpecification::printLog  ******
**   Name[uheader__tds] Title[Header of my first TDS]
**   relationName[Header of my first TDS]
**   attributs[4]
**** With _listOfAttributes 
 Attribute[0/4]
*******************************
** TAttribute::printLog  ******
**    Name[tds__n__iter__]
**   Title[tds__n__iter__]
**   unity[]
**    type[0]
**   share[1]
**   Origin[kIterator]
**   Attribute[kInput]
**   _snote[]
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
** - min[] max[]
** - mean[] std[]
**   lowerBound[-1.42387e+64] upperBound[1.42387e+64]
** NOT _defaultValue[]
** NOT _stepValue[]
 ** No Attribute to substitute level[0]
*******************************
 Attribute[1/4]
*******************************
** TAttribute::printLog  ******
**    Name[x]
**   Title[#Delta P^{#sigma}]
**   unity[#frac{mm^{2}}{s}]
**    type[0]
**   share[2]
**   Origin[kAttribute]
**   Attribute[kInput]
**   _snote[]
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
** - min[] max[]
** - mean[] std[]
**   lowerBound[-2] upperBound[4]
** NOT _defaultValue[]
** NOT _stepValue[]
 ** No Attribute to substitute level[0]
*******************************
 Attribute[2/4]
*******************************
** TAttribute::printLog  ******
**    Name[y]
**   Title[y]
**   unity[]
**    type[0]
**   share[2]
**   Origin[kAttribute]
**   Attribute[kInput]
**   _snote[]
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
** - min[] max[]
** - mean[] std[]
**   lowerBound[0] upperBound[1]
** NOT _defaultValue[]
** NOT _stepValue[]
 ** No Attribute to substitute level[0]
*******************************
 Attribute[3/4]
*******************************
** TAttribute::printLog  ******
**    Name[z]
**   Title[z]
**   unity[]
**    type[0]
**   share[2]
**   Origin[kAttribute]
**   Attribute[kInput]
**   _snote[]
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
** - min[] max[]
** - mean[] std[]
**   lowerBound[0.25] upperBound[0.5]
** NOT _defaultValue[]
** NOT _stepValue[]
 ** No Attribute to substitute level[0]
*******************************
** TDataSpecification::fin de printLog *******************************
fin de TDataServer::printLog[]