Can not work a function AddExec on compiled mode?

From: Yongzhao Zhou (Yongzhao.Zhou@lnf.infn.it)
Date: Mon Mar 06 2000 - 13:13:57 MET


Hi, Rooters,
A macro names threezoom which make three TGraph pictures zooming in
syn can work well on interpreted mode of root 2.23/12 of AIX4.3 as

  void threezoom()
  {
     gROOT->Reset();

     TCanvas *c1 = new TCanvas("c1","TCanvas",250,200,990,720);

     pad1 = new TPad("pad1","Window N1",0.02,0.66,0.98,0.96,18);
     pad2 = new TPad("pad2","Window N2",0.02,0.34,0.98,0.64,18);
     pad3 = new TPad("pad3","Window N3",0.02,0.02,0.98,0.32,18);

     pad1->SetGrid();
     pad1->SetBottomMargin(0.19);
   
     pad2->SetGrid();
     pad2->SetBottomMargin(0.19);
   
     pad3->SetGrid();
     pad3->SetBottomMargin(0.19);

     pad1->Draw();
     pad2->Draw();
     pad3->Draw();

     pad1->cd(); 

     Float_t x[100], y[100];
     Int_t n = 20;
     for (Int_t i=0;i<n;i++) {
       x[i] = i*0.1;
       y[i] = 10*sin(x[i]+0.2);
     }
     gr1 = new TGraph(n,x,y);	
     gr1->Draw("AC*");

     gPad->AddExec("ex","zoompad(gr1,gr2)");
     gPad->AddExec("ex","zoompad(gr1,gr3)");

     pad2->cd();

     Float_t x[100], y[100];
     Int_t n = 20;
     for (Int_t i=0;i<n;i++) {
       x[i] = i*0.1;
       y[i] = 10*cos(x[i]+0.2);
     }
     gr2 = new TGraph(n,x,y);

     gr2->Draw("AC*");

     pad3->cd();

     Float_t x[100], y[100];
     Int_t n = 20;
     for (Int_t i=0;i<n;i++) {
       x[i] = i*0.1;
       y[i] = x[i];
     }
     gr3 = new TGraph(n,x,y);
     gr3->Draw("AC*");

     c1->Update();
}


void zoompad(TGraph *tgr1, TGraph *tgr2) 
{
   int event = gPad->GetEvent();
   if (event != 11) return;
   TObject *select = gPad->GetSelected();
   if (!select) return;
   TAxis *axis1 = tgr1->GetXaxis();
   Int_t binmin = axis1->GetFirst();
   Int_t binmax = axis1->GetLast();
   Float_t xmin = axis1->GetBinLowEdge(binmin);
   Float_t xmax = axis1->GetBinLowEdge(binmax);
   TAxis *axis2 = tgr2->GetXaxis();
   Int_t newmin = axis2->FindBin(xmin);
   Int_t newmax = axis2->FindBin(xmax);
   axis2->SetRange(newmin,newmax);

   if (gr2){
     pad2->Modified();
     pad2->Update();
   }
   if(gr3){
     pad3->Modified();
     pad3->Update();
   }
}

But there aer always error messages if the same codes (sure, some statements
sould be changed) works on compiled mode on same system:

*** Interpreter error recovered ***
Error: No symbol gr1 in current scope  FILE:/tmp/oeaPlnizS_cint LINE:1
Error: No symbol gr3 in current scope  FILE:/tmp/oeaPlnizS_cint LINE:1

Does it means that function AddExec just can work under interpreted mode
and can not work under compiled mode?
Thanks for any help.
Best,
ZYZ
   
------
Yongzhao Zhou, KLOE, LNF, INFN, Italy
Tel:39-06-94032696 Fax:39-06-94032427



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET