GraphSysErr
0.10-2
A class to hold results with statistical and systematic errors A class to hold results with statistical and systematic errors
|
The class GraphSysErr lives in GraphSysErr.C
. The class is heavily commented and marked up for documentation using Doxygen.
Get the current tar-ball from
unpack and copy the file GraphSysErr.C
anywhere you like.
Alternatively, one can check out the source from the subversion repository
svn co https://svn.cern.ch/reps/alicefmd/graphsyserr/trunk graphsyserr
Test scripts and data is available in the tar-ball together with this information. To run a full test, do
make test
This will run the TestGSE.C
example, and then import the generated test.input
using TestImport.C
and then re-export to check.input
and finally compare the two generated files.
First of all, we should load the class. It is best if we AcLic compile the code
First, one declares an object of the class GraphSysErr with a name and a title. Optionally, one can specify how many data points will be present.
We then declare which systematic errors we have. Systematic errors are either common or point-to-point. Furthermore, each type of systematic error can be specified as either relative (to the point value) or absolute.
The unsigned integer returned by these member functions are abstracted unique (to each object) identifiers. This identifier is used wherever one need to manipulate the systematic errors.
We can now specify the data points, statistical, and the point-to-point systematic errors. For this example we sample a Gaussian distribution and we take the bin center and frequency as the point, and the square root of the number of counts as the statistical error
We can now plot, store, or export this data set. However, we should customize the plot a little before that.
First, the overall options for the data and statistical errors it self.
Then, in case we plot the combined errors, set the appearance
Set the style of the common systematic errors:
Set the style on the point-to-point systematic errors
Note that by default, and if one does not specify errors along X, the horizontal size of the GraphSysErr::kBox
errors are the same as the vertical size. To limit the size, set the TStyle::SetErrorX
option:
The data can be plotted in a variety of ways. We can combine all systematic point-to-point systematic errors, either as the square root of the sum of the squares, or as direct sums.
The statistical errors and the common systematic errors will be displaced separately. The option MAX indicates that the common systematic errors will be displaced near the maximum of the data. The option AXIS means we will draw the XY axis frame. With out it, the data will be drawn in the current axis frame,
To combine all systematic errors - including common systematic errors - we add COMMON to the options
If we also want to combine the statistical errors, we add the option STAT
We can also stack up the systematic errors. To stack up point-to-point systematic errors but display the common systematic and statistical errors separately we do
Here, MIN means display the common systematic errors near the minimum of the data. Again, with options COMMON and STAT we can also stack up the other kinds of errors
We can store the object as any other ROOT object by simply writing it to a ROOT file
A useful feature of this class is that we can export the data to a Durham database input formatted file (see also BNF.md). This file can, after a little bit of editing, be uploaded directly to the Durham database. To export a single data set to standard output we do
If the first argument is false
we only output the data set. If it is true
we also output header information. To write to a specific file, first open a stream to that file, and pass that object as the second argument.
Suppose one has a collection allData
with some data sets to exported, we can simply iterate over that list and write to an output file.
Suppose we have a list allCuts
of related plots we want to export to a single table, we can do
And similarly suppose we have a list allPlots
of all plots in a paper, and where some of them are tables, then we could do
If one has an input formatted file of a Durham database dataset (a single plot), one can import it into a GraphSysErr.
The second argument is the column number of the table in the file data.input. The systematic errors are called sysX
where X
is the number (starting at 1). To get the corresponding identifier one can do
This ID can then be used to manipulate the systematic error.
To import multiple datasets, one do as done in the example TestSample.
Note, all tables are flattened.
Copyright (c) 2014 Christian Holm Christensen cholm @nbi .dk
The code is licensed under the LGPL-3