Using examples given in documentations as a newbie

I’ve been trying to learn root through the slides and content given in the documentation and now I think that downloading the latest version of root might not have been a very good idea.

Please suggest a version best to learn, which matches the documentation codes and has minimum command edits or so.___
Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Why ? the latest should be the best to use when you start.

That’s what I thought too when I started but apparently there have been some changes which have not followed properly in the documentation. So even copying the code given in the examples does not give the desired result.

like what ? can you give examples ?

= It majorly happens as many a times when I even copy a code, the system gives me an error. One such incident happened over the use of TGraphErrors when you define things as TGraphErrors f()… or auto *f = new TGraphErrors() … you know , the escape the scope part. Though I do not wish to go in very detail but apparently the pointer creating part does not work anymore.

If you want we are able to help you, you have to be more precise. As already said by @couet, the latest version of ROOT (6.18.04) is the best one. Once you have installed it, if some problems occur, describe precisely what you have done, and what is the error you get.

Note that auto is a great feature part of modern C++. It is available in ROOT ˆ. If you use it in ROOT 5 it will not work. Tell us which examples you copy/pasted do not work and we will fix them if needed.

Int_t bins[2] = {10, 20};
Double_t xmin[2] = {0., -5.};
Double_t xmax[2] = {10., 5.};
THnSparse hs("hs", "hs", 2, bins, xmin, xmax);

I found this part of the code on the class reference page. However, on entering hs.Draw(), it produces a blank canvas. I have also tried substituting it with THnSparseD

Which version of ROOT do you use?

Note that the doc is fixed now.

Note that your histogram is completely empty (no bins were filled).

THnSparseD *hs = new THnSparseD("hs", "hs", (sizeof(bins) / sizeof(bins[0])), bins, xmin, xmax);

As I said it is the latest version, it was released this September, 11

You took the code from here. It is explained just after the code you copied how to fill the histogram.
See here for a working example using THnSparse

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.