Hi Kevin, When you do: tl->Draw(); the tl object is added to the current pad list of primitives, see: http://root.cern.ch/root/HowtoDraw.html When you clear the pad (pad->Clear()), the reference to the primitives in the pad is removed. If you do delete tl; the TLine destructor is called and the reference to tl is also removed from the pad list of primitives. If you do not want to delete your Tline and not clear the pad, you can still remove explictly the primitive from the list of primitives with pad->GetListOfPrimitives()->Remove(tl); pad->Modified(); pad->Update(); If you have many lines or other primitives to remove from the pad, you should call the Modified and Update functions only once. Rene Brun Kevin Reil wrote: > > TCanvas *c1 = new TCanvas (stuff); > TCanvas *c2= new TCanvas(stuff); > > vector<TLine*> lines1; > vector<TPolyLine3D*> lines2; > > for each event > { > c1->cd(); > for (int i=0; i<numlines; ++i) { > TLine *tl = new TLine(stuff) > tl->Draw(); > lines1.push_back(tl); > } > > similar for 3D lines on canvas 2. > > I draw/create them just fine. But I want to clear the vectors of > lines between events and cannot seem to erase them. Suggestions? > > I am not sure if it is my c++ or simple lack of knowledge about the > "deleting" of lines rom canvases. > > When I creating an instance of *tl and then push it to the vector is it > being lost over the next loop. IE should I create a vector<TLine> lines; > and push_back(*tl)? > > ------------------------------------------- > - Kevin Reil - > - 244A INSCC - > - (801) 587-9744 - > - http://www.physics.utah.edu/~reil - > - reil@physics.utah.edu - > ------------------------------------------- > - And my father dwelt in a tent. - > -------------------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:30 MET