# A graph type object with configurable stat/sys errors

**URL:** <https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244>\
**Category:** Evolution Proposals, Apps & Ideas\
**Created:** [September 25, 2014, 8:01am UTC](https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244 "2014-09-25T08:01:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cholm](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@cholm](https://root-forum.cern.ch/u/cholm)\
**Post date:** [September 25, 2014, 8:01am UTC](https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244/1 "2014-09-25T08:01:28Z")

</div>

### 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 🙂 )

- **Platform:** All
- **ROOT Version:** Any
- **Author:** Christian Holm Christensen [cholm@nbi.dk](mailto:cholm@nbi.dk)

#### Update:

The code has moved to [cern.ch/cholm/root/gse/](http://cern.ch/cholm/root/gse/)

 ![](https://root-forum.cern.ch/uploads/default/original/2X/5/58851863d1c9249550b5f35721730c582ac1b433.png)  
  
 ![](https://root-forum.cern.ch/uploads/default/original/2X/b/b0be0484ce3d939f3dbf23619b73b05c680a9509.png)  
  
 ![](https://root-forum.cern.ch/uploads/default/original/2X/0/08661adc401772993ad07b1943f92cd6ce79d7d3.png)  
  
 ![](https://root-forum.cern.ch/uploads/default/original/2X/9/9ecb328d947de03846cfa4e4a13a995fe1e7bf60.png)

---

<div class="post-metadata">

**Author:** ![wickes](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/6de8d8/32.png) [@wickes](https://root-forum.cern.ch/u/wickes)\
**Post date:** [March 15, 2017, 8:36pm UTC](https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244/2 "2017-03-15T20:36:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cholm](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@cholm](https://root-forum.cern.ch/u/cholm)\
**Post date:** [March 16, 2017, 10:40am UTC](https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244/3 "2017-03-16T10:40:06Z")

</div>

Hi,

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

[https://gitlab.com/cholmcc/GraphSysErr](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/](http://cholmcc.gitlab.io/GraphSysErr/)

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

Yours,

Christian

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [December 13, 2017, 8:01pm UTC](https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244/4 "2017-12-13T20:01:46Z")

</div>

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:

```auto
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:

```auto
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.

```

---

<div class="post-metadata">

**Author:** ![quantiser](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/73ab20/32.png) [@quantiser](https://root-forum.cern.ch/u/quantiser)\
**Post date:** [May 19, 2022, 7:00pm UTC](https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244/5 "2022-05-19T19:00:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 20, 2022, 6:42am UTC](https://root-forum.cern.ch/t/a-graph-type-object-with-configurable-stat-sys-errors/18244/6 "2022-05-20T06:42:53Z")

</div>

You can check [the manual](https://root.cern/manual/) in particular the fitting and roofit sections. If that does not help @moneta can help you.
