# Using Fasjet Header Files in Root

**URL:** <https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254>\
**Category:** ROOT\
**Created:** [February 21, 2014, 1:09pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254 "2014-02-21T13:09:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swastis](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@Swastis](https://root-forum.cern.ch/u/Swastis)\
**Post date:** [February 21, 2014, 1:09pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/1 "2014-02-21T13:09:19Z")

</div>

Dear All,

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

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

along with

```auto
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:

```auto
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](https://root-forum.cern.ch/uploads/default/original/2X/d/db8240e9c52a83df8c747ea510c6522b985ceaec.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. ❗

Kindly please help me how can I make fastjet work with my root. I will be highly grateful for your very kind help. ![[-o<](https://root-forum.cern.ch/uploads/default/original/1X/1566ef0d78260b997b270229fbe0e2bf7bbab46f.gif "Pray")

Regards,  
Swasti.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 21, 2014, 4:51pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/2 "2014-02-21T16:51:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Swastis](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@Swastis](https://root-forum.cern.ch/u/Swastis)\
**Post date:** [February 23, 2014, 9:40pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/3 "2014-02-23T21:40:17Z")

</div>

Hi Philippe,

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

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

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

[Error.txt](https://root-forum.cern.ch/uploads/default/original/2X/8/81c41b92ff5b36f31c015cb15b5db0e7f654d69d.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](https://root-forum.cern.ch/uploads/default/original/2X/7/7ec0b76d95b8a7d6f4b482976d69d88c1045212f.C) (2.19 KB)

Thanks and regards,  
Swasti.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 26, 2014, 9:04pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/4 "2014-02-26T21:04:24Z")

</div>

[quote]Regarding your suggestion in my another post ([[How to call external libraries](https://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 [/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.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 26, 2014, 9:09pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/5 "2014-02-26T21:09:19Z")

</div>

[quote]Now, somehow it tries to create the dictionary but with lots of errors which looks scary 😮 (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.

---

<div class="post-metadata">

**Author:** ![nbarakat](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/c57346/32.png) [@nbarakat](https://root-forum.cern.ch/u/nbarakat)\
**Post date:** [July 8, 2015, 2:12pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/6 "2015-07-08T14:12:04Z")

</div>

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](https://root-forum.cern.ch/uploads/default/original/2X/0/0acebf1142af1e22741134505fe758e88b403c6a.txt) (62.8 KB) [newdatavsjetphox.C](https://root-forum.cern.ch/uploads/default/original/2X/c/c09d6b64966c04a829a5921a7a49ce9659180ac8.C) (9.61 KB)

---

<div class="post-metadata">

**Author:** ![nbarakat](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/c57346/32.png) [@nbarakat](https://root-forum.cern.ch/u/nbarakat)\
**Post date:** [July 9, 2015, 5:23am UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/7 "2015-07-09T05:23:25Z")

</div>

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](https://root-forum.cern.ch/uploads/default/original/2X/b/b0ac48491463ff1de0dcaba6ad38be8a9b8e94ed.tar) (40 KB)

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [July 28, 2015, 6:48pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/8 "2015-07-28T18:48:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nbarakat](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/c57346/32.png) [@nbarakat](https://root-forum.cern.ch/u/nbarakat)\
**Post date:** [July 30, 2015, 3:44pm UTC](https://root-forum.cern.ch/t/using-fasjet-header-files-in-root/17254/9 "2015-07-30T15:44:33Z")

</div>

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

Nada
