Getting PYTHIA to work with ROOT


ROOT Version: 6.22
Platform: MacOS
Compiler: Not Provided


I downloaded ROOT using brew install on my mac. I also downloaded Pythia, but it appears that my C++ code doesn’t recognize any Pythia-based include statements. I’ve found out that if I were using CMake I would need to rebuild ROOT with pythia enabled. Is there a way to do that with brew install instead?

may be @oshadura has an idea ?

You don’t need to rebuild ROOT to use Pythia - only to use TPythia8. If you just use Pythia directly then you’ll just need to teach your CMakeLists.txt where to find it.

Sounds simple enough!

How exactly do I teach CMakeLists.txt where to find it?

Can you please post your CMakeLists file? Ideally you need to use something like: find_package(Pythia8 REQUIRED) together with adding FindPythia8.cmake file https://github.com/root-project/root/blob/master/cmake/modules/FindPythia8.cmake. Next step will be to link your code with $PYTHIA8_LIBRARY and include $PYTHIA8_INCLUDE_DIR in your CMake code. I think you can find some examples just simply googling.

Here’s the CMakeLists file:

CMakeLists.txt (23.1 KB)

There’s a find_package statement that says ROOT REQUIRED. Should I write another statement below that says Pythia8 REQUIRED?