Folks, I am mystified by some segfaults that I get in CINT. Here’s the code:
std::vector<TH1F*> hist;
for(int i=0;i<8;i++) { hist.push_back(new TH1F(Form("hist%d",i),"",50,0,4));}
Then, when I try to access hist[1], hist[2] etc I get a sefault. hist[0] is fine though.
What am I doing wrong??
UPDATE:
When I do the same things outside of a loop (i.e. individually doing
hist.push_back(new TH1F(Form("hist%d",0),"",50,0,4));
hist.push_back(new TH1F(Form("hist%d",1),"",50,0,4));
hist.push_back(new TH1F(Form("hist%d",2),"",50,0,4));
.
.
.
)
it all works fine. Is the loops screwing things up??
UPDATE 2:
Forgot to mention – I am using 5.34/01