Drawing tracks with TGeotrack

Hi everyone, I’m new to ROOT so I’ll try to be as accurate as possible.

I have tracks of electrons in a semi-conductor device I want to draw and animate.
I create a simple world like that:

[code]TGeoManager *mgr = new TGeoManager(“geo”,“tracking”);
TGeoMedium *medium =0 ;
TGeoVolume *top = mgr->MakeBox(“TOP”,medium,1,1,1);
mgr->SetTopVolume(top);

top->SetLineColor(kMagenta);
mgr->SetTopVisible();

mgr->CloseGeometry();

int track_index = mgr->AddTrack(1,100);
TVirtualGeoTrack *track = mgr->GetTrack(track_index);[/code]

then I fill my tracks with the diferent x,y,z,t, and I re-execute those lines for each electrons

int track_index = mgr->AddTrack(1,100); TVirtualGeoTrack *track = mgr->GetTrack(track_index);

  1. Is there a way to create tracks and add points to them without having to set a pointer to each new virtuaGeotrack created in TGeomanager ?

  2. in my code I set

I set the Dx,Dy,Dz of my box to 1, because else I can’t see my box. My electrons trajectories length are more of the order of the micron, So I would like a box a few hundreds cubic microns, not 1 cubic meter ! If I set my box with this dimension, it is drawn inside a bigger box of 1X1X1. I see my box small small small inside the bigger one, But I want it to appear full screen !

As I’ve set it now, I need to renormalize my electrons tracjectories (x/xmax,y/ymax,z/zmax) so they cover the whole 1X1X1 box.

I guess there is a simple way to do that, but I can’t find it clearly in the documentation.

Thank you for the advices you could give, and sorry for my poor english :wink:

Mathieu B
University of Montreal

Hi Mathieu,

  1. Use: gGeoManager->AddTrack() to create and : gGeoManager->GetLastTrack() to work on it in a different place. Alternatively you may use Set/GetCurrentTrack() after track creation.

  2. The scaling problem is fixed in CVS head.

Cheers,

Thank you very much !

Mathieu