Not able to draw TPloyLines3D in ROOT's OpenGL viewe

Dear all,

I would like to draw particle trajectories together with some experimental setup geometry in the same canvas with ROOT. Out of a simulation I get a set of points of the trajectory for each simulated particle, and with those points I build the TPolyLine3D objects as follows,

int Ntracks = 10;
TPolyLine3D* trajectory[Ntracks];
for(int itrk=;itrk<Ntracks;itrk++) {
trajectory[itrk] = new TPolyLine3D(nPoints); //nPoints is the number of points of the trajectory
for(int ipoint=0;ipoint<nPoints;ipoint++) {
trajectory[itrk]->SetPoint(ipoint,X[ipoint],Y[ipoint],Z[ipoint]);
//X[ipoint],Y[ipoint],Z[ipoint]: coordinates of the point ipoint
}
}

I then draw the geometry exporting it from a gdml file (file_gdml) as follows,
TGeoManager::Import(file_gdml);
gGeoManager->GetTopVolume()->Draw(“ogl”);

The system responds as follows,

Info in TGeoManager::Import: Reading geometry from file: Geant4SimuFiles/run35704.cfg.Pl3DUT.gdml
Info in TGeoManager::TGeoManager: Geometry GDMLImport, Geometry imported from GDML created
Info in TGeoManager::SetTopVolume: Top volume is World. Master volume is World
Info in TGeoNavigator::BuildCache: — Maximum geometry depth set to 100
Info in TGeoManager::CheckGeometry: Fixing runtime shapes…
Info in TGeoManager::CheckGeometry: …Nothing to fix
Info in TGeoManager::CloseGeometry: Counting nodes…
Info in TGeoManager::Voxelize: Voxelizing…
Info in TGeoManager::CloseGeometry: Building cache…
Info in TGeoManager::CountLevels: max level = 1, max placements = 6
Info in TGeoManager::CloseGeometry: 7 nodes/ 7 volume UID’s in Geometry imported from GDML
Info in TGeoManager::CloseGeometry: ----------------modeler ready----------------

and the geometry gets correctly displayed and it is possible to interact with it.

But when I try to draw the trajectories with the geometry,

for(int itrk=;itrk<Ntracks;itrk++) {
trajectory[itrk]->Draw();
}

The geometry doesn’t get displayed and there are no trajectories either.

For sure I am doing something wrong. Does any one can give me a hint on this?

Thanks in advance,

Alejandro

Dear all,

Any comments about this problem? I will appreciate any hint/suggestion?

Thanks in advance,

Alejandro

Hi Alejandro,

If you don’t mind using Eve I’d suggest you to look at tutorials/eve, in particular geom_XXXX.C for setting up geometry … after that just create your tracks as TEveLine objects and add them via gEve->AddElement(track).

If you want a more complex display with event navigation see alice_vsd.C there.

Cheers,
Matevz