Skip to content

Commit

Permalink
Keep tracking frame rotation angle between -pi and +pi
Browse files Browse the repository at this point in the history
  • Loading branch information
martenole authored and davidrohr committed Oct 5, 2020
1 parent 72a53b9 commit 4383a11
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions GPU/GPUTracking/TRDTracking/GPUTRDTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
}
int currSec = mGeo->GetSector(currDet);
if (currSec != GetSector(prop->getAlpha())) {
float currAlpha = GetAlphaOfSector(currSec);
if (!prop->rotate(currAlpha)) {
if (!prop->rotate(GetAlphaOfSector(currSec))) {
if (ENABLE_WARNING) {
Warning("FollowProlongation", "Track could not be rotated in tracklet coordinate system");
}
Expand Down Expand Up @@ -1075,7 +1074,13 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::AdjustSector(PROP* prop, TRDTRK* t, c
return false;
}
int sign = (y > 0) ? 1 : -1;
if (!prop->rotate(alphaCurr + alpha * sign)) {
float alphaNew = alphaCurr + alpha * sign;
if (alphaNew > M_PI) {
alphaNew -= 2 * M_PI;
} else if (alphaNew < -M_PI) {
alphaNew += 2 * M_PI;
}
if (!prop->rotate(alphaNew)) {
return false;
}
if (!prop->propagateToX(xTmp, .8f, 2.f)) {
Expand Down Expand Up @@ -1107,7 +1112,11 @@ GPUd() float GPUTRDTracker_t<TRDTRK, PROP>::GetAlphaOfSector(const int sec) cons
//--------------------------------------------------------------------
// rotation angle for TRD sector sec
//--------------------------------------------------------------------
return (2.0f * M_PI / (float)kNSectors * ((float)sec + 0.5f));
float alpha = 2.0f * M_PI / (float)kNSectors * ((float)sec + 0.5f);
if (alpha > M_PI) {
alpha -= 2 * M_PI;
}
return alpha;
}

template <class TRDTRK, class PROP>
Expand Down

0 comments on commit 4383a11

Please sign in to comment.