2.4.3. Computing the elementary statistic

The TDataServer provides a method to determine the four simplest statistical notions: the minimum, maximum, average and standard deviation.

It can be simply called without argument (running then over all the attributes), or with a restricted list of attributes. A second possible argument is a selection criteria (which is not applied through the setSelect method so not changing the behaviour of the TDataServer in the other method).

    TDataServer *tdsGeyser =new TDataServer("geyser","poet");
    tdsGeyser->fileDataRead("geyser.dat");
    tdsGeyser->computeStatistic("x1");

    cout<<"min(x1)= "<<tdsGeyser->getAttribute("x1")->getMinimum()<<";  max(x1)= "
        <<tdsGeyser->getAttribute("x1")->getMaximum()
        <<";  mean(x1)= "<<tdsGeyser->getAttribute("x1")->getMean()<<";  std(x1)= "
        <<tdsGeyser->getAttribute("x1")->getStd()<<endl;

It returns the following line

min(x1)= 1.6;  max(x1)= 5.1;  mean(x1)= 3.48778;  std(x1)= 1.14137

Summary: computeStatistic

  • computeStatistic(const char* varexp = “*”, const char* selection = “”, Option_t* option = “”)

    Estimate Mean, Std, Maximum and Minimum for attributes requested in varexp, with an optional additional selection. If no argument is provided, a loop over all attributes is performed.

  • getMean(intiel=0), getStd(intiel=0), getMinimum(intiel=0), getMaximum(intiel=0)

    Method from TAttribute class, made to give access to the computed statistic information. The argument is the element number in the corresponding vector, the default being one. The size of the vector is larger than the original vector because of the statistic computation is also performed on all elements at once. The size of this vector is provided by these functions:

  • getMeanSize(), getStdSize(), getMinimumSize(), getMaximumSize()

    Method from TAttribute class, providing access to the size of the statistical-vectors.

  • The statistical vectors are cleared as soon as the overall selection is modified.