Hi,
I wonder why I see a difference between the outputs of two pieces of code. The pieces seem to be identical, but one is in C++, another one is in python:
C++:
E = TGLVertex3(-55.*256/2/1000, -55.*256/2/1000, 0)
F = TGLVertex3(-55.*256/2/1000, +55.*256/2/1000, 0)
G = TGLVertex3(+55.*256/2/1000, +55.*256/2/1000, 0)
EFGH = TGLPlane(E, F, G)
trackAfterScattering = TGLLine3(TGLVertex3(2., 3., 0.2), TGLVector3(0., 0., -20.))
std::pair<bool, TGLVertex3> intersectionPointWithEFGH = Intersection(EFGH, trackAfterScattering, false);
printf("Track after scattering intersects the EFGH plane at (%+.2f, %+.2f, %+.2f) mm\n", intersectionPointWithEFGH.second.X(), intersectionPointWithEFGH.second.Y(), intersectionPointWithEFGH.second.Z())
this one prints Track after scattering intersects the EFGH plane at (+2.00, +3.00, +0.00) mm
PyROOT:
import ROOT
from ROOT import *
E = TGLVertex3(-55.*256/2/1000, -55.*256/2/1000, 0)
F = TGLVertex3(-55.*256/2/1000, +55.*256/2/1000, 0)
G = TGLVertex3(+55.*256/2/1000, +55.*256/2/1000, 0)
EFGH = TGLPlane(E, F, G)
trackAfterScattering = TGLLine3(TGLVertex3(2., 3., 0.2), TGLVector3(0., 0., -20.))
intersectionPointWithEFGH = ROOT.std.pair(bool, TGLVertex3)(Intersection(EFGH, trackAfterScattering, False))
print("Track after scattering intersects the EFGH plane at (%+.2f, %+.2f, %+.2f) mm" % (intersectionPointWithEFGH.second.X(), intersectionPointWithEFGH.second.Y(), intersectionPointWithEFGH.second.Z()))
this one prints Track after scattering intersects the EFGH plane at (+1.98, +2.97, +0.00) mm
The C++ output is correct, why does python’s one lack precision?
ROOT Version: 6.14.04
Platform: x86_64-slc6
Compiler: gcc62-opt