Skip to content
Snippets Groups Projects

Improve PrForwardTracking debugging experience

Merged Andre Gunther requested to merge gunther_moreDebug into master
All threads resolved!
1 file
+ 43
12
Compare changes
  • Side-by-side
  • Inline
@@ -240,7 +240,7 @@ namespace LHCb::Pr::Forward {
template <typename Tuple, size_t... I>
void tuple_helper( Tuple&& tuple, std::index_sequence<I...> ) {
( ( std::cout << ( I == 0 ? "" : ", " ) << std::get<I>( tuple ) ), ... ) << std::endl;
( ( std::cout << std::get<I>( tuple ) << " " ), ... ) << std::endl;
}
template <bool enable = true, typename... T>
@@ -544,6 +544,9 @@ namespace LHCb::Pr::Forward {
auto getBinContentCoord( int iBin ) {
return LHCb::span{m_binContentCoord}.subspan( iBin * reservedBinContent, m_binContentSize[iBin] );
}
auto getBinContentCoord( int iBin ) const {
return LHCb::span{m_binContentCoord}.subspan( iBin * reservedBinContent, m_binContentSize[iBin] );
}
/**
* @brief Make a span for one bin
@@ -593,33 +596,55 @@ namespace LHCb::Pr::Forward {
}
}
// for debugging
friend std::ostream& operator<<( std::ostream& os, const HoughTransformation& h ) {
const auto candidateBins = LHCb::span( h.m_candidateBins.begin(), h.m_candSize );
os << "Found candidate bins:" << std::endl;
for ( auto bin : candidateBins ) {
os << "Bin " << bin << " x coords: [ ";
const auto coords = h.getBinContentCoord( bin );
const auto fulldexes = h.getBinContentFulldex( bin );
for ( auto i{0}; i < h.m_binContentSize[bin]; ++i ) {
os << "(" << fulldexes[i] << ", " << coords[i] << ")";
os << ( i != h.m_binContentSize[bin] - 1 ? " | " : "" );
}
os << "]"
<< " size=" << h.m_binContentSize[bin] << std::endl;
const auto planes =
( h.m_planeCounter[bin] | h.m_planeCounter[bin - 1] | h.m_planeCounter[bin + 1] ) >> h.nDiffPlanesBits;
os << "Used planes including neighbours: " << std::bitset<12>( planes ) << std::endl;
os << std::endl;
}
return os;
}
private:
/**
* @property array of parameters that define the non-simple binning of the "Hough-Histogram"
*/
static constexpr std::array binningParams{5.05675291e+02f, 4.53316164e-01f, 5.57027462e-04f, 5.5f};
/**
* @property Contains the the number of unique planes within a bin encoded together with bit flags for each plane.
*/
alignas( 64 ) std::array<int, alignAndPad( nBins )> m_planeCounter{};
/**
* @property Contain the coordinates (x hits on reference plane) and PrSciFiHits indices in each bin
*/
alignas( 64 ) std::array<float, alignAndPad( nBins ) * reservedBinContent> m_binContentCoord;
alignas( 64 ) std::array<int, alignAndPad( nBins ) * reservedBinContent> m_binContentFulldex;
/**
* @property Contains the number of hits in each bin
* @property Contains the the number of unique planes within a bin encoded together with bit flags for each plane.
*/
alignas( 64 ) std::array<int, alignAndPad( nBins )> m_binContentSize{};
alignas( 64 ) std::array<int, alignAndPad( nBins )> m_planeCounter{};
/**
* @property sstorage that contains temporary permutations from insertion sort
* @property Contains the number of hits in each bin
*/
alignas( 64 ) std::array<int, reservedBinContent> m_binPermutations;
alignas( 64 ) std::array<int, alignAndPad( nBins )> m_binContentSize{};
/**
* @property Contains a selection of bins that qualify as part of a track candidates.
* @details The number of candidates is tracked by candSize.
*/
alignas( 64 ) std::array<int, alignAndPad( nBins )> m_candidateBins;
/**
* @property sstorage that contains temporary permutations from insertion sort
*/
alignas( 64 ) std::array<int, reservedBinContent> m_binPermutations;
int m_candSize{0};
};
@@ -1487,6 +1512,7 @@ namespace LHCb::Pr::Forward {
std::pair<float, float> momentumBorders,
const FT::Hits& SciFiHits ) {
direct_debug( "------------projectXHitsToHoughSpace------------" );
direct_debug( "" );
const auto dxMin = momentumBorders.first;
const auto dxMax = momentumBorders.second;
@@ -1511,7 +1537,7 @@ namespace LHCb::Pr::Forward {
// binary search to find indicies corresponding to search window
minIdx = SciFiHits.get_lower_bound_fast<2>( minIdx, maxIdx, xMin );
maxIdx = SciFiHits.get_lower_bound_fast<4>( minIdx, maxIdx, xMax );
direct_debug( "stereoLayer", iLayer, "betterZ =", zZone, "[xMin,xMax] (index) = [", xMin, "(", minIdx, "),",
direct_debug( "stereoLayer", iLayer, "| betterZ =", zZone, "| [xMin,xMax] (index) = [", xMin, "(", minIdx, "),",
xMax, "(", maxIdx, ")]" );
const auto tx = veloSeed.seed.tx;
const auto dSlopeDivPart = 1.f / ( zZone - veloSeed.zMag );
@@ -1549,6 +1575,8 @@ namespace LHCb::Pr::Forward {
const auto iBinIdx = reservedBinContent * iBin + m_binContentSize[iBin]++;
m_binContentCoord[iBinIdx] = projHitBase[idx];
m_binContentFulldex[iBinIdx] = i + idx;
} else {
direct_debug( "Bin", iBin, "is overflowing!" );
}
}
} // end of loop over hits
@@ -1584,6 +1612,7 @@ namespace LHCb::Pr::Forward {
std::pair<float, float> momentumBorders,
const FT::Hits& SciFiHits ) {
direct_debug( "------------projectStereoHitsToHoughSpace------------" );
direct_debug( "" );
const auto dxMin = momentumBorders.first;
const auto dxMax = momentumBorders.second;
@@ -1608,8 +1637,8 @@ namespace LHCb::Pr::Forward {
minIdx = SciFiHits.get_lower_bound_fast<2>( minIdx, maxIdx, xMin );
maxIdx = SciFiHits.get_lower_bound_fast<4>( minIdx, maxIdx, xMax );
direct_debug( "stereoLayer", iLayer, "betterZ =", zZone, "xShiftAtY =", xShiftAtY, "[xMin,xMax] (index) = [",
xMin, "(", minIdx, "),", xMax, "(", maxIdx, ")]" );
direct_debug( "stereoLayer", iLayer, "| betterZ =", zZone, "| xShiftAtY =", xShiftAtY,
"| [xMin,xMax] (index) = [", xMin, "(", minIdx, "),", xMax, "(", maxIdx, ")]" );
const auto tx = veloSeed.seed.tx;
const auto dSlopeDivPart = 1.f / ( zZone - veloSeed.zMag );
const auto dz = 1.e-3f * ( zZone - zReference );
@@ -1776,6 +1805,8 @@ namespace LHCb::Pr::Forward {
removeNext = nTot >= nTotNext;
return !removeNext;
} ) );
direct_debug( "------------pickUpCandidateBins------------" );
direct_debug( *this );
return m_candSize;
}
Loading