[ROOT] error when executing a loop

From: Stilianos Kesisoglou (kesisogl@fnal.gov)
Date: Fri Jun 11 2004 - 11:16:36 MEST


Hi,

   I've encountered a problem that I find it kind of strange. I would
appreciate any help.
   The following piece of code works fine:
.
... 
    Int_t i=0;
    TMarker *mark;

    mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
    ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++;
    mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
    ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++;
    mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
    ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++;

    TGraph *gr = new TGraph(3,ptsX,ptsY);
.
.

   But if I replace it with a loop, it crashes on the second iteration:
.
... 
    Int_t i=0;
    TMarker *mark;

    for(Int_t iL=0;iL<3;IL++) {
    	mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
    	ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++;
    }

    TGraph *gr = new TGraph(3,ptsX,ptsY);
.
.

   Any idea why this behaivior appears?

   Thanks!

Stelios.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET