Re: [ROOT] TGeoManager->AddTrack()

From: Andrei Gheata (Andrei.Gheata@cern.ch)
Date: Thu Jul 17 2003 - 15:27:58 MEST


Hi Kerry,

The method that you've mentioned plus the new classes TVirtualGeoTrack 
and TGeoTrack are my first attempt of a track display & animation. They 
work and are not so difficult to use. Unfortunatelly I do not have a 
working example since I was testing it by collecting points from G3 step 
manager in the ALICE geometry working based on the virtual MC (you can 
see what this track display features are at : 
http://agheata.home.cern.ch/agheata/anim.gif or anim1.gif)

  Anyway, the idea is that you can add tracks to your geometry even 
supposing that you have some step management of your own propagating the 
particles. What you have to do is the following:

1. When starting tracking a new primary particle, create a new track:
    Int_t TGeoManager::AddTrack(id, pdg);

    - where id is a user-defined arbitrary identifier and pdg is the PDG 
code of the corresponding particle. The returned value is the index of 
the track in the list of tracks. You can use it to grab the track 
pointer, that you will need later:
   TVirtualGeoTrack *track = gGeoManager->GetTrack(index) or:
                                        ->GetLastTrack()
  You can also make this track the "current" one:
   gGeoManager->SetCurrentTrack(track)  so you will be able to retreive 
it later with:
   gGeoManager->GetCurrentTrack();

2. You will have to give a name to a track AFTER it is created :
    track->SetPdgName(Int_t pdg, const char *name)
  and the best choice for the name is the corresponding TParticle name 
(see TDatabasePDG class) since some known particles get special 
line/color attributes. Otherwise you can set the line attributes 
yourself in the usual way.

3. Now that you have the track pointer, you need to assign "hits" to it. 
Such a hit can be in fact any arbitrary point in space belonging to the 
track and having time information (time is essential for 
display/animation to work). Suppose that you collect this information 
from your mini step manager, what you have to do is:
    TVirtualGeoTrack *track = gGeoManager->GetCurrentTrack();
    track->AddPoint(x,y,z,t);

4. If your particle produces some secondaries, you can easily add them 
as secondaries:
     track->AddDaughter(id, pdg)
  Note that you do not use TGeoManager::AddTrack() for that.

That's it. You can now browse the tracks in the TBrowser under 
YourGeometry/Tracks, draw/animate them individually or all togeather 
(context menu of the manager class or of tracks), do selections on 
particle names, ... Please look at geompainter/TGeoTrack::Draw() and 
TGeoManager::AnimateTracks() for the supported options. For the 
animation, you have to know apriori what is the time range for your 
tracks. You can also draw first a nice picture of your detector and just 
then call Draw/Animate for tracks (by default tracks are overimposed on 
the top level view of your geometry, with default visualization options)
  Use TGeoManager::SetTminTmax() to display your tracks in a given time 
interval.

I hope this helps.

Best regards,
Andrei


LEE, KERRY T. (JSC-SR) (UHCL) wrote:
>  Dear Andrei,
> 
> I'm using ROOT 3.05.05 on RH9 gcc3.2.2-5
> 
> Do you have an example/tutorial that shows the use of
> TGeoManager->AddTrack()?  I have investigated on my own to try and use this
> function, but have not had too much luck.  It may be that this is not
> intended for use yet and is still under development.  If you do have any
> working example of a geometry and tracks using this method I'd appreciate
> any help I could get.
> 
> Thanks
> Kerry
> 



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