I have been slowly learning C++ and ROOT for over a year now, in order to debug a program made with it.

Now I reached a point where I can really understand that this will never become easier. Therefore I'm looking for some advices in alternatives.

What I need is something that can do, plots, histogram, 2D and 3D, and that has good minimization routines, and specially, fast learning curve and easy to write and debug.

I also need it do be fast, as fore example I now need run to over 600k fits, this takes around 1h30. But I spend far more time writing it, so if I double the running time and cut in half the programming time, this will be worth the effort.

For the moment I know, Matlab/octave and C++.

Thank you!

  • $\begingroup$ Does Matlab/Octave not fit your bill? If not, why? (Knowing that would help in suggesting alternatives.) $\endgroup$ Dec 4, 2012 at 20:24
  • $\begingroup$ Looking at the ROOT website, it specializes in analysis of extremely large scale data sets. If you require that sort of heavy lifting, the alternatives become more limited. It would be useful to give some more details on the type of problems you're solving (size of variables/data, (non)linearity of the fitting etc.). $\endgroup$ Dec 4, 2012 at 20:33
  • $\begingroup$ My data files are not that big, they go from 300Mb to 1Gb. The fittings functions non-linear but simple, with only 4 parameters ([a]x+[b]-[c]/(x-[t])), just need to do it several times. The reason why I don't use MatLab if that it is too slow, a usual task that I do, takes 10min in root but 40min with matlab. I Need some kind of mid term. $\endgroup$
    – Presbitero
    Dec 4, 2012 at 21:19
  • 2
    $\begingroup$ What many people do is to create their own collection of useful ROOT snippets over time. pyROOT is really nice and helps a lot. If you use C++ ROOT, it helps to be disciplined and to stay away from CINT, and use compiled code (with correct types) instead. It's a bit verbose, but much less error prone. Another tip is to use 'flat ntuples' and just store floats, ints in trees instead of complex objects, then you don't need to worry about ROOT's dictionaries. (There used to be a library to read .root tree files without ROOT, but unfortunately I can't find it anymore.) $\endgroup$
    – jdm
    Dec 10, 2012 at 17:30
  • 1
    $\begingroup$ I can't say too much in favor of @jdm's advice to "If you use C++ ROOT, it helps to be disciplined and to stay away from CINT, and use compiled code (with correct types) instead." I generally switch to compiled code (with a makefile, even) if the task exceeds approximately 10 lines of C++: the static analysis is so much more likely to let you know when you're being stupid, rather than cutting you some slack and doing the wrong thing. $\endgroup$ Jan 9, 2013 at 21:41

3 Answers 3


Well... for tools used by the particle physics community there's PAW (part of CERNLIB, the thing root replaced and no longer supported except as legacy) and Physica (which I haven't seen in years and can't even find a website for), which are probably not what you are looking for.

But if you have been working in the cint interface to root your might consider the Python interface before changing tools completely.

Then you can go outside of the particle physics community as suggest by vanCompute and Christian. The big risk here--if you are doing nuclear or particle physics--is that your colleagues won't be able to help you with any problems you encounter and may not understand what the tool has done for you making talks a little more awkward. I've seen a fair number of questions in talks answered with "I used the Foo facility of root" to everyone's satisfaction.

Sometimes--when what you want to do is really unusual--it is worth taking the processing away from the black box: code it all by hand where you have complete control (and write a test suite as you go, because you need to be able to show that it is correct!) and only go back to the package for plotting. But as with all roll-your-own solution this is not a step to be taken lightly.

  • $\begingroup$ I'd +5 this, if I could, very well thought-out response dmckee. $\endgroup$ Dec 5, 2012 at 14:43

You might want to look at Python with NumPy/SciPy. (There are many more packages available; for example, pandas is a dedicated data analysis library). The syntax is somewhere between Matlab and C and so should not be too hard to pick up. There's a helpful NumPy for Matlab users page, too. One of the advantages is that it is fairly easy to "outsource" parts of the code to C/C++, e.g., using Cython. This means you can prototype and then profile your algorithm, and only move the most compute-intensive routines to C, keeping all the input/output and driver routines in Python.


Have you tried R: http://www.r-project.org ? I don't know how fast it is ... and I don't know whether it has minimization routines ...

  • $\begingroup$ I don't know R, but curve_fitting == minimzation, so yeah: R has it. $\endgroup$ Dec 5, 2012 at 14:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.