Hello everyone,
I’m trying to read in a couple branches from a tree, but I get a set fault when I call a branch that’s a vector<vector> at tree->GetEntry(). Otherwise, if I comment out the two lines containing jet_FracEnergyPerSampling things run fine.
#include <stdlib.h>
#include <typeinfo>
#include <vector>
#include <algorithm>
#include <iterator>
TFile *f = TFile::Open("Nominal.root");
TTree *q = (TTree*)f->Get("outTree");
int njet = 0;
vector< vector<float> > *jet_EnergyPerSampling = 0;
vector<float> *jet_pt =0;
vector<int> *jet_FracSamplingMaxIndex =0;
q->SetBranchAddress("njet", &njet);
q->SetBranchAddress("jet_pt", &jet_pt);
q->SetBranchAddress("jet_FracSamplingMaxIndex", &jet_FracSamplingMaxIndex);
q->SetBranchAddress("jet_EnergyPerSampling", &jet_EnergyPerSampling);
cout << "SAMP " << jet_EnergyPerSampling[0][0] << endl;
cout << "ENTRIES" << q->GetEntries() << endl;
int entries = q->GetEntries();
for (int ent = 0; ent < entries; ent++) {
q->GetEntry(ent);
I’ve attached the error output below. Am I missing something?
Thanks in advance!
Meghan
errors.pdf (27.7 KB)