Look at the main92
example in the Pythia examples’ Makefile, you’ll see how to generate a dictionary and add it to the executable.
Hi! It worked! Just to summarise what I’ve done for the record:
- Inside
~/Programs/pythia8303/examples/Makefile
, on a par withmain92
, I’ve added the following lines:
mymain%.so: mymain%Dct.cc
$(CXX) $< -o $@ -w $(CXX_SHARED) $(CXX_COMMON)\
$(ROOT_LIB) `$(ROOT_CONFIG) --cflags`
mymain%Dct.cc: main%.h %LinkDef.h
-
Added an empty file
~/Programs/pythia8303/examples/mymain91Dct.cc
. -
Added the line
#include "mymain91Dct.cc"
to~/Programs/pythia8303/examples/mymain91.cc
-
Ran
rootcling -f mymain91Dct.cc LinkDef.h
in terminal (not sure this was necessary after the above was done…(?)). -
Thereafter built & ran
mymain91
again. The three error messages are gone but only getting a warning namelyWarning in <TTree::Bronch>: Using split mode on a class: TLorentzVector with a custom Streamer
. Unsure whether this is important…(?) -
The ROOT file looks good and includes the three branches which had been missing.
@bellenot for completeness perhaps you would like to comment on the minimal changes I should have made (maybe the terminal command was eventually redundant?) BTW — the file ~/Programs/pythia8303/examples/mymain91Dct.cc
is now not empty but rather very full with setups — can you maybe explain how and what happened? To conclude thank you so much @bellenot, you have been so helpful and kind!
Sorry, but that’s wrong! mymain91Dct.cc
will be generated by rootcling
, and it should not be included in mymain91.cc
. Please take a look at how main92
is done and change it for your use case, it will be simpler:
mymain91: $$@.cc $(PREFIX_LIB)/libpythia8.a mymain91.so
ifeq ($(ROOT_USE),true)
$(CXX) $< mymain91.so -o $@ -w -I$(ROOT_INCLUDE) $(CXX_COMMON)\
`$(ROOTBIN)root-config --cflags` -Wl,-rpath,./\
-Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)root-config --glibs`
else
@echo "Error: $@ requires ROOT"
endif
mymain91.so: mymain91Dct.cc $(PREFIX_LIB)/libpythia8.a
$(CXX) $< -o $@ -w -I$(ROOT_INCLUDE) $(CXX_SHARED) $(CXX_COMMON)\
`$(ROOTBIN)root-config --cflags`
mymain91Dct.cc: mymain91LinkDef.h
export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(ROOT_LIB);\
$(ROOT_BIN)rootcint -f $@ -c -I$(PREFIX_INCLUDE) $^
Sure! (and obviously, once you put the commend in the Makefile as described above, the terminal command will not be needed anymore). Here are the minimal changes (if I don’t forget anything):
- Fix the pointer/reference issue
- Add those two lines at the end of your code:
file->Close();
delete file;
- Generate and include the dictionary (as described above)
mymain91Dct.cc
is the dictionary, needed by the I/O and generated by rootcling
You’re very welcome!
Cheers, Bertrand.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.