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

[DF] In Histo2D, support different types of Data and Weights columns

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Other
    • Labels:
      None
    • Environment:

      Using the latest nigthly (2019-06-12) via `source /cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc62-opt/setup.sh` under CentOS 7

    • Bug / Feature:
      Feature request
    • Development:

      Description

      When using the `Histo2D` method of an `RDataFrame`, it'd be nice if the column used to fill the weights does not have to have the same type as the one used to fill the histogram, so one can e.g. fill all jets from an event into the histogram and have just one number as a weight for the whole event, as in the example below.

      ```
      #include <ROOT/RDataFrame.hxx>
      #include <iostream>

      int main() {
      auto df = ROOT::RDataFrame(10).Define("JetPt", "std::vector<float>

      {1.,2.,3.}

      ")
      .Define("Ntries", "10")
      .Define("Weight", "12");

      ROOT::RDF::TH2DModel histmodel("moep", "moep", 25, 0, 1000, 22, -2, 20);
      auto temp = df.Histo2D(histmodel, "JetPt", "Ntries", "Weight");

      std::cout << temp->GetXaxis()->GetNbins() << std::endl;

      return 0;
      }
      ```

      Edit: I guess I misclicked somewhere during opening the feature request, this is independent of ROOT-10169. Fixed!

        Attachments

          Activity

            People

            • Assignee:
              axel Axel Naumann
              Reporter:
              jneundor Jonas Neundorf
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                PlannedEnd:
                PlannedStart: