Compiling PYTHIA main91 with dictionary std::vector<Pythia8::Particle> for writing into TTree

Hello everyone,

I want to write out std::vector<Pythia8::Particle> into a ROOT TTree. For this I am using ROOT version 6.30/02 and the program main91 from PYTHIA 8.310.
From my limited understanding I know that one needs a dictionary of this object, which is what I get from the error message:

Error in <TTree::Branch>: The class requested (vector<Pythia8::Particle>) for the branch "vParticle" is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (vector<Pythia8::Particle>) to avoid to write corrupted data.

So I tried to add

#pragma link C++ class std::vector<Pythia8::Particle>+;

But that did not help.
I also tried:

rootcling -f Pythia8ParticleDict.cxx -c /data/mhemmer/pythia8_3/pythia8307/include/Pythia8/Event.h -I /data/mhemmer/pythia8_3/pythia8307/include/
g++ -c Pythia8ParticleDict.cxx -o Pythia8ParticleDict.o `root-config --cflags` -I /data/mhemmer/pythia8_3/pythia8307/include/

and then adding Pythia8ParticleDict.o to the MakeFile for the rule for making main91, but the error message is still there.

Can somebody help me point out how to properly provide this dictionary and compile the main91?

With regards,

ROOT Version: 6.30/02
Platform: Centos 8 Stream
Compiler: g++


Thanks for the interesting post and welcome to the ROOT community!
I start by citing the official documentation about I/O of custom classes: I/O of custom classes - ROOT

If you are really sure that everything was done correctly, but still have issues, you can always check at runtime if any class has a dictionary with TClass, the entry point to the typesystem of ROOT:


I hope this helps debugging further.


Hey Danilo,

Looking more closely to the documentation you linked I think the problem was that I did not specify a
Linkdef.h when creating the dictionary.


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