Differencies ROOT6 and ROOT5
- Version ROOT 6.00 / 00 was released on May 30, 2014. It presents a new Cling interpreter. C++ 11, replacing CINT, which has served ROOT for many years. (C++ 11 new standard of C++ language). Working with ROOT6 also requires a C++ 11-compatible compiler, so you need to install either gcc> = 4.8, or Clang> = 3.4.
- In ROOT6 appeared ability to use templates.
- There are methods that have a different return type in ROOT5 and ROOT6, for example
Float_t TSpectrum::GetPositionX() in ROOT5 and Double_t TSpectrum::GetPositionX() in ROOT6.
In order for the same macro to work in both ROOT5 and ROOT6 in this case, add the following to the code:
#if ROOT_VERSION_CODE> = ROOT_VERSION (6.00,00) Double_t * x; // ROOT 6 #else Float_t * x; // ROOT 5 #endif
- Cling follows the C ++ standard much more strictly than CINT. In particular, some code that used to work with CINT, or will issue new warnings, or new compilation errors. Interactively discontinued support for interchangeability "." and "->".
-
Implicit dynamic changes
CINT in ROOT5 performed an automatic upgrade to derived classes in certain contexts, for example:TH1 * h1 = hpx TH1F * h1f = h1;
Cling in ROOT6 does not allow this. - Changes in histogram classes in ROOT6, which can lead to different results for one
the same code.
Histograms with labels/ alphanumeric axis
The concept of an alphanumeric axis appeared in ROOT 6. An axis is considered alphanumeric when all bins are there are tags attached to them. In this case, you need to fill the histogram using TH1::Fill (label) instead of TH1::Fill(x), where the label is a string, and x is a real number. In the case of the alphanumeric axis, histogram statistics (mean, rms, etc.) is no longer calculated, and their values are set to zero. Alphanumeric histograms will be merged by adding content to bins with the same labels. If labels are present for each bin, and the user does not want the axis to be alphanumeric, then it can call the TAxis::SetNoAlphanumeric() function.
Filling a histogram with weights other than one
A histogram filled with weights other than 1 automatically saves the sum of the square of the weights for each Bina You no longer need to call the TH1::Sumw2 () function for weighted histograms. If you want to delete the sum of the weights arrays (to save memory), you must call TH1::Sumw2(false). Also, the TH1::Fill (x, y) function should no longer be used to set the contents of a bean to y. Instead TH1 should use TH1::SetBinContent (TAxis::FindBin (x), y). In case someone wants to have the same behavior and to ensure that the sum of the squares of the weight is stored in the histogram, even if it is filled with weights different from one, then you need to set the histogram bit H1::kIsNotW.
TH1::Copy and TH1::Clone methods
TH1::Copy now creates histogram content using the copy constructor, but does not copy the contained objects (for example, TF1). TH1::Clone copies everything, but much slower, especially in multithreaded environments due to internal serialization points. In ROOT 6, the TH1 copy constructor is no longer public. Instead, you can use derivative classes copy constructor.
Outdated TH1 methods in ROOT 6
TH1::Get/SetCellContent, Get / SetCellError removed. Need to use Get/SetBinContent and Get/SetBinError, which have exactly the same functionality.
Faster internal method to get / update the contents of a bean.
TH1 now uses new protected virtual functions in its member functions (for example, TH1::Add) UpdateBinContent and RetrieveBinContent to update and retrieve bin content. These features have the advantage in speed before public methods Get / SetBinContent. If the user has implemented a class derived from class TH1, it may need to reimplement these new protected virtual functions.