A graph type object with configurable stat/sys errors

Description:

In the attached I’ve implemented a TGraph like class which can take any number of sources for errors, That is one can assign one set of statistical errors to the points and any number of systematic errors. Systematic errors can be specified as either common or point-to-point. Each type of systematic error can further be specified to be either relative or absolute.

The class then has logic to draw the data in a variety of ways

  • Stack up all errors, only statistical and point-to-point, or only point-to-point.
  • Sum (possibly in quadrature) all errors, only statistical and point-to-point, or only point-to-point.

There are more display options for e.g., how to show the common systematic errors if they are not included in the point errors.

Each component can be customized in terms of style and color.

A function can be fitted to the data. Exactly which errors are considered depends on the exact options given.

Finally, the data can be dumped to standard out in a format that probably can be uploaded to the Durham database with a minimal of editing.

Internally the classes uses solely Double_t, TGraphAsymmErrors, and TMultiGraph to store the and display the data. Access to the systematic errors is abstracted through an UInt_t Identifier to not expose too much of the inner workings of the class (though all hidden members are protected so people can reuse the code if needed).

I also attach a test script to illustrate how the class is used.

I hope this will be useful, and make it easier for people to make nice plots without too much effort.

Feel free to integrate this in ROOT or anywhere else (respecting the license of course :slight_smile: )

  • Platform: All
  • ROOT Version: Any
  • Author: Christian Holm Christensen cholm@nbi.dk

Update:

The code has moved to cern.ch/cholm/root/gse/








1 Like

Nice work! FYI the svn repo is not publicly accessible, it requests some credentials. The tarball on your documentation page works fine though.

Hi,

Glad you like it. I moved the project to GitLab:

https://gitlab.com/cholmcc/GraphSysErr

The old page redirects there.

GitLab let’s me automatically update the DoxyGen generated documentation and post the result as “pages” - see

http://cholmcc.gitlab.io/GraphSysErr/

Images are missing though, as they are generated on the fly. Will probably fix somehow.

Yours,

Christian

Hi, thanks for this nice class. I think ROOT developers should adopt it.

However, I get some errors when running the test with the last ROOT version:

make test
root -l -b -q tests/Load.C 

Processing tests/Load.C...
Info in <Load>: Loading the graph class
Info in <TUnixSystem::ACLiC>: creating shared library /home/GraphSysErr/./GraphSysErr_C.so
root -l -b -q tests/Load.C\(1,0\) tests/ManyTables.C

Processing tests/Load.C(1,0)...
Info in <Load>: Loading the graph class
Info in <Load>: Loading the maker class
Processing tests/ManyTables.C...
root -l -b -q tests/Load.C\(1,0\) tests/TestLargeImport.C

Processing tests/Load.C(1,0)...
Info in <Load>: Loading the graph class
Info in <Load>: Loading the maker class
Processing tests/TestLargeImport.C...
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.200000, chosing the maximum of (0.200000,-0.000000) -> 0.200000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.200000, chosing the maximum of (0.200000,-0.000000) -> 0.200000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.200000, chosing the maximum of (0.200000,-0.000000) -> 0.200000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
Warning in <ImportError>: Lower error already set to 0.100000, chosing the maximum of (0.100000,-0.000000) -> 0.100000
OBJ: TList	TList	Doubly linked list : 0
 ds_0_0: P P --> JET JET X
 ds_0_1: P P --> JET JET X
 ds_0_2: P P --> JET JET X
root -l -b -q tests/Load.C\(1,0\) tests/TestMultiImport.C

Processing tests/Load.C(1,0)...
Info in <Load>: Loading the graph class
Info in <Load>: Loading the maker class
Processing tests/TestMultiImport.C...
In file included from input_line_18:1:
/home/GraphSysErr/tests/TestMultiImport.C:47:32: warning: unsequenced modification and access to 'id' [-Wunsequenced]
        c = new TCanvas(Form("c%d", id++), 
                                      ^
Warning in <Import>: column 4 not available for this data set
Warning in <Import>: column 2 not available for this data set
Warning in <Import>: column 2 not available for this data set
Warning in <Import>: column 2 not available for this data set
Warning in <Import>: column 2 not available for this data set
Warning in <Import>: column 2 not available for this data set
Warning in <Import>: column 2 not available for this data set
Warning in <Import>: column 2 not available for this data set
root -l -b -q tests/Load.C\(1,0\) tests/WriteTests.C

Processing tests/Load.C(1,0)...
Info in <Load>: Loading the graph class
Info in <Load>: Loading the maker class
Processing tests/WriteTests.C...
--- test01.input	2017-12-13 14:58:26.127634817 -0500
+++ check01.input	2017-12-13 14:58:26.127634817 -0500
@@ -34,7 +34,7 @@
  -0.8 TO -0.6; 3e+02 +- 2e+01;
  -0.6 TO -0.4; 3e+02 +- 2e+01;
  -0.4 TO -0.2; 4e+02 +- 2e+01;
- -0.2 TO 3e-16; 4e+02 +- 2e+01;
+ -0.2 TO 2e-16; 4e+02 +- 2e+01;
  0 TO 0.2; 4e+02 +- 2e+01;
  0.2 TO 0.4; 4e+02 +- 2e+01;
  0.4 TO 0.6; 3e+02 +- 2e+01;
Warning in <Diff>: Test # 1 failed
--- test02.input	2017-12-13 14:58:26.135634895 -0500
+++ check02.input	2017-12-13 14:58:26.135634895 -0500
@@ -34,7 +34,7 @@
  -0.8 TO -0.6; 3e+02 +- 6 PCT;
  -0.6 TO -0.4; 4e+02 +- 5 PCT;
  -0.4 TO -0.2; 4e+02 +- 5 PCT;
- -0.2 TO 3e-16; 4e+02 +- 5 PCT;
+ -0.2 TO 2e-16; 4e+02 +- 5 PCT;
  0 TO 0.2; 4e+02 +- 5 PCT;
  0.2 TO 0.4; 4e+02 +- 5 PCT;
  0.4 TO 0.6; 4e+02 +- 5 PCT;
Warning in <Diff>: Test # 2 failed
--- test03.input	2017-12-13 14:58:26.143634972 -0500
+++ check03.input	2017-12-13 14:58:26.143634972 -0500
@@ -37,7 +37,7 @@
  -0.8 TO -0.6; 3e+02 +- 2e+01;
  -0.6 TO -0.4; 4e+02 +- 2e+01;
  -0.4 TO -0.2; 4e+02 +- 2e+01;
- -0.2 TO 3e-16; 4e+02 +- 2e+01;
+ -0.2 TO 2e-16; 4e+02 +- 2e+01;
  0 TO 0.2; 4e+02 +- 2e+01;
  0.2 TO 0.4; 4e+02 +- 2e+01;
  0.4 TO 0.6; 3e+02 +- 2e+01;
Warning in <Diff>: Test # 3 failed
--- test04.input	2017-12-13 14:58:26.151635050 -0500
+++ check04.input	2017-12-13 14:58:26.151635050 -0500
@@ -35,7 +35,7 @@
  -0.8 TO -0.6; 3e+02 +- 2e+01;
  -0.6 TO -0.4; 4e+02 +- 2e+01;
  -0.4 TO -0.2; 3e+02 +- 2e+01;
- -0.2 TO 3e-16; 4e+02 +- 2e+01;
+ -0.2 TO 2e-16; 4e+02 +- 2e+01;
  0 TO 0.2; 4e+02 +- 2e+01;
  0.2 TO 0.4; 4e+02 +- 2e+01;
  0.4 TO 0.6; 4e+02 +- 2e+01;
Warning in <Diff>: Test # 4 failed
--- test05.input	2017-12-13 14:58:26.159635127 -0500
+++ check05.input	2017-12-13 14:58:26.159635127 -0500
@@ -35,7 +35,7 @@
  -0.8 TO -0.6; 3e+02 +- 2e+01;
  -0.6 TO -0.4; 3e+02 +- 2e+01;
  -0.4 TO -0.2; 4e+02 +- 2e+01;
- -0.2 TO 3e-16; 4e+02 +- 2e+01;
+ -0.2 TO 2e-16; 4e+02 +- 2e+01;
  0 TO 0.2; 4e+02 +- 2e+01;
  0.2 TO 0.4; 4e+02 +- 2e+01;
  0.4 TO 0.6; 4e+02 +- 2e+01;
Warning in <Diff>: Test # 5 failed

and:

GraphSysErr$ doxygen
error: Tag file `ROOT.tag' does not exist or is not a file. Skipping it...
/home/GraphSysErr/GraphSysErr.C:746: warning: image file DrawStyles.png is not found in IMAGE_PATH: assuming external image.
/home/GraphSysErr/GraphSysErr.C:3145: warning: image file dndeta_pa.png is not found in IMAGE_PATH: assuming external image.

Dear Christian,

Sorry for posting on this old thread.

Many thanks for developing this tool. It is very useful and simple to use.

@cholm I would like to use it for my analysis. However, I am unable to identify in the code how the correlations between the systematics are treating for fitting. If you could point me in the right direction or provide an explanation, that would be very helpful.

Regards,
Mohammad

You can check the manual in particular the fitting and roofit sections. If that does not help @moneta can help you.