Vector< vector<TH1F*> >

Hello,

The following code runs ok when compiled .L htest.C+ but w/o compilation it crashes:
.x htest.C - just exits CINT w/o any message
.L htest.C and htest() exits CINT with:
*** glibc detected *** free(): invalid pointer: 0x0981adc8 ***
(cmslpc05) [227] which root
/uscmst1/prod/sw/cms/slc4_ia32_gcc345/lcg/root/5.18.00a-cms11/bin/root

Thank you,
Yuri

#include <TCanvas.h>
#include “TH1F.h”
#include “TMath.h”
#include

void htest()
{

TH1F * hist1 = new TH1F(“hist1”,“hist1”,100,0,100);
TH1F * hist2 = new TH1F(“hist2”,“hist2”,100,0,100);

vector< vector<TH1F*> > sample;
vector<TH1F*> sa;
sa.push_back(hist1);
sa.push_back(hist2);
sample.push_back(sa);
sa[0]->Fill(1);
sa[1]->Fill(2);
sample[0][0]->DrawCopy();
sample[0][1]->DrawCopy(“same”);

delete hist1;
delete hist2;
return;
}

Hi,

Indeed vector of object and vector of pointer to object (and consequently combination thereof :slight_smile:) are know to be broken in interpreted. In the next release we are planning on introducing an optional feature where a requested template will be automatically compiled upon use.

Cheers,
Philippe.