Ok, so again the auto generated code had some issues with identifying the right types for the variables, but after fixing that it runs.
Again I can use it to read out all variables but the TRefArrays.
The issue this time isn’t that they look empty, it’s that calling the methods of the TRefArray seems to cause a seg fault.
Here is a cut down example of my selector class;
#define Delph_selector_cxx
#include "Delph_selector.h"
#include <TH2.h>
#include <TStyle.h>
void Delph_selector::Begin(TTree * tree)
{
~ blah blah ~
}
void Delph_selector::SlaveBegin(TTree * /*tree*/)
{
~ blah blah ~
}
Bool_t Delph_selector::Process(Long64_t entry)
{
printf("In the process function\n");
printf("entry number %d \n", int(entry));
fReader.SetEntry(entry);
if (true) {
Int_t bucket = * Jet_size.Get();
Float_t fork[bucket];
TRefArray gravel[bucket];
for(int i = 0; i < bucket; i++)
{
fork[i] = Jet_PT.At(i);
cout << fork[i] << " "; // works fine
Jet_Constituents.At(i); // runs
Jet_Constituents.At(i).IsEmpty(); //seg fault. I expected a bool.
}
cout << bucket << endl;
}
return kTRUE;
}
void Delph_selector::SlaveTerminate()
{
}
void Delph_selector::Terminate()
{
}
Full files here; files.zip (885.6 KB)
It can be launched with;
$ root
root [0] TChain chain("Delphes");
root [1] chain.Add("tag_1_delphes_events.root");
root [2] chain.Process("Delph_selector.C")
Am I handling the Jet_Constituents
wrong?
Edit;
So the TTree created by $ROOTSYS/tutorial/jets.C
also has a TRefArray
in it, and it’s reasonable to assume this tree is well formed.
I have the same problems (seg fault) trying to read the TRefArray
in that TTree using code generated by MakeSelector
. I can read the other branches just not the TRefArray
branches (e.g. fJets_fPt
works fine but fJets_fTracks
causes seg faults).
Any pointers?