Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in the DST Viewer: all tracks displayed wrongly starting from (0,0,0) #16

Closed
dudarboh opened this issue Oct 14, 2021 · 0 comments · Fixed by #17
Closed

Bug in the DST Viewer: all tracks displayed wrongly starting from (0,0,0) #16

dudarboh opened this issue Oct 14, 2021 · 0 comments · Fixed by #17

Comments

@dudarboh
Copy link
Member

As we found out with @yradkhorrami, the DSTViewer displays tracks with a wrong position.

It uses reference point for x, y, z arguments of MarlinCED::drawHelix()

CEDViewer/src/DSTViewer.cc

Lines 231 to 234 in 0809ad2

// start point
float refx = 0.0;
float refy = 0.0;
float refz = 0.0;

CEDViewer/src/DSTViewer.cc

Lines 266 to 267 in 0809ad2

MarlinCED::drawHelix(bField, charge, refx, refy, refz, px, py, pz, ml, size, color, 0.0, padLayout.getPlaneExtent()[1],
gearTPC.getMaxDriftLength(), part->id() ); //hauke: add id

while by the design of the MarlinCED::drawHelix() there should go x, y, z coordinates ON the helix which is not the same...

See, e.g. how it is implemented inside DDCEDViewer, where x, y, z are calculated correctly from the reference point.

CEDViewer/src/DDCEDViewer.cc

Lines 1030 to 1039 in 0809ad2

double Px = pt * std::cos( ts->getPhi() ) ;
double Py = pt * std::sin( ts->getPhi() ) ;
double Pz = pt * ts->getTanLambda() ;
double Xs = ts->getReferencePoint()[0] - ts->getD0() * sin( ts->getPhi() ) ;
double Ys = ts->getReferencePoint()[1] + ts->getD0() * cos( ts->getPhi() ) ;
double Zs = ts->getReferencePoint()[2] + ts->getZ0() ;
int helixColor = ( _useColorForHelixTracks ? color : 0xdddddd ) ;
//helix
DDMarlinCED::drawHelix(bField, charge, Xs, Ys, Zs, Px, Py, Pz, marker|(layer<<CED_LAYER_SHIFT), size/2*_scaleLineThickness,
helixColor, 0.0, _helix_max_r, _helix_max_z, part->id() ); //hauke: add id

This results in the shifted track.
For the illustration, an example of such a track made by @yradkhorrami:

glced-4

Red helix --- properly displayed position of the track
Green helix --- artificially starts at 0 because of the wrong input inside DSTViewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant