You must force a call to c1->Update(); before getting the "stats" box. The stats box is only generated when the objects are effectively paint in the canvas. Rene Brun Manoj Jha wrote: > > Dear Rooters, > I have tried to obtain a new statistic box using a script with the > following lines > > [....] > > TPaveStats *st = (TPaveStats*)h2->GetListOfFunctions()->FindObject("stats"); > st->SetX1NDC (0.8); > st->SetX2NDC (0.9); > > [...] > > I faced with the following error while I run the script > > --------------------------------------------------------- > Error: illegal pointer to class object st 0x0 227 FILE:weight.C LINE:19 > *** Interpreter error recovered *** > ------------------------------------------------------ > > Could you please suggest me the possible solution for it ? I am also > attaching the script for your convenience. > > Thanks, > manoj > > -------------------------------------------------------------------------------- > { > gROOT->Reset(); > c1 = new TCanvas("c1","The HSUM example",200,10,600,400); > c1->SetGrid(); > > Int_t type = 111; // Portrait > TPostScript ps ("weight.ps", type); > TFile f("CordinateDistributionShapedLead.root"); > > h4->SetFillColor(42); > > h2->SetFillColor(46); > h4->Draw(); > h4->SetTitle("L1 E_{T} Distribution of Crystal No. 4 & 2"); > h4->GetXaxis()->SetTitle("L1 E_{T} (in GeV)"); > h4->GetYaxis()->SetTitle("No. of Events"); > TPaveStats *st = (TPaveStats*)h2->GetListOfFunctions()->FindObject("stats"); > st->SetX1NDC (8); > st->SetX2NDC (9); > h2->Draw("sames"); > //h2->SetOptStat(0001111); > c1.Update(); > /* > h2->SetFillColor(46); > h4->Draw(); > h2->Draw("same"); > c1.Update(); > > h3->SetFillColor(46); > h4->Draw(); > h3->Draw("same"); > c1.Update(); > > h5->SetFillColor(46); > h4->Draw(); > h5->Draw("same"); > c1.Update(); > > h6->SetFillColor(46); > h4->Draw(); > h6->Draw("same"); > c1.Update(); > > h7->SetFillColor(46); > h4->Draw(); > h7->Draw("same"); > c1.Update(); > > h8->SetFillColor(46); > h4->Draw(); > h8->Draw("same"); > c1.Update(); > > h9->SetFillColor(46); > h4->Draw(); > h9->Draw("same"); > c1.Update(); > > h10->SetFillColor(46); > h4->Draw(); > h10->Draw("same"); > c1.Update(); > > h11->SetFillColor(46); > h4->Draw(); > h11->Draw("same"); > c1.Update(); > > h12->SetFillColor(46); > h4->Draw(); > h12->Draw("same"); > c1.Update(); > > h13->SetFillColor(46); > h4->Draw(); > h13->Draw("same"); > c1.Update(); > > h14->SetFillColor(46); > h4->Draw(); > h14->Draw("same"); > c1.Update(); > > h15->SetFillColor(46); > h4->Draw(); > h15->Draw("same"); > c1.Update(); > > h16->SetFillColor(46); > h4->Draw(); > h16->Draw("same"); > c1.Update(); > > h17->SetFillColor(46); > h4->Draw(); > h17->Draw("same"); > c1.Update(); > > h18->SetFillColor(46); > h4->Draw(); > h18->Draw("same"); > c1.Update(); > > h19->SetFillColor(46); > h4->Draw(); > h19->Draw("same"); > c1.Update(); > > h20->SetFillColor(46); > h4->Draw(); > h20->Draw("same"); > c1.Update(); > > h21->SetFillColor(46); > h4->Draw(); > h21->Draw("same"); > c1.Update(); > > h22->SetFillColor(46); > h4->Draw(); > h22->Draw("same"); > c1.Update(); > > h23->SetFillColor(46); > h4->Draw(); > h23->Draw("same"); > c1.Update(); > > h24->SetFillColor(46); > h4->Draw(); > h24->Draw("same"); > c1.Update(); > > h25->SetFillColor(46); > h4->Draw(); > h25->Draw("same"); > c1.Update(); > > h26->SetFillColor(46); > h4->Draw(); > h26->Draw("same"); > c1.Update(); > > h27->SetFillColor(46); > h4->Draw(); > h27->Draw("same"); > c1.Update(); > > */ > ps.Close(); > > }
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET