TGeoManager:: AnimateTracks() advise needed

(sorry if this is a multiple post, I sent it to roottalk but did not recieve yet a confirmation that it reached the list)

Dear rooters,

could you please advise me how to use TGeoManager::AnimateTracks() properly? It does not look to be working as expected.
At astronu.jinr.ru/wiki/upload/5/5e/Test.tgz one could find both macro and the root file with tracks.
If I run it with gGeoManager->AnimateTracks(tmin,tmax); (see this line in code please)
it draws me immediately only one track (neutron) with a grey blob at the end and does not draw other tracks while their
end times are smaller than tmax (driven by neutron indeed)

If I try to use a piece of code below:

// or try this below
int nframes = 1;
// cout<< gGeoManager->GetNtracks()<< " "<< tmin<< " "<< tmax<<
endl;
for (int i=0; i<nframes; i++) {
double dt = (tmax-tmin)/nframes;
for (int j=0; j< gGeoManager->GetNtracks(); j++) {
TVirtualGeoTrack track = gGeoManager->GetTrack(j);
double x,y,z,t;
int k = track->GetNpoints()-1;
track->GetPoint(k,x,y,z,t);
if (t< tmin+dt
(i+1)) cout<< "track : "<< j<< " "<<
track->GetPDG()<< " "<< t<< " "<< tmin+dt*(i+1)<< endl;
}
gGeoManager->SetTminTmax(tmin, tmin+dt*(i+1));
// gGeoManager->SetTminTmax(tmin, 999.);
gGeoManager->DrawTracks();
gPad->Modified();
gPad->Update();
gSystem->Sleep(1000/nframes);
}
it does not work either. It seems that SetTminTmax cuts tracks with their end times smaller than tmax. Is this expected? If so, how can I make a drawing as a time sequence?

Thank you, Dmitry

Hi Dimitry,

In your macro you should: CloseGeometry(), collect all coordinates then call AddTrack subtracting the center of the box, define the top box un-shifted (otherwise the scene is too large). Besides, the track animation seems to work only if started for the browser via the context menu of the manager object.

I attached a macro using AnimateTracks as example.
Anyway, the plan is to change the track animation such that it could use the GL features. This will not happen tomorrow, but hopefully soon.

Regards,
polar.C (4.34 KB)

Hi Andrei, thanks for your answer! I will take a look on your macro and try to correct mine as you suggest. Cheers, Dmitry