TGeoManager and adding tracks

I’m having some difficulty with using the geometry package. I don’t appear to get the concept of how to add tracks to an existing geometry.

What I’m looking for is some simple example like rootgeom.C

While I’m here I’ll ask a couple of simple questions.

  1. I’m assuming that you initialize and add tracks after you close a geometry. Is this correct?

  2. Should all tracks be added using TGeoManager::AddTrack?

  3. What is the difference between CreateTrack and AddTrack?

  4. For initial tracks, Im confused about the particle input, it seems like it overlaps with the other parameters.

Thank you
Chris

Hi Chris,

Unfortunatelly there is no example like rootgeom.C for drawing tracks. I’ve created this feature some time ago because there were no other tools to inspect by eye the results of tracking. The TGeoTrack objects are however limited to the pad (no 3D viewer) and hopefully all their functionality will be very soon implemented in the TViewer3D API. Anyway, an example of their usage can be found in the geant3 module from ROOT CVS, namely in: geant3/TGeant3/TGeant3gu.cxx::gustep() inside the block : #if defined(COLLECT_TRACKS)

You can find a reasonable description on using TGeoTracks in the user’s guide at p317:
ftp://root.cern.ch/root/doc/chapter19.pdf

Now the answers to your questions:

[quote]1) I’m assuming that you initialize and add tracks after you close a geometry. Is this correct?
[/quote]
Yes

[quote]2) Should all tracks be added using TGeoManager::AddTrack?
[/quote]
No, only primaries. For secondaries you have to call the AddTrack method of some primary.

[quote]
3) What is the difference between CreateTrack and AddTrack? [/quote]
MakeTrack creates a track while AddTrack creates a primary track (adds the track to the list of primaries of TGeoManager)

The particle input is optional and can be used as a hook to your real track object.

I hope this helps,
Cheers,

Thanks very much!
Chris