Is there a way to set the line width in G4VTrajectory::DrawTrajectory

If I save the info in G4TrackInfomation and I try to set the Drawing line width for special tracks with some info my defined, is there a way to set line width in G4VTrajectory::DrawTrajectory

G4VTrajectory::DrawTrajectory is a base class function that I wouldn’t mess with. If you really want to write your own trajectory class, then you should inherit G4VTrajectory and re-implement DrawTrajectory. But given the many features of /vis/modeling/trajectories/..., I would advise trying to use them first. If you do, then commands like

  /vis/modeling/trajectories/drawByCharge-0/default/setLineWidth 10

should do the trick. (I do recall a bug was found some years ago, whereby this did not work. I would have to look back through the Release Notes to find out exactly when. What version of Geant4 are you using?)

But if you want to write you own trajectory, I think you would have to add a data member to store the line width, then write your own DrawTrajectory that calls visManager->Draw(polyline), where polyline is a G4Polyline for which you set the line width in its G4VisAttributes. That should work but it’s quite a lot of coding. Be aware that G4VisManager::Draw(... only works in sequential mode.

Other ways:


and for geometry objects:


and while constructing volumes:


I use the latest release Version of G4.11.02.
I just want to set linewith several special line get from trackInfo.
yes, It seems I must rewrite the DrawTrajectory, not an convenient job for me.