diff --git a/Rich/RichFutureKernel/include/RichFutureKernel/RichHistoBase.h b/Rich/RichFutureKernel/include/RichFutureKernel/RichHistoBase.h index 9633c2da930986ac9d70069d574fec84bdd0e5a6..e4f4fc2b4e17ccea6618dd3238705700d5d77d31 100644 --- a/Rich/RichFutureKernel/include/RichFutureKernel/RichHistoBase.h +++ b/Rich/RichFutureKernel/include/RichFutureKernel/RichHistoBase.h @@ -30,6 +30,7 @@ #include "Kernel/RichParticleIDType.h" #include "Kernel/RichRadiatorType.h" #include "Kernel/RichSide.h" +#include "RichFutureUtils/RichQuadrants.h" #include "RichUtils/RichException.h" #include "RichUtils/RichHashMap.h" #include "RichUtils/RichHistoID.h" @@ -198,6 +199,9 @@ namespace Rich::Future { template <typename HIST> using PartArray = Array<HIST, Rich::NParticleTypes, Rich::ParticleIDType>; + template <typename T> + using QuadArray = Array<T, Rich::Utils::NQuadrants, Rich::Utils::Quadrant>; + } // namespace Hist //----------------------------------------------------------------------------- diff --git a/Rich/RichFutureUtils/include/RichFutureUtils/RichQuadrants.h b/Rich/RichFutureUtils/include/RichFutureUtils/RichQuadrants.h new file mode 100644 index 0000000000000000000000000000000000000000..e6cf2ebbfc059039ef80e7b07b6110d1eacb49fe --- /dev/null +++ b/Rich/RichFutureUtils/include/RichFutureUtils/RichQuadrants.h @@ -0,0 +1,47 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2025 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +#pragma once + +#include <array> +#include <cstdint> +#include <string> + +namespace Rich::Utils { + + inline constexpr std::uint16_t NQuadrants = 4u; + + enum Quadrant : std::uint16_t { Q0 = 0, Q1, Q2, Q3 }; + + inline auto quadrants() { return std::array{ Quadrant::Q0, Quadrant::Q1, Quadrant::Q2, Quadrant::Q3 }; } + + inline std::string quadString( const Quadrant q ) { + switch ( q ) { + case Quadrant::Q0: + return " | Quadrant x>0 y>0"; + case Quadrant::Q1: + return " | Quadrant x<0 y>0"; + case Quadrant::Q2: + return " | Quadrant x>0 y<0"; + case Quadrant::Q3: + return " | Quadrant x<0 y<0"; + default: + return " | Quadrant UNDEFINED"; + } + } + + template <typename T> + inline auto quadrant( const T x, const T y ) { + return ( x > 0 ? ( y > 0 ? Quadrant::Q0 : Quadrant::Q2 ) // + : ( y > 0 ? Quadrant::Q1 : Quadrant::Q3 ) ); + } + +} // namespace Rich::Utils diff --git a/Rich/RichUtils/include/RichUtils/RichTrackSegment.h b/Rich/RichUtils/include/RichUtils/RichTrackSegment.h index 24bcefd80440042874eb7db616b833ee81c1969d..70c618a3cb7a523cd10febe03d77bef18274ba9d 100644 --- a/Rich/RichUtils/include/RichUtils/RichTrackSegment.h +++ b/Rich/RichUtils/include/RichUtils/RichTrackSegment.h @@ -361,11 +361,8 @@ namespace LHCb { theta = my_atan2<THETA_PRECISION>( perp, r.z() ); phi = my_atan2<PHI_PRECISION>( r.y(), r.x() ); // correct phi to range 0 - 2PI - // constexpr TYPE pi = TYPE( M_PI ); constexpr TYPE twopi = TYPE( 2.0 * M_PI ); - /// @todo : Fix me. Minor bug fix but will changes a lot of refs so defer to later on if ( phi < 0 ) { phi += twopi; } - // phi += pi; } else if constexpr ( LHCb::SIMD::is_SIMD_v<TYPE> ) { // SIMD version // create vector in track reference frame @@ -375,9 +372,8 @@ namespace LHCb { theta = my_atan2<THETA_PRECISION>( perp, r.z() ); phi = my_atan2<PHI_PRECISION>( r.y(), r.x() ); // correct phi to range 0 - 2PI - /// @todo : Fix me. Minor bug fix but will changes a lot of refs so defer to later on - phi( phi < TYPE::Zero() ) += TYPE( 2.0 * M_PI ); - // phi += TYPE( M_PI ); + static const TYPE twopi( 2.0 * M_PI ); + phi( phi < TYPE::Zero() ) += twopi; } else { // If get here unknown types so force compilation failure TYPE::WillFail();