Skip to content

Commit b84fdbd

Browse files
authored
Merge branch 'AliceO2Group:dev' into new-detector4
2 parents b1ca536 + 1cfbc1d commit b84fdbd

File tree

41 files changed

+675
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+675
-288
lines changed

Common/DCAFitter/include/DCAFitter/HelixHelper.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ struct CrossInfo {
6363
{
6464
const auto& trcA = trax0.rC > trax1.rC ? trax0 : trax1; // designate the largest circle as A
6565
const auto& trcB = trax0.rC > trax1.rC ? trax1 : trax0;
66+
nDCA = 0;
6667
float xDist = trcB.xC - trcA.xC, yDist = trcB.yC - trcA.yC;
6768
float dist2 = xDist * xDist + yDist * yDist, dist = o2::gpu::GPUCommonMath::Sqrt(dist2), rsum = trcA.rC + trcB.rC;
68-
if (o2::gpu::GPUCommonMath::Sqrt(dist) < 1e-12) {
69+
if (dist < 1e-12) {
6970
return nDCA; // circles are concentric?
7071
}
7172
if (dist > rsum) { // circles don't touch, chose a point in between
@@ -75,9 +76,13 @@ struct CrossInfo {
7576
return nDCA;
7677
}
7778
notTouchingXY(dist, xDist, yDist, trcA, trcB.rC, isCollinear);
78-
} else if (dist + trcB.rC < trcA.rC) { // the small circle is nestled into large one w/o touching
79-
// select the point of closest approach of 2 circles
80-
notTouchingXY(dist, xDist, yDist, trcA, -trcB.rC, isCollinear);
79+
} else if (auto dfr = dist + trcB.rC - trcA.rC; dfr < 0.) { // the small circle is nestled into large one w/o touching
80+
if (dfr > -maxDistXY) {
81+
// select the point of closest approach of 2 circles
82+
notTouchingXY(dist, xDist, yDist, trcA, -trcB.rC, isCollinear);
83+
} else {
84+
return nDCA;
85+
}
8186
} else { // 2 intersection points
8287
if (isCollinear) {
8388
/// collinear tracks, e.g. electrons from photon conversion
@@ -89,7 +94,7 @@ struct CrossInfo {
8994
xDCA[0] = r2_r * trcA.xC + r1_r * trcB.xC;
9095
yDCA[0] = r2_r * trcA.yC + r1_r * trcB.yC;
9196
nDCA = 1;
92-
} else if (o2::gpu::GPUCommonMath::Sqrt(xDist) < o2::gpu::GPUCommonMath::Sqrt(yDist)) {
97+
} else if (o2::gpu::GPUCommonMath::Abs(xDist) < o2::gpu::GPUCommonMath::Abs(yDist)) {
9398
// to simplify calculations, we move to new frame x->x+Xc0, y->y+Yc0, so that
9499
// the 1st one is centered in origin
95100
float a = (trcA.rC * trcA.rC - trcB.rC * trcB.rC + dist2) / (2. * yDist), b = -xDist / yDist, ab = a * b, bb = b * b;
@@ -167,7 +172,7 @@ struct CrossInfo {
167172
/// yL(t) = yL + t Ky; Ky = (sinAlp + cosAlp* snp/csp)
168173
/// zL(t) = zL + t Kz; Kz = tgl / csp
169174
/// Note that Kx^2 + Ky^2 + Kz^2 = (1+tgl^2) / csp^2
170-
175+
nDCA = 0;
171176
float dx = trax1.xC - trax0.xC; // for straight line TrackAuxPar stores lab coordinates at referene point!!!
172177
float dy = trax1.yC - trax0.yC; //
173178
float dz = tr1.getZ() - tr0.getZ();

Common/Utils/include/CommonUtils/EnumFlags.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ struct FlagsHelper final {
160160
static constexpr auto Max_v{Values.back()}; // Enum last entry
161161
static constexpr auto Min_u_v{static_cast<size_t>(Min_v)}; // Enum first entry as size_t
162162
static constexpr auto Max_u_v{static_cast<size_t>(Max_v)}; // Enum last entry as size_t
163-
static constexpr bool isContinuous() noexcept { return (Max_u_v - Min_u_v + 1) == count(); } // Is the enum continuous
164-
static constexpr auto MaxRep{((1 << (Max_u_v - Min_u_v + 1)) - 1) << Min_u_v}; // largest representable value
163+
static_assert(Max_u_v < std::numeric_limits<U>::digits, "Max Bit is beyond allow range defered from underlying type");
164+
static constexpr bool isContinuous() noexcept { return (Max_u_v - Min_u_v + 1) == count(); } // Is the enum continuous
165+
static constexpr auto MaxRep{((1ULL << (static_cast<unsigned long long>(Max_u_v - Min_u_v) + 1ULL)) - 1ULL) << Min_u_v}; // largest representable value
165166

166167
template <E e>
167168
static constexpr std::string_view getName()

Common/Utils/test/testEnumFlags.cxx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,46 @@ enum class TestEnum : uint8_t {
2828
Bit5VeryLongName,
2929
};
3030

31+
// Very long enum
32+
// to test that it works beyond 32 bits
33+
enum class TestEnumLong : uint64_t {
34+
Bit1,
35+
Bit2,
36+
Bit3,
37+
Bit4,
38+
Bit5,
39+
Bit6,
40+
Bit7,
41+
Bit8,
42+
Bit9,
43+
Bit10,
44+
Bit11,
45+
Bit12,
46+
Bit13,
47+
Bit14,
48+
Bit15,
49+
Bit16,
50+
Bit17,
51+
Bit18,
52+
Bit19,
53+
Bit20,
54+
Bit21,
55+
Bit22,
56+
Bit23,
57+
Bit24,
58+
Bit25,
59+
Bit26,
60+
Bit27,
61+
Bit28,
62+
Bit29,
63+
Bit30,
64+
Bit31,
65+
Bit32,
66+
Bit33,
67+
Bit34,
68+
// ...
69+
};
70+
3171
BOOST_AUTO_TEST_CASE(Flags_test)
3272
{
3373
using EFlags = o2::utils::EnumFlags<TestEnum>;
@@ -257,4 +297,11 @@ BOOST_AUTO_TEST_CASE(Flags_test)
257297
EFlags flags3{TestEnum::Bit4};
258298
BOOST_CHECK(!flags1.contains(flags3)); // flags1 does not contain flags3
259299
}
300+
301+
{
302+
// Test compilation using an enum with more than 32 bits
303+
o2::utils::EnumFlags<TestEnumLong> test;
304+
test.set("Bit32");
305+
BOOST_CHECK(test.test(TestEnumLong::Bit32));
306+
}
260307
}

Detectors/CTF/test/test_ctf_io_cpv.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <TRandom.h>
2929
#include <TStopwatch.h>
3030
#include <TSystem.h>
31+
#include <TMath.h>
3132
#include <cstring>
3233

3334
using namespace o2::cpv;

0 commit comments

Comments
 (0)