Skip to content

Commit 4f6ce7d

Browse files
committed
ITS
1 parent c359630 commit 4f6ce7d

File tree

5 files changed

+207
-79
lines changed

5 files changed

+207
-79
lines changed

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Definitions.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,25 @@
1717

1818
#include <type_traits>
1919
#include <cstdint>
20+
#include <tuple>
21+
22+
#include "SimulationDataFormat/MCCompLabel.h"
2023
#include "CommonDataFormat/TimeStamp.h"
2124
#include "ReconstructionDataFormats/Vertex.h"
2225

2326
namespace o2::its
2427
{
2528

29+
template <bool IsConst, typename T>
30+
using maybe_const = std::conditional_t<IsConst, const T, T>;
31+
2632
// Time estimates are given in BC
2733
// error needs to cover maximum 1 orbit
2834
// this is an asymmetric error defining an interval [time, time+error)
2935
using TimeEstBC = o2::dataformats::TimeStampWithError<uint32_t, uint16_t>;
3036
using Vertex = o2::dataformats::Vertex<TimeEstBC>;
31-
32-
template <bool IsConst, typename T>
33-
using maybe_const = std::conditional_t<IsConst, const T, T>;
37+
// MC vertex label with purity
38+
using VertexLabel = std::pair<o2::MCCompLabel, float>;
3439

3540
// simple implemnetion of logging with exp. backoff
3641
struct LogLogThrottler {

Detectors/ITSMFT/ITS/tracking/include/ITStracking/MathUtils.h

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,18 @@ GPUhdi() constexpr float getNormalizedPhi(float phi)
4242
}
4343

4444
GPUhdi() float computeCurvature(float x1, float y1, float x2, float y2, float x3, float y3)
45-
{
46-
// in case the triangle is degenerate we return infinite curvature.
47-
const float d = (x2 - x1) * (y3 - y2) - (x3 - x2) * (y2 - y1);
48-
if (o2::gpu::CAMath::Abs(d) < o2::its::constants::Tolerance) {
49-
return 0.f;
50-
}
51-
const float a =
52-
0.5f * ((y3 - y2) * (y2 * y2 - y1 * y1 + x2 * x2 - x1 * x1) - (y2 - y1) * (y3 * y3 - y2 * y2 + x3 * x3 - x2 * x2));
53-
const float b =
54-
0.5f * ((x2 - x1) * (y3 * y3 - y2 * y2 + x3 * x3 - x2 * x2) - (x3 - x2) * (y2 * y2 - y1 * y1 + x2 * x2 - x1 * x1));
55-
const float den = o2::gpu::CAMath::Hypot(d * x1 - a, d * y1 - b);
56-
if (den < o2::its::constants::Tolerance) {
57-
return 0.f;
45+
{ // in case the triangle is degenerate we return infinite curvature.
46+
const float area = ((x2 - x1) * (y3 - y1)) - ((x3 - x1) * (y2 - y1));
47+
if (o2::gpu::CAMath::Abs(area) < constants::Tolerance) {
48+
return o2::constants::math::VeryBig;
5849
}
59-
return -d / den;
50+
const float dx1 = x2 - x1, dy1 = y2 - y1;
51+
const float dx2 = x3 - x2, dy2 = y3 - y2;
52+
const float dx3 = x1 - x3, dy3 = y1 - y3;
53+
const float d1 = o2::gpu::CAMath::Sqrt((dx1 * dx1) + (dy1 * dy1));
54+
const float d2 = o2::gpu::CAMath::Sqrt((dx2 * dx2) + (dy2 * dy2));
55+
const float d3 = o2::gpu::CAMath::Sqrt((dx3 * dx3) + (dy3 * dy3));
56+
return -2.f * area / (d1 * d2 * d3);
6057
}
6158

6259
GPUhdi() float computeCurvatureCentreX(float x1, float y1, float x2, float y2, float x3, float y3)
@@ -91,12 +88,12 @@ GPUhdi() float smallestAngleDifference(float a, float b)
9188
return o2::gpu::CAMath::Remainderf(b - a, o2::constants::math::TwoPI);
9289
}
9390

94-
GPUhdi() float Sq(float v)
91+
GPUhdi() constexpr float Sq(float v)
9592
{
9693
return v * v;
9794
}
9895

99-
GPUhdi() float SqDiff(float x, float y)
96+
GPUhdi() constexpr float SqDiff(float x, float y)
10097
{
10198
return Sq(x - y);
10299
}

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TimeFrame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct TimeFrame {
8686
gsl::span<const std::array<float, 2>> getPrimaryVerticesXAlpha(int layer, int rofId) const;
8787
void fillPrimaryVerticesXandAlpha();
8888
void addPrimaryVertex(const Vertex& vertex) { mPrimaryVertices.emplace_back(vertex); }
89-
void addPrimaryVertexLabel(std::pair<MCCompLabel, float>& label) { mPrimaryVerticesLabels.push_back(label); }
89+
void addPrimaryVertexLabel(const VertexLabel& label) { mPrimaryVerticesLabels.push_back(label); }
9090

9191
int loadROFrameData(const o2::itsmft::ROFRecord& rof, gsl::span<const itsmft::Cluster> clusters,
9292
const dataformats::MCTruthContainer<MCCompLabel>* mcLabels = nullptr);
@@ -276,7 +276,7 @@ struct TimeFrame {
276276
int mNExtendedTracks{0};
277277
int mNExtendedUsedClusters{0};
278278
bounded_vector<Vertex> mPrimaryVertices;
279-
bounded_vector<std::pair<MCCompLabel, float>> mPrimaryVerticesLabels;
279+
bounded_vector<VertexLabel> mPrimaryVerticesLabels;
280280

281281
std::array<bounded_vector<Cluster>, NLayers> mUnsortedClusters;
282282
std::vector<bounded_vector<Tracklet>> mTracklets;

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class TrackerTraits
110110

111111
// Debug output
112112
inline void debugComputeLayerTracklets(int iteration, int layer, const Cluster& currentCls, const Cluster& nextCls, const Vertex& pv, float sigmaZ, float sigmaPhi, bool accepted);
113-
inline void debugComputeLayerCells(int iteration, int layer, int currentTrkl, int nextTrkl, bool accepted);
113+
inline void debugComputeLayerCells(int iteration, int layer, int currentTrkl, int nextTrkl);
114114
inline void debugFindCellsNeighbours(int iteration, int layer, int currentCell, int nextCell, bool accepted);
115115

116116
std::shared_ptr<BoundedMemoryResource> mMemoryPool;

0 commit comments

Comments
 (0)