Using Fasjet Header Files in Root

Dear All,

I am trying to use fastjet with Root. I am including following header files of fasjet in my macros code:

#include "fastjet/PseudoJet.hh"  
#include "fastjet/ClusterSequence.hh"
#include "fastjet/Selector.hh"

along with

gSystem->Load("~/Programs/fastjet-install/lib/libfastjet.so");
gSystem->Load("~/Programs/fastjet-install/lib/libfastjettools.so");
gSystem->AddIncludePath("~/Programs/fastjet-install/include");

but this is not making root access the above mentioned fastjet header files. (I also tried putting entire path for the header files in #include , still doesn’t work ).

I have fastjet environment variable and library defined in my shell, and it works well with other programs like Pythia8.

I also tried copying fastjet header files to the root header files folder (not the systematic way though) which makes it read the header files, but then i get an interpreter error as:

Error: Missing one of '
\/' expected at or after line 40.
Error: Unexpected end of file (G__fgetstream():2) /usr/local/include/root/fastjet/internal/base.hh:44:
*** Interpreter error recovered ***

base.hh (1.59 KB)
Here, base.hh is a read-only fastjet header file, hence can’t be edited. But this should not be the problem I think. :exclamation:

Kindly please help me how can I make fastjet work with my root. I will be highly grateful for your very kind help. [-o<

Regards,
Swasti.

Hi,

To access the content of library on the prompt you must generate the dictionary for it.

you can try to use ACLiC to generate the dictionary with:

[code]gSystem->Load("~/Programs/fastjet-install/lib/libfastjet.so");
gSystem->Load("~/Programs/fastjet-install/lib/libfastjettools.so");
gSystem->AddIncludePath("~/Programs/fastjet-install/include");

#include “fastjet/PseudoJet.hh+”
#include “fastjet/ClusterSequence.hh+”
#include “fastjet/Selector.hh+”[code]The trailing plus are not a typo and are triggering to use of ACLiC.

Cheers,
Philippe.

Hi Philippe,

Thank you very much for your reply. I did what you suggested.

#include "/usr/local/include/fastjet/PseudoJet.hh+"

Now, somehow it tries to create the dictionary but with lots of errors which looks scary :open_mouth: (Error.txt file attached).

Error.txt (62 KB)
Also, when I try to access the dictionary path, I don’t find any such file in that location where it shows it is been generated as per the error log : /tmp/swasti//usr/local/include/fastjet/PseudoJet_hh_ACLiC_dict.cxx

Regarding your suggestion in my another post ([root-forum.cern.ch/t/how-to-call-external-libraries/10845/1 , I did not exactly understand what you mean by after ‘actual declaration’? Does it mean including pragma after #include or after I define the variable (PseudoJet) inside my code? I have attached my code here, so it will be really helpful if you can guide me accordingly.

MyCode.C (2.19 KB)

Thanks and regards,
Swasti.

[quote]Regarding your suggestion in my another post ([How to call external libraries , I did not exactly understand what you mean by after ‘actual declaration’? Does it mean including pragma after #include [/quote]I somewhat mis-read your code snipped and guessed (wrong) that fastjet::PseudoJet was declare later in the same file. In that case it looks like all you were missing was the proper #include before the #pragma:[code]#include
#include <iostream.h>
#include
#include “TString.h”
#include “fastjet/PseudoJet.hh”
#include “fastjet/ClusterSequence.hh”
#include “fastjet/Selector.hh”

#ifdef CINT

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclasses;
#pragma link C++ class fastjet::PseudoJet+;
#pragma link C++ class std::vectorfastjet::PseudoJet+;

#endif
…[/code]

Cheers,
Philippe.

[quote]Now, somehow it tries to create the dictionary but with lots of errors which looks scary :open_mouth: (Error.txt file attached).[/quote]The header seems to be in one the form that ‘somewhat’ confuses CINT, it likely that the a class has one or more data members whose type is vectorfastjet::PseudoJet but the code (legal C++) is written vector because it is used in the fastjet namespace. This tends to confuse CINT. If you can update the header to use the fully qualified name, it might go better (or going back to your first alternative using the explicit #pragma).

Cheers,
Philippe.

Dear Philippe,
I am also facing the same problem as Swasti.
I followed the steps you posted above but still my code is not running properly.
Please find attached the code, the output while compiling and details about the PC(Fedora) and Root version(5.34) I am using.
I tried to use another version of root as you suggest but it didn’t work as well (P.S the error message for the Roor v6.04/00 is only this error: invalid initialization of reference of type ‘TVectorT&’ from expression of type ‘TObject’ TVectorT &v3 = *(list3->At(0)); .

Please if you can help or any suggestion I will be thankfull.
Thanks alot.
Nada
Clog.txt (62.8 KB) newdatavsjetphox.C (9.61 KB)

Dear Philippe,
I am also facing the same problem as Swasti.
I followed the steps you posted above but still my code is not running properly.
Please find attached the code, the output while compiling and details about the PC(Fedora) and Root version(5.34) I am using.
I tried to use another version of root as you suggest but it didn’t work as well (P.S the error message for the Roor v6.04/00 is only this error: invalid initialization of reference of type ‘TVectorT&’ from expression of type ‘TObject’ TVectorT &v3 = *(list3->At(0)); .

Please if you can help or any suggestion I will be thankfull.
Thanks alot.
Nada

Clog.txt.tar Clog.txt.tar (40 KB)

Hi,

Note that since TList::At returns a TObject*, the correct syntax for: TVectorT<float> &v2 = *(list2->At(0));is TVectorT<float> &v2 = *((TVectorT<float>*)(list2->At(0)));

Cheers,
Philippe.

Dear Phillipe,
Indeed I tried this solution and it worked.
Thanks very much.

Nada