Re: TNode strange behaviour

Rene Brun (Rene.Brun@cern.ch)
Thu, 26 Mar 1998 12:10:27 +0100


Stephane Basa wrote:
>
> Hi Rooters,
>
> I have observed a very stange behaviour in TNode (I am sure that I am
> guilty!!!).
>
> I have defined a class, ANTLcm, where a volume is defined and placed
> inside a mother volume (code below). In the main program I have defined
> a main volume called mother where an ANTLcm menber is placed.
>
> When I check that everything is Ok by doing a mainnode->ls(), my
> ANTLcm
> menber is correctly placed inside the main volume. However when I try to
> pick the ANTLcm menber with the mouse, it doesn't work. Moreover I have
> observed with the ROOT event status that this member is detected at the
> center of the main volume. Does somebody have an idea of the problem?
>

Your procedure cannot work because your ANTLcm::ExecuteEvent is never
called. In DistancetoPrimitive you never set the picked object to this.
I understand from your class that you try do use a "TBrik" like object
to display hits.
We have introduced in version 2.0 a new class TMarker3DBox
for this purpose. One could also introduce a TMarker3DTube.
I provide an example below based on your control macro to illustrate
how to use this new class TMarker3DBox.

Rene Brun

{
gROOT->Reset();
TCanvas *c1 = new TCanvas("Ant","The Ant Program", 200,10,700,780);
TPad *mainpad = new TPad("mainpad","mainpad",0.02,0.02,0.98,0.98,41);
mainpad->Draw();
mainpad->cd();

// Volume definition
TTUBE *mother = new TTUBE("mother","Mother
Volume","void",0.,300.,300.);
TNode *mainnode = new TNode("mainnode","Main node","mother");
mainnode->Draw();
mainpad->Update();
mainnode->cd();
// mainnode->SetVisibility(0);

Int_t nhits = 50;
for (Int_t hit=0;hit<nhits;hit++) {
Float_t dx = 10;
Float_t dy = 10;
Float_t dz = 70*gRandom->Rndm();;
Float_t x = -200+400*gRandom->Rndm();
Float_t y = -200+400*gRandom->Rndm();
Float_t z = -200+400*gRandom->Rndm();
Float_t r = TMath::Sqrt(x*x+y*y);
Float_t theta = 180*TMath::ACos(z/r);
Float_t phi = 180*TMath::Atan2(y,x);
TMarker3DBox *box = new TMarker3DBox(x,y,z,dx,dy,dz,theta,phi);
Int_t color = 0.1*dz;
box->SetLineColor(color);
box->Draw();
}
}