Hello,
Given a line with its position and direction vectors, representing a particle track, how can I get the track length inside a given volume, using the geometry package?
thanks,
Luciano
Hello,
Given a line with its position and direction vectors, representing a particle track, how can I get the track length inside a given volume, using the geometry package?
thanks,
Luciano
Hi Luciano,
Suppose your particle is about to enter this volume, do:
gGeoManager->FindNextBoundaryAndStep(); // now entering your volume
gGeoManager->FindNextBoundaryAndStep(); // now exiting your volume
gGeoManager->GetStep(); // step made inside the volume
Of course that the track need to be initialized:
Cheers,
Hi Andrei,
I use your reply for a problem I’m seeing with TGeoMananger.
I’m moving a point along a certain direction in a geometry that is made of 4 TGeoBBox aligned along the z axis.
I’ve created a method that invokes FindNextBoundaryAndStep() twice, as you suggest. This works fine for first detector, but starts to give non-sense results for the second.
Above you have a printout for a step that worked. Now let’s move to second detector:
You see immediately the problem: TGeoManager believes that the next surface to be crossed is at 5.68989e-16 cm of distance, which sounds me like a Tolerance. So the point is never update and the FfindNextBoundaryAndStep never gives me back a NULL pointer, making infinite my while loop.
Each detector has as half dimensions:
and they are placed in this way:
These are :
Any hint will be really appreciated.
Many thanks in advance,
Marco
Hi Marco,
Can you just send me the geometry macro or the root file generated by: gGeoManager->Export(“mygeom.root”) ? May happen, but normally not for this simple geometry.
cheers
Hi Andrei,
I found a workaround.
I define a minStep as 1.e-8; if I get GetStep() < minStep, then I change the
starting point by moving it along given direction by a step equal to minStep.
Then I test again GetStep(). If now it is greater than minStep, I continue with the
normal navigation with FindNextBoundaryAndStep.
I need to force the step only once per FindNextBoundaryAndStep.
Marco