How to access a leaf nested in a branch of a tree?


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Dear All,

I’m trying to read a leaf that is nested in a branch as follows which has the type of vector<vector<float> >. But every time I run my code, it spits segmentation break. How can i get this fixed?

  TFile* mf = new TFile(inputdir+sample+".root");

  TTree* mt = (TTree*)mf->Get("bTag_AntiKt4EMTopoJets/jet_trk_d0/");

  cout<<"gets up to loading the branch line!"<<endl;

  vector<vector<float> > jet_trk_d0_s;

  mt->SetBranchAddress("values",&jet_trk_d0_s);

  mt->SetBranchStatus("*",0);

  mt->SetBranchStatus("values",1); 

Thank you!

If you don’t know how to deal with your tree, see how various flavours of automatically generated “analysis skeletons” deal with it.

1 Like

…and to make progress here (if still needed after Wile_E’s reply) please post the output of mt->Print().

1 Like

Hi Axel,

I have attached herewith the mt->Print() for your kind attention.

Thank you,

test.txt (67.6 KB)

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