Skip to content

Commit 2089405

Browse files
authored
Merge pull request #47154 from SegmentLinking/CMSSW_14_2_0_pre4_renameReduceRange
Rename reduceRange to reducePhiRange
2 parents af88c52 + 3139210 commit 2089405

File tree

22 files changed

+66
-66
lines changed

22 files changed

+66
-66
lines changed

DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,12 @@ void TrackBuildingAnalyzer::analyzeRegions(const T& regions) {
750750
}
751751
if (doAllSeedPlots || doPHI) {
752752
for (auto phi = phiMin; phi < phiMax; phi += phiBinWidth) {
753-
TrackingRegionPhi->Fill(reco::reduceRange(phi));
753+
TrackingRegionPhi->Fill(reco::reducePhiRange(phi));
754754
}
755755
}
756756
if (doAllSeedPlots || doPHIVsETA) {
757757
for (auto phi = phiMin; phi < phiMax; phi += phiBinWidth) {
758-
const auto reducedPhi = reco::reduceRange(phi);
758+
const auto reducedPhi = reco::reducePhiRange(phi);
759759
for (auto eta = etaMin; eta < etaMax; eta += etaBinWidth) {
760760
TrackingRegionPhiVsEta->Fill(eta, reducedPhi);
761761
}

DataFormats/GeometryVector/test/PhiTest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using namespace std::chrono;
1515
template <class valType>
1616
inline constexpr valType useReduceRange(valType angle) {
1717
constexpr valType twoPi = 2._pi;
18-
angle = reduceRange(angle);
18+
angle = reducePhiRange(angle);
1919
if (angle < 0.)
2020
angle += twoPi;
2121
return angle;

DataFormats/L1TParticleFlow/src/layer1_emulator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
#else
1010
namespace reco {
1111
template <typename T>
12-
inline T reduceRange(T x) {
12+
inline T reducePhiRange(T x) {
1313
T o2pi = 1. / (2. * M_PI);
1414
if (std::abs(x) <= T(M_PI))
1515
return x;
1616
T n = std::round(x * o2pi);
1717
return x - n * T(2. * M_PI);
1818
}
19-
inline double deltaPhi(double phi1, double phi2) { return reduceRange(phi1 - phi2); }
19+
inline double deltaPhi(double phi1, double phi2) { return reducePhiRange(phi1 - phi2); }
2020
} // namespace reco
2121
#endif
2222

DataFormats/Math/interface/deltaPhi.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ namespace reco {
1515

1616
// reduce to [-pi,pi]
1717
template <typename T>
18-
constexpr T reduceRange(T x) {
18+
constexpr T reducePhiRange(T x) {
1919
constexpr T o2pi = 1. / (2. * M_PI);
2020
if (std::abs(x) <= T(M_PI))
2121
return x;
2222
T n = std::round(x * o2pi);
2323
return x - n * T(2. * M_PI);
2424
}
2525

26-
constexpr double deltaPhi(double phi1, double phi2) { return reduceRange(phi1 - phi2); }
26+
constexpr double deltaPhi(double phi1, double phi2) { return reducePhiRange(phi1 - phi2); }
2727

2828
constexpr double deltaPhi(float phi1, double phi2) { return deltaPhi(static_cast<double>(phi1), phi2); }
2929

3030
constexpr double deltaPhi(double phi1, float phi2) { return deltaPhi(phi1, static_cast<double>(phi2)); }
3131

32-
constexpr float deltaPhi(float phi1, float phi2) { return reduceRange(phi1 - phi2); }
32+
constexpr float deltaPhi(float phi1, float phi2) { return reducePhiRange(phi1 - phi2); }
3333

3434
template <typename T1, typename T2>
3535
constexpr auto deltaPhi(T1 const& t1, T2 const& t2) -> decltype(deltaPhi(t1.phi(), t2.phi())) {
@@ -38,7 +38,7 @@ namespace reco {
3838

3939
template <typename T>
4040
constexpr T deltaPhi(T phi1, T phi2) {
41-
return reduceRange(phi1 - phi2);
41+
return reducePhiRange(phi1 - phi2);
4242
}
4343
} // namespace reco
4444

@@ -57,7 +57,7 @@ namespace angle0to2pi {
5757
using angle_units::operators::operator""_pi;
5858

5959
// make0To2pi constrains an angle to be >= 0 and < 2pi.
60-
// This function is a faster version of reco::reduceRange.
60+
// This function is a faster version of reco::reducePhiRange.
6161
// In timing tests, it is almost always faster than reco::reduceRange.
6262
// It also protects against floating-point value drift over repeated calculations.
6363
// This implementation uses multiplication instead of division and avoids

DataFormats/Math/interface/normalizedPhi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// return a value of phi into interval [-pi,+pi]
77
template <typename T>
88
constexpr T normalizedPhi(T phi) {
9-
return reco::reduceRange(phi);
9+
return reco::reducePhiRange(phi);
1010
}
1111

1212
// cernlib V306

DataFormats/Math/test/deltaR_t.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ inline int diff(float a, float b) {
3232
#include <vector>
3333
int main() {
3434
for (float q = -10.; q < 10.; q += 0.5)
35-
std::cout << q << ' ' << q - std::copysign(2 * M_PI, q) << ' ' << reco::reduceRange(q) << std::endl;
35+
std::cout << q << ' ' << q - std::copysign(2 * M_PI, q) << ' ' << reco::reducePhiRange(q) << std::endl;
3636

37-
std::cout << reco::reduceRange(std::sqrt(-1)) << std::endl;
37+
std::cout << reco::reducePhiRange(std::sqrt(-1)) << std::endl;
3838

3939
std::vector<Vector> vs;
4040
for (float x = -1000.; x <= 1010.; x += 100)

DataFormats/Math/test/testAtan2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
namespace {
1212
template <typename T>
1313
inline T toPhi(T phi) {
14-
return reco::reduceRange(phi);
14+
return reco::reducePhiRange(phi);
1515
}
1616

1717
template <typename T>
1818
inline T deltaPhi(T phi1, T phi2) {
19-
return reco::reduceRange(phi1 - phi2);
19+
return reco::reducePhiRange(phi1 - phi2);
2020
}
2121

2222
inline bool phiLess(float x, float y) {

HeterogeneousCore/AlpakaMath/interface/deltaPhi.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace cms::alpakatools {
77

88
// reduce to [-pi,pi]
99
template <typename TAcc, std::floating_point T>
10-
ALPAKA_FN_HOST_ACC inline T reduceRange(TAcc const& acc, T x) {
10+
ALPAKA_FN_HOST_ACC inline T reducePhiRange(TAcc const& acc, T x) {
1111
constexpr T o2pi = T{1.} / (T{2.} * std::numbers::pi_v<T>);
1212
if (alpaka::math::abs(acc, x) <= std::numbers::pi_v<T>)
1313
return x;
@@ -17,17 +17,17 @@ namespace cms::alpakatools {
1717

1818
template <typename TAcc, typename T>
1919
ALPAKA_FN_HOST_ACC inline T phi(TAcc const& acc, T x, T y) {
20-
return reduceRange(acc, std::numbers::pi_v<T> + alpaka::math::atan2(acc, -y, -x));
20+
return reducePhiRange(acc, std::numbers::pi_v<T> + alpaka::math::atan2(acc, -y, -x));
2121
}
2222

2323
template <typename TAcc, typename T>
2424
ALPAKA_FN_HOST_ACC inline T deltaPhi(TAcc const& acc, T x1, T y1, T x2, T y2) {
25-
return reduceRange(acc, alpaka::math::atan2(acc, -y2, -x2) - alpaka::math::atan2(acc, -y1, -x1));
25+
return reducePhiRange(acc, alpaka::math::atan2(acc, -y2, -x2) - alpaka::math::atan2(acc, -y1, -x1));
2626
}
2727

2828
template <typename TAcc, typename T>
2929
ALPAKA_FN_HOST_ACC inline T deltaPhi(TAcc const& acc, T phi1, T phi2) {
30-
return reduceRange(acc, phi1 - phi2);
30+
return reducePhiRange(acc, phi1 - phi2);
3131
}
3232

3333
} // namespace cms::alpakatools

L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillHistoClusters(
9292
switch (seedingSpace_) {
9393
case RPhi:
9494
x1 = sqrt(pow(clu->centreProj().x(), 2) + pow(clu->centreProj().y(), 2));
95-
x2 = reco::reduceRange(clu->phi());
95+
x2 = reco::reducePhiRange(clu->phi());
9696
break;
9797
case XY:
9898
x1 = clu->centreProj().x();

L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ void L1TCorrelatorLayer1Producer::initSectorsAndRegions(const edm::ParameterSet
647647
event_.decoded.track.clear();
648648
for (unsigned int ieta = 0, neta = 2; ieta < neta; ++ieta) {
649649
for (unsigned int iphi = 0; iphi < TF_phiSlices; ++iphi) {
650-
float phiCenter = reco::reduceRange(iphi * TF_phiWidth);
650+
float phiCenter = reco::reducePhiRange(iphi * TF_phiWidth);
651651
event_.decoded.track.emplace_back((ieta ? 0. : -2.5), (ieta ? 2.5 : 0.0), phiCenter, TF_phiWidth);
652652
event_.raw.track.emplace_back((ieta ? 0. : -2.5), (ieta ? 2.5 : 0.0), phiCenter, TF_phiWidth);
653653
}
@@ -671,7 +671,7 @@ void L1TCorrelatorLayer1Producer::initSectorsAndRegions(const edm::ParameterSet
671671
if (etaWidth > 2 * l1ct::Scales::maxAbsEta())
672672
throw cms::Exception("Configuration", "caloSectors eta range too large for eta_t data type");
673673
for (unsigned int iphi = 0; iphi < phiSlices; ++iphi) {
674-
float phiCenter = reco::reduceRange(iphi * phiWidth + phiZero);
674+
float phiCenter = reco::reducePhiRange(iphi * phiWidth + phiZero);
675675
event_.decoded.hadcalo.emplace_back(etaBoundaries[ieta], etaBoundaries[ieta + 1], phiCenter, phiWidth);
676676
event_.decoded.emcalo.emplace_back(etaBoundaries[ieta], etaBoundaries[ieta + 1], phiCenter, phiWidth);
677677
event_.raw.hgcalcluster.emplace_back(etaBoundaries[ieta], etaBoundaries[ieta + 1], phiCenter, phiWidth);
@@ -693,7 +693,7 @@ void L1TCorrelatorLayer1Producer::initSectorsAndRegions(const edm::ParameterSet
693693
float phiWidth = 2 * M_PI / phiSlices;
694694
for (unsigned int ieta = 0, neta = etaBoundaries.size() - 1; ieta < neta; ++ieta) {
695695
for (unsigned int iphi = 0; iphi < phiSlices; ++iphi) {
696-
float phiCenter = reco::reduceRange(iphi * phiWidth); //align with L1 TrackFinder phi sector indexing
696+
float phiCenter = reco::reducePhiRange(iphi * phiWidth); //align with L1 TrackFinder phi sector indexing
697697
event_.pfinputs.emplace_back(
698698
etaBoundaries[ieta], etaBoundaries[ieta + 1], phiCenter, phiWidth, etaExtra, phiExtra);
699699
}

0 commit comments

Comments
 (0)