I’m trying to pass information (stored as a c++ vector<vector > from one program to another in the form of a flat tree in a .root file. My current reading code looks something like this:
TFile* inFile = new TFile("path_to_file/file.root");
TTree* storageTree = (TTree*)inFile->Get("flatTree");
vector<double> hitCoords;
vector<vector<double> > track;
int nhits = storageTree->GetEntries();
for(int i =0 ; i < nhits ; i++)
{
storageTree->GetEntry(i);
for(vector<vector<double> >::iterator it = track.begin(); it != track.end(); ++it)
{
for(vector<double>::iterator hitit = it->begin(); hitit != it->end(); ++hitit)
{
if(*hitit == *(it->begin()) )
{
z = * hitit;
intZ = (int)z;
}
if(*hitit == (it->back()) )
{
xy = * hitit;
}
}
}
}
I’m not sure I put the brackets in when I copied this, but they are all in place in the code. Is there something obvious I’ve done wrong, I can provide more code if this lot isn’t sufficient.