TClonesArray fTestLines ("TPolyLine3D",1000); void geom_example_lines(){ gSystem->Load("libGeom"); TGeoManager *geom_example = new TGeoManager("geom_example","geom_example.C"); TGeoMaterial *mymat = new TGeoMaterial("BERILLIUM",9.01,4,1.848); mymat->SetUniqueID( 5); TGeoMedium *mymed = new TGeoMedium("BERILLIUM",3,5,0,1,10,2,0.1000000E+11,0.2163378,0.2000000E-03,0.2261152E-01); TGeoVolume *TOP_VOL = gGeoManager->MakeTube("TOP_VOL",mymed,0,210,350); TOP_VOL->SetVisibility(0); // --- TGeoVolume *IDET = gGeoManager->MakeTube("ITOF",mymed,5.8,6.03,10); IDET->SetVisibility(0); IDET->SetLineColor(5); gGeoManager->SetTopVolume(TOP_VOL); TOP_VOL->AddNode(IDET,1,gGeoIdentity); TGeoVolume *ITUB = IDET->Divide("ISLB",2,12,0,30); // --- gGeoManager->CloseGeometry(); cout << " ---> " << gGeoManager->GetTopVolume()->GetName() << endl; cout << " ---> " << gGeoManager->GetTopVolume()->GetNode(0)->GetName() << endl; gGeoManager->GetTopVolume()->VisibleDaughters(1); TCanvas *fMainCanvas = new TCanvas("GeomCanvas","Geometry",100,100,400,400); gGeoManager->GetTopVolume()->Draw(""); for(Int_t nl=0;nl<30;nl++){ new (fTestLines[nl]) TPolyLine3D(2); Double_t radius = 6; if(nl>27) radius = 10; Double_t x,y,z; gRandom->Circle(x,y,radius); z = gRandom->Gaus(0,10); // hits.SetPoint(i,x,y,z); TPolyLine3D *curline = (TPolyLine3D *)fTestLines[nl]; curline->SetPoint(0,x,y,-z); curline->SetPoint(1,x,y,z); curline->SetLineColor(nl); curline->SetLineStyle(nl); curline->SetLineWidth(nl/2); } for(Int_t i=0;iGetEntries();i++){ // TPolyLine3D *myl = ((TPolyLine3D *)(fTestLines[i])); ((TPolyLine3D *)(fTestLines[i]))->Draw("same"); } TGLSAViewer *fGLSAViewer = (TGLSAViewer *) fMainCanvas->GetViewer3D("ogl"); //TGLSAViewer *fGLSAViewer = (TGLSAViewer *) fMainCanvas->GetViewer3D(); // If you need to clear all lines or all markers: // fTestLines.Delete(); // hits.Delete(); }