Description
If we consider the following code:
import ROOT |
fileName = "https://root.cern/files/teaching/CMS_Open_Dataset.root" |
tdf = ROOT.ROOT.Experimental.TDataFrame("data", fileName) |
|
pt1_h = tdf.Histo1D("pt1") |
pt2_h = tdf.Histo1D("pt2") |
|
print("Histo 1: " + str(pt1_h.GetEntries())) |
print("Histo 2: " + str(pt2_h.GetEntries())) |
The result of the print is:
Histo 1: 90000.0 |
Histo 2: 90000.0 |
If we modify the code above to apply a Range:
import ROOT |
fileName = "https://root.cern/files/teaching/CMS_Open_Dataset.root" |
tdf_orig = ROOT.ROOT.Experimental.TDataFrame("data", fileName) |
tdf = tdf_orig.Range(0, 2) |
|
pt1_h = tdf.Histo1D("pt1") |
pt2_h = tdf.Histo1D("pt2") |
|
print("Histo 1: " + str(pt1_h.GetEntries())) |
print("Histo 2: " + str(pt2_h.GetEntries())) |
The result is:
Histo 1: 2.0 |
Histo 2: 1.0 |
Therefore, when using Range, the second histogram loses one entry. If we book more histograms, all of them lose one entry as well. Only the one we book the first has the right number of entries.