Hello, I’m new to both Root and Pythia and I have some trouble with linking them. I tried multiple things and still can’t figure to fix this. So first, I got a doc from my advisor explaining how to link them, but it’s talking about root-6.18.04 and pythia 8.240, when I tried to follow that I got multiple errors with installing root and pythia. So I went for latest versions, I tried two ways.
The first way is that I built root from source while configure it to have pythia on, then built and installed pythia then went back to install root.
There are two examples in pythia that I should run, main91 and main92 and then another test file to make sure they are linked fine. Using this way main91 worked fine but main92 returned this error:
“Warning in TBufferFile::WriteObjectAny: since _Sp_counted_ptr_inplace<Pythia8::ParticleDataEntry,allocatorPythia8::ParticleDataEntry,__gnu_cxx::_S_atomic> has no public constructor which can be called without argument, objects of this class
can not be read with the current library. You will need to add a default constructor before attempting to read it.”
Then the test file returned the error:
fatal error: TH1F.h: No such file or directory
The other way that I tried is to build and install Root first then build and install Pythia while configuring both to share/see each other.
This way made the main91 and main92 work fine, but the test file didn’t work and still return the same fatal error: TH1F.h: No such file or directory
I then followed this link: How to add libariers and used the commands given and now I’m getting this error:
g++: fatal error: no input files [while searching they say that this shouldn’t occur if I’m running the files from the correct folder, which I ensured to do but still got the error]
Any help or thoughts with this?
Thanks in advance
You seem to have managed to build ROOT with Pythia support. The only problem now seems to be in the g++ command line; in particular, it is missing the include search paths. Could you share it so that we can further help you?
In principle, assuming that you are compiling a single translation unit, it should resemble the following (note the backquotes, as those cause root-config’s output be inserted in-place):
$ g++ `root-config --cflags --libs` -o test test.C
[the test file is called main023] but that would return the error:
main023.cc:9:10: fatal error: ‘Pythia8/Pythia.h’ file not found #include “Pythia8/Pythia.h”
That error seems to be caused due to PYTHIA_INCLUDE_DIR is not defined. You could manually set it to the directory where Pythia headers have been installed, i.e.
$ PYTHIA_INCLUDE_DIR=/path/to/pythia/headers
On a different note, could you check that $ root-config --features shows support for pythia8?
@jalopezg
Okay, I’ll try it and see what I get. Meanwhile, the root-config --features show support for pythia8, I also used the command that has something like “haspythia8” and showed yes for me.
or which pythia8-config
don’t work and I get: pythia8-config: command not found
If I try:
./pythia8-config
I’d get:
bash: ./pythia8-config: No such file or directory
Not sure what I should do now. Sorry for taking a lot of your time
Unless you set PYTHIA_INCLUDE_DIR as part of shell initialization (e.g. in .bashrc), it has to be set manually on each session, i.e. if you are on a new shell, you must set it again. Therefore, if that works, I’d recommend adding that line to your .bashrc file.
Regarding this, it seems that the Pythia8 installation directory is not part of your PATH environment variable