Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DF] Fill method does not support arbitrary signatures #9428

Closed
eguiraud opened this issue Dec 13, 2021 · 0 comments · Fixed by #9495
Closed

[DF] Fill method does not support arbitrary signatures #9428

eguiraud opened this issue Dec 13, 2021 · 0 comments · Fixed by #9495

Comments

@eguiraud
Copy link
Member

According to the documentation of RDataFrame's Fill method, the following should be supported:

#include <ROOT/RDataFrame.hxx>
#include <TApplication.h>
#include <TH2D.h>

struct Jet {
  double a, b;
};

struct Boo {
  TH2D h{"", "", 10, 0, 10, 10, 0, 10};

  void Fill(const Jet &j) { h.Fill(j.a, j.b); }

  void Merge(const std::vector<Boo *> &others) {
    TList l;
    for (auto *o : others) {
      l.Add(&o->h);
      h.Merge(&l);
    }
  }

  void Draw() { h.Draw(); }
};

int main() {
  TApplication app("app", nullptr, nullptr);

  auto res = ROOT::RDataFrame(10)
               .Define("Jet", [] { return Jet{1., 2.}; })
               .Fill<Jet>(Boo{}, {"Jet"});
  res->Draw();

  app.Run();
}

Instead, FillParHelper only supports Boo::Fill signatures that take combinations of doubles and collections thereof.

#7499 goes in the right direction in generalizing FillParHelper::Exec but it still needs a fix to allow this general case.

@eguiraud eguiraud added the bug label Dec 13, 2021
@eguiraud eguiraud self-assigned this Dec 13, 2021
eguiraud added a commit to eguiraud/root that referenced this issue Jan 5, 2022
eguiraud added a commit to eguiraud/root that referenced this issue Jan 6, 2022
eguiraud added a commit that referenced this issue Jan 7, 2022
@eguiraud eguiraud added this to Issues in Fixed in 6.26/00 via automation Jan 7, 2022
rahulgrit pushed a commit to rahulgrit/root that referenced this issue Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant