Adding custom class to RDataFrame how to generate dictionary with Make

Dear experts,
I’m trying to add a custom class to the dataframe and use it in Filter

MyDataFrame.Filter("MyClass.MyMethod()>10");

I figured out I would need a dictionary, after many trials and errors managed to compile it, but now I’m trying to figure out how to automate this with Make and where exactly to put the dictionary/other relevant files?
My project directory structure is simple:

maindir
   |-include/
   |-src/
   |-obj/
   |-Makefile
   |-executable

I wrote the Make rule to put all the dictionary stuff in the obj subdirectory to avoid cluttering in the maindir.
The code runs, but I get runtime messages(error? the code seems to run well)

Error in <TCling::LoadPCM>: ROOT PCM /mypath/maindir/MyClass_dict_rdict.pcm file does not exist
Info in <TCling::LoadPCM>: In-memory ROOT PCM candidate /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.22.00-d9e4b/x86_64-centos7-gcc8-opt/lib/libASImageGui_rdict.pcm
...
...

because the MyClass_dict_rdict.pcm file is located in the obj directory and not in maindir.
When I try to also link the pcm file to maindir, I get a crash

input_line_35:2:67: error: member access into incomplete type 'MyClass'`
MyClass_dict dictionary forward declarations' payload:5:88: note: forward declaration of 'MyClass'
namespace MyNamespace{class __attribute__((annotate("$clingAutoload$include/MyClass.h")))  MyClass;}

so it seems that it that case it can’t find the header file from its relative location?
What would be the best option/how would you write the rule in Makefile? I currently have:

$(OBJ_DIR)/MyClass_dict.cxx: include/MyClass.h src/LinkDef.h
	rootcling -f $@ $(CPPFLAGS) $^

$(OBJ_DIR)/MyClass_dict.o: $(OBJ_DIR)/MyClass_dict.cxx
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(EXE): $(OBJ) $(OBJ_DIR)/MyClass_dict.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ 

Thanks,
Zdenek

Hi,

You don’t need a dictionary! You can just #include your header and provide a lambda instead of a string. Let me know if you want me to spell this out.

Cheers, Axel

Oh, thanks! Yes, it seems I can do it with a lambda. That is simpler :slight_smile:
Cheers,
Zdenek

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.