Tracks not drawn with TGeoManager

Hello,
I’m trying to plot a simple geometry setup where the TGeoManager has some tracks added to it before it is being exported to a root file.
The tracks are there - I know since I can retrieve these as TObjArray, loop over that array and Print() each track (as can be seen in the commented-out part below).
While all volumes of the setup are drawn properly, the tracks are not drawn to the GLViewer no matter what I do - I tried to call DrawTracks(), AnimateTracks(), Draw() on each track from the TObjArray but there’s no track drawn in any of these attempts.

When i just dump everything to a TCanvas, regardless of the exported TGeoManager, I can draw all tracks properly (with gGeoManager.DrawTracks() on python)

What am I missing?
Thanks!
Noam

void SomeSetup() {
   TGeoManager::Import("SomeSetup.root");
   gGeoManager->GetVolume("TOP")->Draw("ogl");
   gGeoManager->DrawTracks("ogl"); // doesn't work, also when called with other options
   // TObjArray* tracksarr = gGeoManager->GetListOfTracks(); // works fine
   // Int_t ntracks = tracksarr->GetEntries(); // works fine and returns the proper number
   // cout << "ntracks=" << ntracks << endl; // ...
   // for(int i=0 ; i<ntracks ; ++i)
   // {
   // 	tracksarr->At(i)->Draw(); // doesn't work, also when called with e.g. "ogl", "same", "/*", etc.
   // 	tracksarr->At(i)->Print(); // works fine and shows the correct prod vertex and end point
   // }
   // new TBrowser; // is this needed?
}

_ROOT Version: 6.18/04 (Built for macosx64 on Sep 11 2019, 15:38:23 From tags/v6-18-04@v6-18-04)
_Platform: macosx64


@agheata Perhaps you can help?

Hi,
This feature is very old and was never supporting the GL viewer, it is only for the TCanvas view. If you get the effects in a canvas, this is all I’m afraid.
Best, Andrei

Thanks Andrei,
So you’re saying there’s no way to append tracks in the GLView somehow?
Noam

Indeed, that is unfortunately the case
Cheers, Andrei

OK,
So my followup questions would be:

  • which is the old feature here, the GLViewer option or the DrawTracks?
  • why is the geometry not drawn on a simple canvas as it appears on the GLViewer (besides the tracks)?
    For the 2nd question, please see the attached snapshots of the same geometry in the 2 cases. The canvas case is simply the result of drawing the top volume of the geometry.


    Thanks,
    Noam

Hi,
You can have different style views on the the canvas/GL viewer. Looks like in this case you have parallel view in the canvas and perspective in GL, wireframe in canvas and solid view in GL. They are not kept in sync, and the 2 viewers have many different features.
Cheers, Andrei

Thanks.
When using the TCanvas, is this controlled from the TView?
I basically want to have the shapes drawn (like in the GLView) and I want the shapes to appear in the correct “physical order” rather than to appear in the order in which they were added to the top volume.
Is this possible?
Noam

Hi Noam. It is indeed TView, but you cannot control overlay of objects. You can have however a ray-traced image in the canvas, using: gGeoManager->GetTopVolume()->Raytrace(). This may hide however the drawn tracks, I’m not sure.

Hi Andrei,
It doesn’t seem to work - see snapshot below (the blue part on the right of the tube seems like it is on top of the tube, while it should be hidden behind it)
I’m not entirely sure how to proceed - is there another way to do this other than the GLView/TView+TCanvas, @agheata ?
Thanks,
Noam

Hi Noam, this is a feature of the wireframe view with no hidden line removal (which TView is not capable of). As I said, this is the best that you can get to see both tracks and geometry at the same time. One thing you can try is to make your tracks as TPolyLine3D objects, drawing them after you have drawn the geometry, then opening the GL viewer. I’m not 100% sure, but this may correctly hide the non-visible part of the tracks.

Thanks,
Ignoring the tracks for the moment, the TView is incapable to draw the geometry itself with the right perspective (i.e. hiding parts of the geometry by other parts according to the angle of view)?

Hi, to close this thread - just to say that the small hint from this roottalk has made the difference for me and I’m able to plot everything (geometry and tracks) in the GLViewer.
Cheers,
Noam

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.