Unfolding
For my analysis, I've been using the GURU unfolding package, based on the singular value decomposition of the migration matrix.
More information (and the original code) can be found on the homepage of one of the authors, Vato Kartvelishvili.
The original package is written in fortran, I wrote a C++ interface to the fortran code.
This package is now in D∅ cvs, module name GURU. It's also available as a tarball.
There are five parts:
- gurlib98.f, the fortran library of GURU functions. This is part of the original GURU package, which can be downloaded from here.
- guru_test.cpp, direct c++ implementation of the gurtst98.f file in the fortran code. Sets up and unfolds an example. Does not need any inputs.
- guru_interface.cpp, c++ interface to gurlib98.f which can take root histograms as an input.
- RunGuru.cpp, An example of opening a root file, reading the plots and calling the unfolding.
- makefile, used to compile any or all of the above.
Notes:
- You need libmathlib.so installed (part of CERNLIB). Configure the makefile to point to your version (default is mathlib='/usr/lib/libmathlib.so.2').
At the moment, it does not compile with libmathlib.a, but I haven't tried too hard to fix that.
- You also need a standard root setup, with ROOTSYS and LD_LIBRARY_PATH set appropriately.
- The makefile can compile three things (default is all three) :
- The fortran code into an executable gurtst98.ex. Turn off by removing GURUF from "all : GURUC GURUCTEST GURUF"
- The c++ implementation of the fortran example (guru_test.cpp) into an executable guru_test. Turn off by removing GURUTEST.
- The main c++ code into an executable RunGuru.
- I've used it on (k)ubuntu 6 & 7, gcc version 3.xx and 4.xx, g77 version 3.4.6, root 5.xx. No guarantee it will compile out of the box with other setups! Email me if you have a problem.
- For comparison, there is also a direct c++ implementation of the algorithm, written by Tom Schwartz
Running the example (guru_test) should produce output like this (identical to the fortran version, give or take some formatting!) :
Setting up Blobel example
Making response matrix, initial x vector
Building test distribution
Building data distribution
Finished setting up example
Make derivative matrix C and its inverse CP
While inverting C, 40 s.v. were used, 0 s.v. were discarded.
neta = 12, dav = 0.0569233, dis = 0.945037
ns tau chi2/xtst resid dof proful probab
0 4.27086e+07 19456.5 24003.6 0.542084 0 0
1 1.78974e+06 12924.9 8952.03 1.50296 0 0
2 65701.4 6142.07 4883.93 2.65358 0 0
3 10079.6 3219.01 2402.61 3.687 0 0
4 2604.46 2208.59 1446.6 4.66092 0 0
5 812.254 1195.75 878.597 5.64272 0 0
6 291.691 590.06 498.74 6.59686 0 0
7 109.846 291.464 266.065 7.56632 1.66744e-38 1.6659e-38
8 43.0314 152.033 141.525 8.53317 6.63453e-16 6.62769e-16
9 17.0258 96.1372 78.8587 9.50959 3.70833e-06 3.70476e-06
10 6.73524 70.5766 48.9973 10.4936 0.0135469 0.0135358
11 2.65107 59.646 34.9072 11.4811 0.190439 0.190312
12 1.02995 71.6319 28.0427 12.4736 0.437082 0.436828
13 0.3944 127.342 24.5863 13.4673 0.57241 0.572121
14 0.14841 233.61 22.834 14.4606 0.617637 0.617342
15 0.054208 458.598 21.8774 15.4616 0.61759 0.617261
16 0.0194706 1016.06 21.2282 16.4528 0.599623 0.599306
17 0.00679553 2055.83 20.722 17.4393 0.572087 0.571978
18 0.00223782 3665.54 20.3465 18.4379 0.534021 0.534466
19 0.00072017 8039.95 20.0328 19.4071 0.491129 0.493511
You'll also get a root file with all the various plots, called output.root.
"14_abs_ddat" shows the d parameter, and "15_xdat_10" shows the unfolded distribution for d=10.
Gavin Hesketh, email: ghesketh at fnal dot gov
Last modified: Sat Nov 17 13:39:32 CST 2007