Trying to use fastjet library in PyROOT

Hi,
I’m trying to import an external C++ library, fastjet, into Root and use it through PyRoot. So far, I’ve sucessfully managed to import the library by running the commands:

import ROOT
ROOT.gSystem.AddIncludePath("-I/home/asopio/fastjet-install/include")
ROOT.gSystem.Load("/home/asopio/fastjet-install/lib/libfastjet")

This will let me run compiled macros, like the default fastjet example. If I run eg.

ROOT.gInterpreter.ProcessLine(".L short-example.cc++")

it compiles the C++ code and after it has run it will even let me access the fastjet classes through the PyRoot interface like:

pj = ROOT.fastjet.PseudoJet()

So far, so good! However, I’ve found no way to import the fastjet classes wthout running a piece of compiled code first. Running eg.

ROOT.gInterpreter.ProcessLine("#include <fastjet/PseudoJet.hh>")

gives the error

input_line_38:1:10: fatal error: 'fastjet/PseudoJet.hh' file not found

Is there a simple one-line command that I can run to include the fastjet library without needing to compile a .cc file first? I’m sure there must be a way to do this, given that I’ve seen examples on the web where the “#include” statements are simply passed to an interactive ROOT session.

Cheers,
Alex


ROOT Version:_ 6.26
Platform: Ubuntu 22.04
Compiler: Not Provided


Try:
ROOT.gInterpreter.AddIncludePath("/home/asopio/fastjet-install/include") # note: no "-I"

Hi Wile_E_Coyote,
Thanks for the quick reply! Unfortunately, removing the “-I” does not seem to work. In fact, without the “-I” I cannot get it to compile the example code either:

In file included from input_line_39:1:
/home/asopio/short-example.cc:1:10: fatal error: 'fastjet/ClusterSequence.hh' file not found
#include "fastjet/ClusterSequence.hh"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
0

Cheers,
Alex

It seems you haven’t really used my advice.

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