13.2.5. Macro “dataserverLoadASCIIFileYoungsModulus.C”
13.2.5.1. Objective
The objective of this macro is to load the ASCII data file "youngsmodulus.dat" and to apply
visualisations on the attribute E with different options. The data file "youngsmodulus.dat" is
in the “Salome-table” format of Uranie.
#NAME: youngsmodulus
#TITLE: Young's Modulus E for the Golden Gate Bridge
#COLUMN_NAMES: E
#COLUMN_TITLES: Young's Modulues
#COLUMN_UNITS: ksi
28900
29200
27400
28700
28400
29900
30200
29500
29600
28400
28300
29300
29300
28100
30200
30200
30300
31200
28800
27600
29600
25900
32000
33400
30600
32700
31300
30500
31300
29000
29400
28300
30500
31100
29300
27400
29300
29300
31300
27500
29400
Data are then exported in header file "youngsmodulus.h" which can be imported in some C file:
// File "youngsmodulus.h" generated by ROOT v5.34/32
// DateTime Tue Nov 3 10:40:13 2015
// DataServer : Name="youngsmodulus" Title="Young's Modulus E for the Golden Gate Bridge" Global Select=""
#define youngsmodulus_nPattern 41
// Attribute Name="E"
Double_t E[youngsmodulus_nPattern] = {
2.890000000e+04,
2.920000000e+04,
2.740000000e+04,
2.870000000e+04,
2.840000000e+04,
2.990000000e+04,
3.020000000e+04,
2.950000000e+04,
2.960000000e+04,
2.840000000e+04,
2.830000000e+04,
2.930000000e+04,
2.930000000e+04,
2.810000000e+04,
3.020000000e+04,
3.020000000e+04,
3.030000000e+04,
3.120000000e+04,
2.880000000e+04,
2.760000000e+04,
2.960000000e+04,
2.590000000e+04,
3.200000000e+04,
3.340000000e+04,
3.060000000e+04,
3.270000000e+04,
3.130000000e+04,
3.050000000e+04,
3.130000000e+04,
2.900000000e+04,
2.940000000e+04,
2.830000000e+04,
3.050000000e+04,
3.110000000e+04,
2.930000000e+04,
2.740000000e+04,
2.930000000e+04,
2.930000000e+04,
3.130000000e+04,
2.750000000e+04,
2.940000000e+04,
};
// End of attribute E
// End of File youngsmodulus.h
13.2.5.2. Macro Uranie
TDataServer * tds = new TDataServer();
TCanvas *Canvas = new TCanvas("c1", "Graph for the Macro loadASCIIFile",5,64,1270,667);
TPad *pad = new TPad("pad","pad",0, 0.03, 1, 1);
tds->fileDataRead("youngsmodulus.dat");
// gEnv->SetValue("Hist.Binning.1D.x", 10);
// tds->getTuple()->Draw("E>>Attribute E(6, 25000, 34000)","","text");
// tds->getTuple()->Draw("E>>Attribute E(16, 25000, 34000)");
tds->computeStatistic("E");
tds->getAttribute("E")->printLog();
tds->exportDataHeader("youngsmodulus.h");
pad->Draw();
pad->Divide(2,2);
pad->cd(1);
tds->draw("E");
pad->cd(2);
tds->draw("E" ,"", "nclass=sturges");
pad->cd(3);
tds->draw("E" ,"", "nclass=scott");
pad->cd(4);
tds->draw("E" ,"", "nclass=fd");
The TDataServer is filled with the ASCII data file "youngsmodulus.dat" with the method fileDataRead:
tds->fileDataRead("youngsmodulus.dat");
Variable E is then visualised with different options:
tds->draw("E" ,"", "nclass=sturges");
tds->draw("E" ,"", "nclass=scott");
tds->draw("E" ,"", "nclass=fd");
Characteristic values are computed (maximum, minimum, mean and standard deviation) with:
tds->computeStatistic("E");
Data are exported in a header file with
tds->exportDataHeader("youngsmodulus.h");
13.2.5.3. Graph
Figure 13.4 Graph of the macro
"dataserverLoadASCIIFileYoungsModulus.C"
13.2.5.4. 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
*******************************
** TAttribute::printLog ******
** Name[E]
** Title[ Young's Modulues]
** unity[ksi]
** type[0]
** share[1]
** Origin[kAttribute]
** Attribute[kInput]
** _snote[]
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
** - min[25900] max[33400]
** - mean[29575.6] std[1506.95]
** lowerBound[-1.42387e+64] upperBound[1.42387e+64]
** NOT _defaultValue[]
** NOT _stepValue[]
** No Attribute to substitute level[0]
*******************************