Dear all,
I think I am experiencing two issues at same time but I cannot factorize them for sure.
I am trying to create a custom class to be used with Fill method of RDataFrame.
I started with this very simple class (actually it just calls a TH1F)
Boo.cpp (322 Bytes) Boo.h (262 Bytes)
I am setting up root 6.14.04 with gcc62 on a SLC6 machine (from /cvmfs/sft.cern.ch/lcg/releases/LCG_94/ROOT/6.14.04/x86_64-slc6-gcc62-opt/bin/root) and creating the shared library with
g++ -c -fpic Boo.cpp `root-config --cflags --libs`
g++ -shared -o libBoo.so Boo.o `root-config --cflags --libs`
If now in python (2) I do something like
import ROOT
ROOT.gInterpreter.Declare('#include "Boo.h"')
ROOT.gSystem.Load("libBoo.so")
boo=ROOT.Boo()
boo.Fill(0,15)
myh=boo.GetHisto()
everything works fine. Even in an interactive root session apparently everything works
$ root -l
root [0] gInterpreter->Declare("#include \"Boo.h\"")
(bool) true
root [1] gSystem->Load("libBoo.so")
(int) 0
root [2] auto b=new Boo()
(Boo *) @0x7ffdb1bd2618
root [3] b->Fill(0,15)
root [4] b->GetHisto()->GetEntries()
(double) 1.0000000
But now if I try something like
#create RDataFrame df here
b=df.Filter("mjj>1500").Fill(ROOT.Boo(),("mjj”,”weight”))
I got AttributeError: 'RDataFrame' object has no attribute 'Fill'
and even worst in a root interactive session
In file included from /mnt/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62binutils/LABEL/slc6/build/projects/ROOT-6.14.04/src/ROOT-6.14.04-build/input_line_12:21:
In file included from /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-0d8dc/x86_64-slc6-gcc62-opt/etc/../etc/dictpch/allHeaders.h:688:
In file included from /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-0d8dc/x86_64-slc6-gcc62-opt/etc/../include/TTreeAsFlatMatrix.h:17:
In file included from /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-0d8dc/x86_64-slc6-gcc62-opt/etc/../include/ROOT/RDataFrame.hxx:26:
In file included from /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-0d8dc/x86_64-slc6-gcc62-opt/etc/../include/ROOT/RDFInterface.hxx:32:
/cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-0d8dc/x86_64-slc6-gcc62-opt/etc/../include/ROOT/RDFInterfaceUtils.hxx:94:4: error: static_assert failed "not implemented for this type"
static_assert(std::is_base_of<TH1, T>::value, "not implemented for this type");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-0d8dc/x86_64-slc6-gcc62-opt/etc/../include/ROOT/RDFInterfaceUtils.hxx:101:40: note: in instantiation of template class 'ROOT::Internal::RDF::IsV7Hist<Boo>' requested here
template <typename T, bool ISV7HISTO = IsV7Hist<T>::value>
^
/cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-0d8dc/x86_64-slc6-gcc62-opt/etc/../include/ROOT/RDFInterface.hxx:1167:25: note: in instantiation of default argument for 'HistoUtils<Boo>' required here
if (!RDFInternal::HistoUtils<T>::HasAxisLimits(*h)) {
^~~~~~~~~~~~~
ROOT_prompt_2:1:10: note: in instantiation of function template specialization 'ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager, void>::Fill<Boo>' requested here
auto a=d.Fill(Boo("b","b",100,1000,10000),{"mjj","weight"})
^
I tried also with root 6.18.04 with gcc8 on a CENTOS7 machine (from /cvmfs/sft.cern.ch/lcg/releases/LCG_96b/ROOT/6.18.04/x86_64-centos7-gcc8-opt/bin/root): slightly different error but same message.
Just to clarify what I tried: RDataFrame Fill method with a simple TH1F works fine in interactive root session but not in python (same error above).
What am I missing?
Thanks for your support,
Simone