Commit 9baed681 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'regsel' into 'master'

Fix phi=M_PI boundary issues for the RegionSelector

See merge request atlas/athena!48220
parents e480e0ed 5ac78b69
......@@ -42,12 +42,18 @@ RegSelRoI::RegSelRoI(double zMin, double zMax,
m_aMin = 1/m_invaMin;
m_aMax = 1/m_invaMax;
// just check explicitly, in case either range individually
// is set to pi
if ( m_phiMin==float(-M_PI) ) m_phiMin=-M_PI;
if ( m_phiMax==float( M_PI) ) m_phiMax= M_PI;
// AAARGH!!!! Check that the roi is in the correct range
double deltaphi = m_phiMax-m_phiMin;
if ( m_phiMax<m_phiMin ) deltaphi+=M_2PI;
if ( std::fabs(deltaphi-M_2PI)>1e-10 ) {
/// prefer std::fabs here since want manifest double precision
if ( std::fabs(deltaphi-M_2PI)>1e-6 ) {
if ( m_phiMin> M_PI ) m_phiMin -= M_2PI;
if ( m_phiMin<-M_PI ) m_phiMin += M_2PI;
......@@ -55,6 +61,8 @@ RegSelRoI::RegSelRoI(double zMin, double zMax,
if ( m_phiMax<-M_PI ) m_phiMax += M_2PI;
}
else {
/// shouldn't be needed now if the float(M_PI) tests
/// work but leave for more guaranteed robustness
m_phiMin = -M_PI;
m_phiMax = M_PI;
}
......
......@@ -727,6 +727,12 @@ void TrigTrackSeedGenerator::createTriplets(const TrigSiSpacePointBase* pS, int
if(nInner==0 || nOuter==0) return;
/// NB: the EDM classes store variuables as floats, therefore the double to float conversion
/// looses precision and as float(M_PI))>M_PI in the 7th decimal place we get problems
/// at the pi boundary
/// prefer std::fabs here for explicit double precision
bool fullPhi = ( roiDescriptor->isFullscan() || ( std::fabs( roiDescriptor->phiPlus() - roiDescriptor->phiMinus() - 2*M_PI ) < 1e-6 ) );
int nSP = nInner + nOuter;
const double pS_r = pS->r();
......@@ -879,7 +885,7 @@ void TrigTrackSeedGenerator::createTriplets(const TrigSiSpacePointBase* pS, int
//5. phi0 cut
if (!roiDescriptor->isFullscan()) {
if ( !fullPhi ) {
const double uc = 2*B*pS_r - A;
const double phi0 = atan2(sinA - uc*cosA, cosA + uc*sinA);
......@@ -920,6 +926,10 @@ void TrigTrackSeedGenerator::createTripletsNew(const TrigSiSpacePointBase* pS, i
if(nInner==0 || nOuter==0) return;
/// prefer std::fabs here for explicit double precision
bool fullPhi = ( roiDescriptor->isFullscan() || ( std::fabs( roiDescriptor->phiPlus() - roiDescriptor->phiMinus() - 2*M_PI ) < 1e-6 ) );
int nSP = nInner + nOuter;
output.reserve(m_settings.m_maxTripletBufferLength);
......@@ -1137,8 +1147,7 @@ void TrigTrackSeedGenerator::createTripletsNew(const TrigSiSpacePointBase* pS, i
//5. phi0 cut
if (!roiDescriptor->isFullscan()) {
if ( !fullPhi ) {
const double uc = 2*d0_partial;
const double phi0 = atan2(sinA - uc*cosA, cosA + uc*sinA);
......@@ -1202,6 +1211,10 @@ void TrigTrackSeedGenerator::createConfirmedTriplets(const TrigSiSpacePointBase*
if(nInner==0 || nOuter==0) return;
/// prefer std::fabs here for explicit double precision
bool fullPhi = ( roiDescriptor->isFullscan() || ( std::fabs( roiDescriptor->phiPlus() - roiDescriptor->phiMinus() - 2*M_PI ) < 1e-6 ) );
int nSP = nInner + nOuter;
const double pS_r = pS->r();
......@@ -1348,7 +1361,7 @@ void TrigTrackSeedGenerator::createConfirmedTriplets(const TrigSiSpacePointBase*
//5. phi0 cut
if (!roiDescriptor->isFullscan()) {
if ( !fullPhi ) {
const double uc = 2*B*pS_r - A;
const double phi0 = atan2(sinA - uc*cosA, cosA + uc*sinA);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment