Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-9232

[TDF] Entry loss when using Range and multiple actions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 6.12/06
    • Fix Version/s: 6.12/06, 6.14/00
    • Component/s: Other
    • Labels:
      None
    • Environment:

      any

      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.

        Attachments

          Activity

            People

            • Assignee:
              eguiraud Enrico Guiraud
              Reporter:
              etejedor Enric Tejedor Saavedra
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual Start:
                Actual End: