Re: [ROOT] Possible bug?

From: Valeri Fine (fine@bnl.gov)
Date: Fri Jun 22 2001 - 16:02:33 MEST


Hello Mike this sounds to define the detector geometry  you should not use TPolyMarker3D 
rather  http://root.cern.ch/root/htmldoc/TPolyLineShape.html#TPolyLineShape:description
The last one is derived from TShape and can be easily incorporated 
into either TNode or TVolume structures.

  Hope  this helps, With my regards, Valeri

----- Original Message ----- 
From: "Rene Brun" <Rene.Brun@cern.ch>
To: "Mike Miller" <miller@star.physics.yale.edu>
Cc: <roottalk@cern.ch>
Sent: Friday, June 22, 2001 4:49 AM
Subject: Re: [ROOT] Possible bug?


> Hi Mike,
> 
> Several objects (including TPolyMarker3D) are automatically deleted when
> the pad is redrawn (your case). your pointer poly points to an invalid object.
> There are two solutions to this problem.
>  1- Replace the statement
>     TPolyMarker3D* poly = new TPolyMarker3D(9, x, 8);
>    by
>     TPolyMarker3D* poly = new TPolyMarker3D();
>     poly->SetPolyMarker(9, x, 8);
>   
>  2- do:
>     TPolyMarker3D* poly = new TPolyMarker3D(9, x, 8);
>     poly->ResetBit(kCanDelete);
> 
> The bit kCanDelete is not set by the default constructor.
> 
> Rene Brun
> 
> 
> 
> Mike Miller wrote:
> > 
> > Hello, I'm trying to draw a TPolyMarker3D on top of a set of TVolumes.  I
> > do this to draw a set of hits on top of a simple detector model.  If I
> > draw the TVolume, the TPolyMarker3D, the TVolume agiain, I'm ok.  If I
> > draw the TVolume, TPolyMarker3D, TVolume agiain, TPolyMarker3D again, I
> > seg-fault.  In this example I wouldn't need to draw the TVolume multiple
> > times, it is simply meant to illustrate the point.  However, in the real
> > application, I do need to call TVolume::Draw() more than once to refresh
> > changes in the display.
> > 
> > Here's the macro...
> > 
> > void TestShapes()
> > {
> >     gSystem->Load("libstar");
> >     TCanvas* c1 = new TCanvas("c1");
> > 
> >     TVolume* main = new TVolume();
> > 
> >     TBRIK* brik = new TBRIK("BRIK","BRIK","void", 10., 20., 30.);
> >     TVolume* son = new TVolume("son","son",brik);
> > 
> >     main->Add(son);
> > 
> >     cout <<"Draw Main Volume"<<endl;
> >     main->Draw();
> >     c1->Update();
> > 
> >     main->SetVisibility(TVolume::kBothVisible);
> > 
> >     cout <<"Starting Loop To Fill Array"<<endl;
> >     double* x = new double[9];
> >     for (int i=0; i<9; ++i) {
> >         x[i]=static_cast<double>(i);
> >     }
> > 
> >     for (int i=0; i<9; ++i) {
> >         cout <<i<<"\t"<<x[i]<<endl;
> >     }
> > 
> >     TPolyMarker3D* poly = new TPolyMarker3D(9, x, 8);
> >     cout <<"Draw TPolyMarker3D"<<endl;
> >     poly->Draw();
> >     cout <<"Draw TPolyMarker3D Again"<<endl;
> >     poly->Draw();
> >     cout <<"Draw Main Volume Again"<<endl;
> >     main->Draw();
> >     cout <<"Update Canvas"<<endl;
> >     c1->Update();
> > 
> >     file://This is where we seg-fault
> >     cout <<"Draw TPolyMarker3D Again"<<endl;
> >     poly->Draw();
> > 
> >     return;
> > }
> > 
> > How else can I represent points in an inexpensive 3d fashion?  Thanks,
> > Mike
> > 
> > Michael L. Miller
> > Yale Physics
> > michael.miller@yale.edu
> > 
> > BNL:    (631) 344-8342
> >         Building 118
> >         Yale Software
> > 
> > Yale:   (203) 432-5637
> >         Room 305 WNSL
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET