Branches of vectors of vectors

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 with main92, I’ve added the following lines:
        $(CXX) $< -o $@ -w $(CXX_SHARED) $(CXX_COMMON)\
         $(ROOT_LIB) `$(ROOT_CONFIG) --cflags` main%.h %LinkDef.h
  • Added an empty file ~/Programs/pythia8303/examples/

  • Added the line #include "" to ~/Programs/pythia8303/examples/

  • Ran rootcling -f 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 namely Warning 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/ 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! will be generated by rootcling, and it should not be included in Please take a look at how main92 is done and change it for your use case, it will be simpler:

mymain91: $$ $(PREFIX_LIB)/libpythia8.a
ifeq ($(ROOT_USE),true)
	$(CXX) $< -o $@ -w -I$(ROOT_INCLUDE) $(CXX_COMMON)\
	 `$(ROOTBIN)root-config --cflags` -Wl,-rpath,./\
	 -Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)root-config --glibs`
	@echo "Error: $@ requires ROOT"
endif $(PREFIX_LIB)/libpythia8.a
	$(CXX) $< -o $@ -w -I$(ROOT_INCLUDE) $(CXX_SHARED) $(CXX_COMMON)\
	 `$(ROOTBIN)root-config --cflags` mymain91LinkDef.h
	 $(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):

  1. Fix the pointer/reference issue
  2. Add those two lines at the end of your code:
 	delete file;
  1. Generate and include the dictionary (as described above) 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.