Hello!
I attempted to modify the tutorial draw2dopt.C to access the TGraph objects for a contour plot and am having no success. The gROOT->GetListOfSpecials() always returns an empty list. I have included the script below and am using 3.05/07. Can anyone tell me what I’m doing wrong?
Thanks,
Andrew
{
// display the various 2-d drawing options
gROOT->Reset();
gStyle->SetOptStat(0);
gStyle->SetPalette(1);
gStyle->SetCanvasColor(33);
gStyle->SetFrameFillColor(18);
TF2 *f2 = new TF2(“f2”,“xygaus + xygaus(5) + xylandau(10)”,-4,4,-4,4);
Double_t params[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5,
3600,-2,0.7,-3,0.3};
f2.SetParameters(params);
TH2F h2(“h2”,“xygaus + xygaus(5) + xylandau(10)”,20,-4,4,20,-4,4);
h2.SetFillColor(46);
h2.FillRandom(“f2”,40000);
TPaveLabel pl;
//basic 2-d options
Float_t x1=0.67, y1=0.875, x2=0.85, y2=0.95;
Int_t cancolor = 17;
//contour options
TCanvas cont(“contourx”,“contourx”,0,0,800,600);
cont.Divide(2,2);
gPad->SetGrid();
cont.SetFillColor(cancolor);
cont.cd(1);
h2.Draw(“contz”); pl.DrawPaveLabel(x1,y1,x2,y2,“CONTZ”,“brNDC”);
cont.cd(2);
gPad->SetGrid();
h2.Draw(“cont1”); pl.DrawPaveLabel(x1,y1,x2,y2,“CONT1”,“brNDC”);
cont.cd(3);
gPad->SetGrid();
h2.Draw(“cont2”); pl.DrawPaveLabel(x1,y1,x2,y2,“CONT2”,“brNDC”);
cont.cd(4);
gPad->SetGrid();
h2.Draw(“cont3,list”); pl.DrawPaveLabel(x1,y1,x2,y2,“CONT3”,“brNDC”);
TObjArray *contours=(TObjArray *)
gROOT->GetListOfSpecials()->FindObject(“contours”);
printf("%d %p",gROOT->GetListOfSpecials()->GetSize(),contours);
}