Re: [ROOT] TGeoManager::FindNextBoundary()

From: Andrei Gheata (Andrei.Gheata@cern.ch)
Date: Fri Sep 27 2002 - 11:06:11 MEST


 Hi Kerry,

 I am glad to see that people started to use the new geometry package. 
There is basically nothing wrong
with your setup, the problem is that you were shooting your ray exactly 
parallel to the Z axis and there was a bug in TGeoBBox class related to 
this. In fact, I have several improvements related to the tracking 
algorithms in my current working version, as well as new features 
(boolean shapes, voxelization optimisations, ...). These will be 
available in CVS in the next one or two weeks, supporting  I/O for the 
geometry classes.

 Anyway, I have slightly modified your simple macro that now looks like 
this :
TestGeo.cxx
 {
   gInterpreter->ExecuteMacro("TeleGeo.cxx");
   geom->CloseGeometry();
   geom->SetVisLevel(4);
   top->Draw();
   Double_t point[3], dircos[3];
   point[0] = -8.984;
   point[1] = 0.0;
   point[2] = 7.8;
   Double_t theta = 180.;
   Double_t phi = 0.;
   Double_t degrad = TMath::Pi()/180.;
  // better this way
   dircos[0] = TMath::Sin(theta*degrad)*TMath::Cos(phi*degrad);
   dircos[1] = TMath::Sin(theta*degrad)*TMath::Sin(phi*degrad);
   dircos[2] = TMath::Cos(theta*degrad);
   printf("direction : %f %f %f\n", dircos[0], dircos[1], dircos[2]);
   geom->InitTrack(point,dircos);
   while (!geom->IsOutside()) {   // you should use this to propagate 
till outside
     printf("current : %s\n", geom->GetPath());
     geom->FindNextBoundary();
     cout<<"Distance to Boundary is "<<geom->GetStep()<<" cm."<<endl;
     geom->Step();
   } 
 }


 this  produces the following output with my working version :

direction : 0.000000 0.000000 -1.000000
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 0.18725 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/PSD1_1
Distance to Boundary is 0.0315 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 1.8735 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/PSD2_1
Distance to Boundary is 0.0315 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 1.1349 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/Brass_3
Distance to Boundary is 0.0127 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 0.1873 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/Brass_4
Distance to Boundary is 0.0127 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 0.76865 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/B1_1
Distance to Boundary is 0.5 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 0.158 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/B2_1
Distance to Boundary is 0.5 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 0.239 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/B3_1
Distance to Boundary is 0.5 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 0.158 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1/B4_1
Distance to Boundary is 0.5 cm.
current : /TOP_1/MARIE_1/Outer_1/Inner_1
Distance to Boundary is 10.9645 cm.
current : /TOP_1/MARIE_1/Outer_1
Distance to Boundary is 0.1905 cm.
current : /TOP_1/MARIE_1
Distance to Boundary is 14.85 cm.
current : /TOP_1
Distance to Boundary is 775 cm. 

which is correct. Shooting random rays at the level of your Inner volume 
also produces correct picture.

Best regards,
Andrei

LEE, KERRY T. (JSC-SR) (UHCL) wrote:

>Hi,
>
>I am trying to use the TGeoManager::FindNextBoundary() function to pass
>tracks through my geometry to tell me how far I've traveled in a given
>volume, by getting the step result from TGeoManager::GetStep().  After
>passing through 1 or 2 volumes TGeoManager::GetStep() becomes 1e+30, when in
>fact there are other volumes that should be intersected at a distance on the
>order of 1.0.  Am I doing something wrong?
>
>I am attaching the geometry file and the simple macro I used to step through
>the geometry.
>
>I using ROOT v3.03.09 on Red Hat 7.1.
>
>Thanks
>Kerry
>
>  
>



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:11 MET