Differences between ROOT5 and ROOT6
1
2
3
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,00)
Double_t *x; // ROOT 6
#else
Float_t *x; // ROOT 5
#endif
4
5
TH1 * h1 = hpx
TH1F * h1f = h1;
6
Changes in the histogram classes in ROOT6, which can lead to different results for the same code.
Histograms with labels/ alphanumeric axis
The concept of an alphanumeric axis appeared in ROOT 6. The axis is considered alphanumeric when all bins have 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 case of the alphanumeric axis, the histogram statistics (average value, rms, etc.) is no longer calculated, and their values are set to zero. Alphanumeric histograms will be combined by adding the contents to bins with the same labels. If the labels are present for each bin, and a user does not want the axis to be alphanumeric, he 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 weights for each bin. You no longer need to call the TH1::Sumw2 () function for the weighted histograms. If you want to delete the sum of the weight arrays (to save memory), you need to call TH1::Sumw2(false). The TH1::Fill (x, y) function should no longer be used to set the contents of the bin to y. Instead, TH1 should use TH1::SetBinContent (TAxis::FindBin (x), y). In case someone wants to have the same behavior and avoid the sum of the squares of the weight being stored in the histogram, even if it is filled with weights different from one, then he needs to set the histogram bit H1::kIsNotW.
TH1::Copy and TH1::Clone methods
TH1::Copy now creates the histogram contents using a 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 points of serialization. In ROOT 6, the TH1 copy constructor is no longer public. Instead, you can use a derived classes copy constructor.
TH1 outdated methods in ROOT 6
TH1::Get/SetCellContent, Get / SetCellError were removed. You need to use Get/SetBinContent and Get/SetBinError, which have exactly the same functionality.
Faster internal method to get / update the contents of a bin
TH1 now uses new protected virtual functions in its member functions (for example, TH1::Add) UpdateBinContent and RetrieveBinContent to update and retrieve the bin content. These functions have a speed advantage over public methods Get / SetBinContent. If a user has implemented a class derived from the TH1 class, it may need to reimplement these new protected virtual functions.