Hi,
I am meeting a weird problem with loading vector of vector after opening a root file with that type variable in TTree object. In PyROOT I loaded the class generation and struct definition for vector of vector through a C++ macro “vecs.C”:
#include <vector>
#ifdef __CINT__
#pragma link C++ class vector<vector<float> >+;
#pragma link C++ class vector<vector<vector<float> > >+;
#endif
struct myStruct
{
vector<float> *vF;
vector<vector<float> > *vvF;
vector<vector<vector<float> > > *vvvF;
vector<float> lvF;
vector<vector<float> > lvvF;
vector<vector<vector<float> > > lvvvF;
};
In pyROOT I did the following script “test-vecs.py”
from ROOT import (TFile,gROOT)
file = TFile("myVV_VVV.root")
tree = file.Get("qcd")
gROOT.ProcessLine(".L vecs.C+")
from ROOT import myStruct
m=myStruct()
# open root file after importing myStruct
# file = TFile("myVV_VVV.root")
# tree = file.Get("qcd")
fV =m.vF
fVV =m.vvF
fVVV=m.vvvF
flV =m.lvF
flVV =m.lvvF
flVVV=m.lvvvF
The above script crashed at “fVV =m.vvF”. If I moved root file opening after “m=myStruct()”, everything would work fine. Or fVV and lfVV (related to vector) would work fine if the root file does not have any TTree object containing with vector. Same for vector<vector>. The ROOT version with this crash is 5.28.00g. I also tried switch to ROOT later versions, says 5.34.00-rc1, which does not crash but leads to incomplete fVV, fVVV, lacking functions such as size and at, that is:
Any idea and solution?
Thanks.
–Shuwei