TBranchElement::InitializeOffsets error while creating a PseudoJet filled branch

Good morning.
I have a problem creating a TBranch containing a std::vector<fastjet::PseudoJet>.

When I try to fill a TBranch with such objects, this error is shown:

Fatal in TBranchElement::InitializeOffsets: Could not find the real data member ‘Jet._structure._ptr’ when constructing the branch ‘Jet’ [Likely an internal error, please report to the developers].
#0 0x00007fbb1cb77c2a in __GI___wait4 (pid=2763, stat_loc=stat_loc
entry=0x7ffdfe2ac3a8, options=options
entry=0, usage=usage
entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:27
#1 0x00007fbb1cb77beb in __GI___waitpid (pid=, stat_loc=stat_loc
entry=0x7ffdfe2ac3a8, options=options
entry=0) at waitpid.c:38
#2 0x00007fbb1cae70e7 in do_system (line=) at …/sysdeps/posix/system.c:172
#3 0x00007fbb1d94346e in TUnixSystem::StackTrace() () from /home/pasquale/root/lib/root/libCore.so
#4 0x00007fbb1d8116a8 in DefaultErrorHandler(int, bool, char const*, char const*) () from /home/pasquale/root/lib/root/libCore.so
#5 0x00007fbb1d810f8a in ErrorHandler () from /home/pasquale/root/lib/root/libCore.so
#6 0x00007fbb1d82449d in TObject::Fatal(char const*, char const*, …) const () from /home/pasquale/root/lib/root/libCore.so
#7 0x00007fbb1d178bc2 in TBranchElement::InitializeOffsets() () from /home/pasquale/root/lib/root/libTree.so
#8 0x00007fbb1d17cd2f in TBranchElement::SetAddressImpl(void*, bool) () from /home/pasquale/root/lib/root/libTree.so
#9 0x00007fbb1d1e3a6e in TTree::BronchExec(char const*, char const*, void*, bool, int, int) () from /home/pasquale/root/lib/root/libTree.so
#10 0x00007fbb1d1e7102 in TTree::BranchImpRef(char const*, TClass*, EDataType, void*, int, int) () from /home/pasquale/root/lib/root/libTree.so
#11 0x000055a9ed022b5b in TreeJetCreator(char const*, double, double) ()
#12 0x000055a9ed01eab1 in main ()
Annullato (core dump creato)

Here are my steps to get this error.

First I write this header file:


#include <vector>
#include <PseudoJet.hh>
#include <SharedPtr.hh>
#include <PseudoJetStructureBase.hh>
#pragma link C++ class vector;
#pragma link C++ class fastjet::PseudoJet;
#pragma link C++ class fastjet::SharedPtr;
#pragma link C++ class fastjet::PseudoJetStructureBase;
#pragma link C++ class fastjet::PseudoJet::UserInfoBase;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJetStructureBase>;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJet::UserInfoBase>;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJet::UserInfoBase>::__SharedCountingPtr;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJetStructureBase>::__SharedCountingPtr;
#pragma link C++ class vector<fastjet::PseudoJet>;

which I compile to a JetDictionary.cpp file using this line:

rootcling JetDictionary.cpp jetdict.h -I/home/pasquale/fastjet/include/fastjet -I/home/pasquale/fastjet/include

Then I write my TreeJetCreator.cpp function where I fill the TBranch:

int TreeJetCreator(//variables)
    TTree Jet_tree("Jet_tree","Jet_tree");
    TBranch *jetbranch = Jet_tree.Branch("Jet", &jets);
    Int_t i = 0, j = 0, flag = 0;
    for (i=0; i<nentries; i+=1) 
        //Data manipulation

        ClusterSequence cluster_seq(particelle, jet_def);
        jets = sorted_by_pt(cluster_seq.inclusive_jets(pT_min));


    return 0;

Thank you!

ROOT Version: 6.22/00
System: Ubuntu 20.04.1 LTS
Compiler: h5c++

Can you try with:

#include <vector>
#include <PseudoJet.hh>
#include <SharedPtr.hh>
#include <PseudoJetStructureBase.hh>

#pragma link C++ class fastjet::PseudoJet+;
#pragma link C++ class fastjet::SharedPtr+;
#pragma link C++ class fastjet::PseudoJetStructureBase+;
#pragma link C++ class fastjet::PseudoJet::UserInfoBase+;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJetStructureBase>+;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJet::UserInfoBase>+;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJet::UserInfoBase>::__SharedCountingPtr+;
#pragma link C++ class fastjet::SharedPtr<fastjet::PseudoJetStructureBase>::__SharedCountingPtr+;
#pragma link C++ class vector<fastjet::PseudoJet>+;

If this does not work with:

    TBranch *jetbranch = Jet_tree.Branch("Jet.", &jets); /// Trailing dot added to the name

If it still does not work, can you provide a complete running (and failing) example?

I followed your instructions, but nothing changed. I uploaded the full project in Github at:
‘’’ https://github.com/PasqualeAndreola/Trial ‘’’.

You have to adapt the Makefile and, if you want to avoid getting the HDF5 library, you have to answer “N” to the first question of the runnable Analysis file written by the Makefile.

This move let you skip the function that read the .h5 file and create the associated tree (which I uploaded in the repository for you).

Thank you for the help!

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