Track in magnetic field

When tracking particles inside a vacuum volume with magnetic field, in the stepping action I get the pre and post step positions as two points on the boundaries of the volume. How can I get the full curved path that the particle followed inside the volume?

You should be able to see it. Try

/vis/scene/add/trajectories smooth

Not sure the best way to get those intermediate points. Have a look in G4SmoothTrajectory. It looks like the step has a method GetPointerToVectorOfAuxiliaryPoints. Give it a try.

Thank you @allison
I am trying to access it in the SteppingAction with
step->GetPointerToVectorOfAuxiliaryPoints()
but it always return nullptr
I’ve added a command
/tracking/storeTrajectory 2 also with 3 and 4
still the same

I can confirm that /vis/scene/add/trajectories smooth works. Please try that rather than got to /tracking/storeTrajectory directly.

But…that might not help. I do not understand why step->GetPointerToVectorOfAuxiliaryPoints() returns a null pointer.

Please continue to dig and we will solve this.

Thank @allison, thats good to know that through the GUI it works, so I can find out how it does it.
In my application am not using the GUI so I cannot issue the /vis/scene/add/trajectories command.
I would like to access it through the SteppingAction to perform custom scoring.

Dear Allison,

I found out that the step->GetPointerToVectorAuxiliaryPoints() will always return a null pointer if the Transportation process used is ‘G4CoupledTranportation’.

You can see at the end of the method ’ G4CoupledTransportation::AlongStepDoIt’ where the following lines are commented:

// Add smooth curved trajectories to particle-change
//
//fParticleChange.SetPointerToVectorOfAuxiliaryPoints
//(fFieldPropagator->GimmeTrajectoryVectorAndForgetIt() );

In the case of G4Transportation these lines are not commented and it is possible to get the auxiliary points.

Is there a reason to have commented these lines for G4CoupledTransporation?

Thanks!
André

Dear Andre,

These lines should also work fine in G4CoupleTransportation.

So if you need this capability, please uncomment them!

Cheers,
John

Should this be filed to Bugzilla, so that it is fixed in the next release?

Perfect!,
thanks for your reply @japost

Best,
André