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

RDataFrame doesn't understand Python list of strings

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Medium
    • Resolution: Fixed
    • 6.18/04
    • 6.22/00
    • PyROOT
    • macOS + ROOT 6.18/04 installed from conda-forge

    Description

      Example with initialising with multiple filenames:

      import ROOT
      ROOT.ROOT.EnableImplicitMT()
      rdf = ROOT.RDataFrame('DecayTree', convert_list([
          'root://eospublic.cern.ch//eos/opendata/lhcb/AntimatterMatters2017/data/B2HHH_MagnetUp.root',
          'root://eospublic.cern.ch//eos/opendata/lhcb/AntimatterMatters2017/data/B2HHH_MagnetDown.root'
      ]))
      print(rdf.Count().GetValue())
      

      Example when saving only some column names:

      import ROOT
      ROOT.ROOT.EnableImplicitMT()
      rdf = ROOT.RDataFrame('DecayTree', 'root://eospublic.cern.ch//eos/opendata/lhcb/AntimatterMatters2017/data/B2HHH_MagnetUp.root')
      print(rdf.Cache(['H1_PX', 'H1_PY', 'H1_PZ']).AsNumpy())
      

      I know it can be worked around by passing the arguments through this function:

      def convert_list(strings):
          result = ROOT.std.vector(ROOT.std.string)()
          for s in strings:
              result.push_back(s)
          return result
      

      Attachments

        Activity

          People

            etejedor Enric Tejedor Saavedra
            cburr Chris Burr
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: