Re: [ROOT] TGeo: Compare current path with detector element

From: Andrei Gheata (Andrei.Gheata@cern.ch)
Date: Wed Jul 16 2003 - 14:42:40 MEST


Hi Andi,

A simple tracking requires few steps:
1. Initializing the modeler with a given point and direction : see:
    TGeoManager::SetCurrentPoint(Double_t *point)
    TGeoManager::SetCurrentDirection(Double_t *dir)
or alternatively:
    TGeoManager::InitTrack(point,dir). This will also perform step 2:

2. Find the deepest node containing the point (where the point is 
located in your geom). This node is known as fCurrentNode by the manager 
class (see : TGeoManger::GetCurrentNode()). You should always check 
TGeoManager::IsOutside() to see if the point is still in your geometry. 
Nodes are named objects as well as volumes.

3. Compute the distance to next boundary :
    TGeoManager::FindNextBoundary(). After doung this, you can get the 
distance with: TGeoManager::GetStep(). If you already have a proposed 
step in mind, you can put it as argument to FindNextBoundary(). You may 
also query for the safe distance to the closest boundary :
    TGeoManager::Safety()
    TGeoManager::GetSafeDistance()

4. You can then actually do the step:
    TGeoManager::Step()
By default this will attempt to cross the next boundary, which you can 
check with TGeoManager::IsEntering(). You will want to check if you 
exited your geometry: TGeoManager::IsOutside(), the current path:
TGeoManager::GetPath(), the current node and volume. You can then do a 
test on the current node name.

You can also look inside TGeoChecker::RandomRays() for an example.

Andrei



andi klein wrote:
> Hi Andrei
> 
> I have set up a detector with TGeoManager to simulate tracks in my 
> experminet. (det is my geomanager). After doing a
> det->GetPath(); I know what my next detector will be. I am wondering if 
> there is a way how I can compare this with the name of one of my volumes 
> to see if I should continue tracking;i.e. something like
> if(det->GetPath == "element name") continue, where element name
> would be the name of the node.
> Maybe I just haven't found it, but any help would be appreiated.
> 
> Thanks, andi
> 
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET