Skip to content

Commit 73e450d

Browse files
committed
Unclutter detector layout description
1 parent 7a9af8a commit 73e450d

49 files changed

Lines changed: 443 additions & 773 deletions

Some content is hidden

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

‎Detectors/ITSMFT/ITS/workflow-ca/include/ITSCAWorkflow/PublicationAdapter.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class PublicationAdapter
8989
const auto& references = frame.getTrackClusterIndices();
9090
if (layer < 0 || !isValidTrackRange(track, static_cast<uint32_t>(references.size())) ||
9191
track.firstClusterRef == track.clusterRefEnd ||
92-
static_cast<std::size_t>(layer) >= frame.getLayout().size()) {
92+
static_cast<std::size_t>(layer) >= frame.getDetectorConfiguration().size()) {
9393
return std::nullopt;
9494
}
9595
const auto& reference = references[track.firstClusterRef];

‎Detectors/ITSMFT/ITS/workflow-ca/src/CATrackerSpec.cxx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void CATrackerDPL::addTruthSeedingVertices(const o2::InteractionRecord& origin,
300300

301301
void CATrackerDPL::configureROFViews(gsl::span<const o2::itsmft::ROFRecord> rofs)
302302
{
303-
const auto& detector = mTracker->getDetectorConfiguration();
303+
const auto& detector = mSession.frame.getDetectorConfiguration();
304304
const auto& alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
305305
const int nOrbitsPerTF = o2::base::GRPGeomHelper::getNHBFPerTF();
306306
const auto timings = mSession.layerTimings(alpParams, nOrbitsPerTF, detector.addTimeError);
@@ -328,9 +328,9 @@ void CATrackerDPL::initialiseTracking()
328328

329329
const auto maxMemory = plan.execution.MaxMemory;
330330
o2::itsmft::tracking::TrackerInitialization configuration{
331-
.catalog = {o2::itsmft::tracking::kITSStaticSurfaceCatalog.data(),
332-
static_cast<uint32_t>(o2::itsmft::tracking::kITSStaticSurfaceCatalog.size())},
333-
.layout = o2::itsmft::tracking::makeDetectorLayout(o2::itsmft::tracking::LayerMask{commonParams.holeLayerMask}),
331+
.catalog = {o2::itsmft::tracking::kITSSurfaces.data(),
332+
static_cast<uint32_t>(o2::itsmft::tracking::kITSSurfaces.size())},
333+
.holeLayers = o2::itsmft::tracking::LayerMask{commonParams.holeLayerMask},
334334
.plan = std::move(plan),
335335
.memoryPool = std::make_shared<o2::itsmft::tracking::BoundedMemoryResource>(maxMemory)};
336336

‎Detectors/ITSMFT/MFT/workflow/src/CATrackerSpec.cxx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ CATrackerDPL::CATrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr, ca::Tra
240240
void CATrackerDPL::configureROFViews(gsl::span<const o2::itsmft::ROFRecord> rofs,
241241
gsl::span<const o2::dataformats::IRFrame> irFrames)
242242
{
243-
const auto& detector = mTracker->getDetectorConfiguration();
243+
const auto& detector = mSession.frame.getDetectorConfiguration();
244244
const auto& alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::MFT>::Instance();
245245
const bool continuous = o2::base::GRPGeomHelper::instance().getGRPECS()->isDetContinuousReadOut(o2::detectors::DetID::MFT);
246246
mMFTROFrameLengthInBC = continuous ? alpParams.roFrameLengthInBC : std::max(1, static_cast<int>(alpParams.roFrameLengthTrig / (o2::constants::lhc::LHCBunchSpacingNS * 1e3)));
@@ -272,9 +272,9 @@ void CATrackerDPL::initialiseTracking()
272272

273273
const auto maxMemory = plan.execution.MaxMemory;
274274
o2::itsmft::tracking::TrackerInitialization configuration{
275-
.catalog = {o2::itsmft::tracking::kMFTStaticSurfaceCatalog.data(),
276-
static_cast<uint32_t>(o2::itsmft::tracking::kMFTStaticSurfaceCatalog.size())},
277-
.layout = o2::itsmft::tracking::makeDetectorLayout(o2::itsmft::tracking::LayerMask{trackerParams.holeLayerMask}),
275+
.catalog = {o2::itsmft::tracking::kMFTSurfaces.data(),
276+
static_cast<uint32_t>(o2::itsmft::tracking::kMFTSurfaces.size())},
277+
.holeLayers = o2::itsmft::tracking::LayerMask{trackerParams.holeLayerMask},
278278
.plan = std::move(plan),
279279
.memoryPool = std::make_shared<o2::itsmft::tracking::BoundedMemoryResource>(maxMemory)};
280280

‎Detectors/ITSMFT/common/tracking/include/ITSMFTTracking/Cell.h‎

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ struct CellClusterReference {
4545
};
4646

4747
/// Common non-`SurfaceKind`-templated CA cell/geometric-triplet value.
48-
/// A CellSeed deliberately has no kinematic state or fit chi2; those first
48+
/// A Triplet deliberately has no kinematic state or fit chi2; those first
4949
/// exist after TrackerTraits materializes a TrackSeed.
50-
class CellSeed final
50+
class Triplet final
5151
{
5252
public:
53-
GPUhdDefault() CellSeed() = default;
54-
GPUhd() CellSeed(int innerL, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::its::TimeEstBC& time)
55-
: CellSeed(LayerMask(innerL, innerL + 1, innerL + 2), cl0, cl1, cl2, trkl0, trkl1, time)
53+
GPUhdDefault() Triplet() = default;
54+
GPUhd() Triplet(int innerL, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::its::TimeEstBC& time)
55+
: Triplet(LayerMask(innerL, innerL + 1, innerL + 2), cl0, cl1, cl2, trkl0, trkl1, time)
5656
{
5757
}
58-
GPUhd() CellSeed(LayerMask hitLayerMask, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::its::TimeEstBC& time)
58+
GPUhd() Triplet(LayerMask hitLayerMask, int cl0, int cl1, int cl2, int trkl0, int trkl1, const o2::its::TimeEstBC& time)
5959
: mLevel(1), mTime(time)
6060
{
6161
setHitLayerMask(hitLayerMask);
@@ -66,11 +66,11 @@ class CellSeed final
6666
setFirstTrackletIndex(trkl0);
6767
setSecondTrackletIndex(trkl1);
6868
}
69-
GPUhdDefault() CellSeed(const CellSeed&) = default;
70-
GPUhdDefault() ~CellSeed() = default;
71-
GPUhdDefault() CellSeed(CellSeed&&) = default;
72-
GPUhdDefault() CellSeed& operator=(const CellSeed&) = default;
73-
GPUhdDefault() CellSeed& operator=(CellSeed&&) = default;
69+
GPUhdDefault() Triplet(const Triplet&) = default;
70+
GPUhdDefault() ~Triplet() = default;
71+
GPUhdDefault() Triplet(Triplet&&) = default;
72+
GPUhdDefault() Triplet& operator=(const Triplet&) = default;
73+
GPUhdDefault() Triplet& operator=(Triplet&&) = default;
7474

7575
GPUhd() LayerMask getHitLayerMask() const { return LayerMask{mHitLayerMask}; }
7676
GPUhd() void setHitLayerMask(LayerMask mask) { mHitLayerMask = mask.value(); }
@@ -121,8 +121,6 @@ class CellSeed final
121121
TripletFitFactor mTripletFactor{};
122122
};
123123

124-
static_assert(std::is_trivially_copyable_v<CellSeed>);
125-
126124
/// GPU-portable, non-templated whole-track seed with one cluster slot per
127125
/// adopted-plan position. Fixed MaxLayoutSurfaces capacity is required for
128126
/// device use, where heap allocation is unavailable.
@@ -141,8 +139,8 @@ class TrackSeed final
141139
GPUhdDefault() TrackSeed& operator=(const TrackSeed&) = default;
142140
GPUhdDefault() TrackSeed& operator=(TrackSeed&&) = default;
143141

144-
// CellSeed's hit mask is positional in the same fixed-capacity domain.
145-
GPUhd() TrackSeed(const CellSeed& cs, const SurfaceTrackState& state, float chi2)
142+
// Triplet's hit mask is positional in the same fixed-capacity domain.
143+
GPUhd() TrackSeed(const Triplet& cs, const SurfaceTrackState& state, float chi2)
146144
: mState(state), mChi2(chi2), mLevel(cs.getLevel()), mTracklets{cs.getFirstTrackletIndex(), cs.getSecondTrackletIndex()}, mTime(cs.getTimeStamp())
147145
{
148146
const auto hitMask = cs.getHitLayerMask();
@@ -226,10 +224,6 @@ class TrackSeed final
226224
o2::its::TimeEstBC mTime;
227225
};
228226

229-
// TrackSeed crosses the host/device boundary by value. TimeEstBC prevents a
230-
// standard-layout assertion; trivially copyable is the required property.
231-
static_assert(std::is_trivially_copyable_v<TrackSeed>);
232-
233227
} // namespace o2::itsmft::tracking
234228

235229
#endif /* ALICEO2_ITSMFT_TRACKING_INCLUDE_CACELL_H_ */

‎Detectors/ITSMFT/common/tracking/include/ITSMFTTracking/Configuration.h‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@ enum class IterationStep : uint16_t {
6060
};
6161
using IterationSteps = o2::utils::EnumFlags<IterationStep>;
6262

63-
static_assert(sizeof(IterationStep) == sizeof(uint16_t));
64-
static_assert(sizeof(IterationSteps) == sizeof(uint16_t));
65-
static_assert(static_cast<uint16_t>(IterationStep::FirstPass) == 0);
66-
static_assert(static_cast<uint16_t>(IterationStep::RebuildClusterLUT) == 1);
67-
static_assert(static_cast<uint16_t>(IterationStep::UseUPCMask) == 2);
68-
static_assert(static_cast<uint16_t>(IterationStep::SelectUPCVertices) == 3);
69-
static_assert(static_cast<uint16_t>(IterationStep::ResetVertices) == 4);
70-
static_assert(static_cast<uint16_t>(IterationStep::SkipROFsAboveThreshold) == 5);
71-
static_assert(static_cast<uint16_t>(IterationStep::MarkVerticesAsUPC) == 6);
72-
static_assert(static_cast<uint16_t>(IterationStep::TrackFollowerTop) == 7);
73-
static_assert(static_cast<uint16_t>(IterationStep::TrackFollowerBot) == 8);
74-
7563
// Time-frame execution policy, invariant across tracking passes. Thread
7664
// scheduling remains in the workflow's resolved TrackerOptions.
7765
struct TrackingExecutionPolicy {
@@ -161,7 +149,6 @@ struct DetectorParameters {
161149
std::vector<float> LayerColHalfExtent{}; // Legacy PhiZ helper extent (cm); production lookup uses descriptor chartRange.
162150
float IndexRowMin{0.f}; // Reserved legacy bound; production phi lookup starts at 0.
163151
float IndexRowMax{0.f}; // Reserved legacy bound; production phi lookup ends at TwoPI.
164-
std::vector<float> LayerRadii = {2.33959f, 3.14076f, 3.91924f, 19.6213f, 24.5597f, 34.388f, 39.3329f};
165152
std::vector<float> LayerResolution = {5.e-4f, 5.e-4f, 5.e-4f, 5.e-4f, 5.e-4f, 5.e-4f, 5.e-4f};
166153
std::vector<float> SystError2Row = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; // Systematic row error squared per layer (ALPIDE X).
167154
std::vector<float> SystError2Col = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; // Systematic column error squared per layer (ALPIDE Z).

Detectors/ITSMFT/common/tracking/include/ITSMFTTracking/DetectorLayout.h renamed to Detectors/ITSMFT/common/tracking/include/ITSMFTTracking/DetectorConfiguration.h

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,46 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#ifndef ALICEO2_ITSMFT_TRACKING_DETECTORLAYOUT_H_
13-
#define ALICEO2_ITSMFT_TRACKING_DETECTORLAYOUT_H_
12+
#ifndef ALICEO2_ITSMFT_TRACKING_DETECTORCONFIGURATION_H_
13+
#define ALICEO2_ITSMFT_TRACKING_DETECTORCONFIGURATION_H_
1414

1515
#include <algorithm>
1616
#include <cstdint>
17+
#include <utility>
1718
#include <vector>
1819

1920
#include <gsl/span>
2021

2122
#include "ITSMFTTracking/SurfaceDescriptor.h"
2223
#include "ITSMFTTracking/LayerMask.h"
24+
#include "ITSMFTTracking/IndexTableConfigurationSet.h"
2325

2426
namespace o2::itsmft::tracking
2527
{
2628

27-
enum class DetectorLayoutError : uint8_t {
29+
enum class DetectorConfigurationError : uint8_t {
2830
None,
2931
EmptyCatalog,
3032
TooManySurfaces,
3133
InvalidComponentBoundary,
3234
HoleLayersOutsideLayout
3335
};
3436

35-
struct DetectorLayoutDefinition {
36-
// First position of each component. Position zero is always required.
37-
std::vector<uint16_t> componentOffsets{0};
38-
LayerMask holeLayers{};
39-
};
40-
41-
inline DetectorLayoutDefinition makeDetectorLayout(LayerMask holeLayers = {})
42-
{
43-
DetectorLayoutDefinition definition;
44-
definition.holeLayers = holeLayers;
45-
return definition;
46-
}
47-
48-
// Immutable detector layout. LayerId is exactly the dense position of a layer
49-
// descriptor in this container. Iteration-expanded topology belongs to the
50-
// Tracker's IterationConfiguration; this type intentionally owns no edges,
51-
// paths, adjacency, schedules, or mutable pass state.
52-
class DetectorLayout
37+
// TimeFrame-owned detector geometry and prepared settings, shared by every
38+
// iteration. LayerId is the dense descriptor position. SurfaceCatalogView
39+
// borrows only the geometry; iteration topology and event state live elsewhere.
40+
class DetectorConfiguration
5341
{
5442
public:
55-
DetectorLayout() = default;
56-
DetectorLayout(gsl::span<const SurfaceDescriptor> layers, DetectorLayoutDefinition definition = {})
57-
: mLayers{layers.begin(), layers.end()}, mComponentOffsets{std::move(definition.componentOffsets)}, mHoleLayers{definition.holeLayers}
43+
DetectorConfiguration() = default;
44+
DetectorConfiguration(gsl::span<const SurfaceDescriptor> layers, std::vector<uint16_t> componentOffsets = {0}, LayerMask holeLayers = {})
45+
: mLayers{layers.begin(), layers.end()}, mComponentOffsets{std::move(componentOffsets)}, mHoleLayers{holeLayers}
5846
{
5947
validate();
6048
}
6149

62-
bool valid() const noexcept { return mError == DetectorLayoutError::None; }
63-
DetectorLayoutError getError() const noexcept { return mError; }
50+
bool valid() const noexcept { return mError == DetectorConfigurationError::None; }
51+
DetectorConfigurationError getError() const noexcept { return mError; }
6452
bool empty() const noexcept { return mLayers.empty(); }
6553
std::size_t size() const noexcept { return mLayers.size(); }
6654
gsl::span<const SurfaceDescriptor> getLayers() const noexcept { return mLayers; }
@@ -69,6 +57,14 @@ class DetectorLayout
6957
LayerMask getHoleLayers() const noexcept { return mHoleLayers; }
7058
SurfaceCatalogView getSurfaceCatalog() const noexcept { return {mLayers.data(), static_cast<uint32_t>(mLayers.size())}; }
7159

60+
// Cylinders have one radius; disks use the midpoint of their radial chart.
61+
float getRepresentativeRadius(LayerId id) const
62+
{
63+
const auto& surface = (*this)[id];
64+
return surface.kind == SurfaceKind::Cylinder ? surface.referenceCoordinate
65+
: 0.5f * (surface.chartRange.min + surface.chartRange.max);
66+
}
67+
7268
bool sameComponent(uint16_t first, uint16_t second) const noexcept
7369
{
7470
if (first >= mLayers.size() || second >= mLayers.size()) {
@@ -80,34 +76,42 @@ class DetectorLayout
8076
return component(first) == component(second);
8177
}
8278

79+
// Prepared once by Tracker before the configuration is installed in a frame.
80+
IndexTableConfigurationSet indexTableConfigs;
81+
std::vector<float> positionResolutions;
82+
std::vector<uint32_t> addTimeError;
83+
std::vector<float> layerResolution;
84+
std::vector<float> systError2Row;
85+
std::vector<float> systError2Col;
86+
8387
private:
8488
void validate() noexcept
8589
{
8690
if (mLayers.empty()) {
87-
mError = DetectorLayoutError::EmptyCatalog;
91+
mError = DetectorConfigurationError::EmptyCatalog;
8892
return;
8993
}
9094
if (mLayers.size() > MaxLayoutSurfaces) {
91-
mError = DetectorLayoutError::TooManySurfaces;
95+
mError = DetectorConfigurationError::TooManySurfaces;
9296
return;
9397
}
9498
if (mComponentOffsets.empty() || mComponentOffsets.front() != 0 || mComponentOffsets.back() >= mLayers.size() ||
9599
!std::is_sorted(mComponentOffsets.begin(), mComponentOffsets.end()) ||
96100
std::adjacent_find(mComponentOffsets.begin(), mComponentOffsets.end()) != mComponentOffsets.end()) {
97-
mError = DetectorLayoutError::InvalidComponentBoundary;
101+
mError = DetectorConfigurationError::InvalidComponentBoundary;
98102
return;
99103
}
100104
if (!mHoleLayers.isSubsetOf(LayerMask::span(0, static_cast<int>(mLayers.size()) - 1))) {
101-
mError = DetectorLayoutError::HoleLayersOutsideLayout;
105+
mError = DetectorConfigurationError::HoleLayersOutsideLayout;
102106
return;
103107
}
104-
mError = DetectorLayoutError::None;
108+
mError = DetectorConfigurationError::None;
105109
}
106110

107111
std::vector<SurfaceDescriptor> mLayers;
108112
std::vector<uint16_t> mComponentOffsets;
109113
LayerMask mHoleLayers{};
110-
DetectorLayoutError mError{DetectorLayoutError::EmptyCatalog};
114+
DetectorConfigurationError mError{DetectorConfigurationError::EmptyCatalog};
111115
};
112116

113117
} // namespace o2::itsmft::tracking

‎Detectors/ITSMFT/common/tracking/include/ITSMFTTracking/GenericTrack.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ struct TrackClusterReference {
4040
GPUhdi() bool isValid() const noexcept { return layer.isValid() && clusterId != std::numeric_limits<uint32_t>::max(); }
4141
};
4242

43-
static_assert(std::is_standard_layout_v<TrackClusterReference>);
44-
static_assert(std::is_trivially_copyable_v<TrackClusterReference>);
45-
static_assert(sizeof(TrackClusterReference) == 8);
46-
static_assert(alignof(TrackClusterReference) == 4);
47-
static_assert(offsetof(TrackClusterReference, layer) == 0);
48-
static_assert(offsetof(TrackClusterReference, clusterId) == 4);
49-
5043
// Frame-owned result; [firstClusterRef, clusterRefEnd) is inner-to-outer and
5144
// valid only with the same normalized event.
5245
struct GenericTrack {

‎Detectors/ITSMFT/common/tracking/include/ITSMFTTracking/GlobalMeasurement.h‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,6 @@ struct GlobalMeasurement {
6767
GPUhdi() bool hasValidClusterId() const noexcept { return clusterId != std::numeric_limits<uint32_t>::max(); }
6868
};
6969

70-
#define O2_ITSMFT_ASSERT_GLOBAL_TYPE(Type, Size) \
71-
static_assert(std::is_standard_layout_v<Type>); \
72-
static_assert(std::is_trivially_copyable_v<Type>); \
73-
static_assert(sizeof(Type) == Size)
74-
75-
O2_ITSMFT_ASSERT_GLOBAL_TYPE(GlobalMeasurement, 48);
76-
O2_ITSMFT_ASSERT_GLOBAL_TYPE(GlobalPoint3F, 12);
77-
O2_ITSMFT_ASSERT_GLOBAL_TYPE(GlobalCovariance3F, 24);
78-
79-
#undef O2_ITSMFT_ASSERT_GLOBAL_TYPE
80-
81-
static_assert(alignof(GlobalMeasurement) == 4);
82-
static_assert(offsetof(GlobalMeasurement, x) == 0);
83-
static_assert(offsetof(GlobalMeasurement, covariance) == 12);
84-
static_assert(offsetof(GlobalMeasurement, radius) == 36);
85-
static_assert(offsetof(GlobalMeasurement, phi) == 40);
86-
static_assert(offsetof(GlobalMeasurement, clusterId) == 44);
87-
8870
} // namespace o2::itsmft::tracking
8971

9072
#endif // ALICEO2_ITSMFT_TRACKING_GLOBALMEASUREMENT_H_

0 commit comments

Comments
 (0)