Skip to content

Commit 19b171d

Browse files
committed
dd ACTS tracker
1 parent be71b85 commit 19b171d

10 files changed

Lines changed: 2262 additions & 196 deletions

File tree

‎Detectors/Upgrades/ALICE3/GlobalReconstruction/reconstruction/CMakeLists.txt‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010
# or submit itself to any jurisdiction.
1111

1212
if(Acts_FOUND)
13-
set(actsTarget Acts::Core)
13+
set(actsSources src/TrackerACTS.cxx)
14+
set(actsTarget
15+
Acts::Core
16+
O2::ACTSInterface
17+
O2::ALICE3ACTS
18+
ROOT::Tree
19+
ROOT::RIO)
1420
endif()
1521

1622
o2_add_library(ALICE3GlobalReconstruction
1723
TARGETVARNAME targetName
18-
SOURCES src/TimeFrame.cxx
24+
SOURCES src/TimeFrame.cxx ${actsSources}
1925
PUBLIC_LINK_LIBRARIES
2026
O2::ITStracking
2127
O2::GPUCommon

‎Detectors/Upgrades/ALICE3/GlobalReconstruction/reconstruction/include/ALICE3GlobalReconstruction/TimeFrameMixin.h‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ class TimeFrameMixin : public Base
7171
void deriveAndInitTiming(const std::array<gsl::span<const o2::trkft3::ROFRecord>, nLayers>& layerROFs);
7272

7373
const o2::InteractionRecord& getTFAnchorIR() const noexcept { return mTFAnchorIR; }
74+
const auto& getClusterSensorIDs() const noexcept { return mClusterSensorIDs; }
7475

7576
protected:
7677
void initTimingTables(const std::array<o2::its::LayerTiming, nLayers>& timings);
7778
void updateHostROFVertexLookupTable();
78-
79+
std::array<std::vector<int>, nLayers> mClusterSensorIDs;
7980
bool mTimingTablesInitialised{false};
8081
o2::InteractionRecord mTFAnchorIR{0, 0};
8182
};
@@ -205,6 +206,7 @@ int TimeFrameMixin<nLayers, Base>::loadROFsFromHitTree(TTree* hitsTree, Geometry
205206
this->mUnsortedClusters[iLayer].clear();
206207
this->mTrackingFrameInfo[iLayer].clear();
207208
this->mClusterExternalIndices[iLayer].clear();
209+
mClusterSensorIDs[iLayer].clear();
208210
this->mClusterSize[iLayer].clear();
209211
}
210212

@@ -228,6 +230,7 @@ int TimeFrameMixin<nLayers, Base>::loadROFsFromHitTree(TTree* hitsTree, Geometry
228230
this->mUnsortedClusters[iLayer].reserve(clusterCountPerLayer[iLayer]);
229231
this->mTrackingFrameInfo[iLayer].reserve(clusterCountPerLayer[iLayer]);
230232
this->mClusterExternalIndices[iLayer].reserve(clusterCountPerLayer[iLayer]);
233+
mClusterSensorIDs[iLayer].reserve(clusterCountPerLayer[iLayer]);
231234
this->mClusterSize[iLayer].reserve(clusterCountPerLayer[iLayer]);
232235
}
233236

@@ -294,6 +297,7 @@ int TimeFrameMixin<nLayers, Base>::loadROFsFromHitTree(TTree* hitsTree, Geometry
294297
std::array<float, 2>{trkXYZ.y(), trkXYZ.z()},
295298
std::array<float, 3>{resolution[layer] * resolution[layer], 0., resolution[layer] * resolution[layer]});
296299
this->addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), this->mUnsortedClusters[layer].size());
300+
mClusterSensorIDs[layer].push_back(hit.GetDetectorID());
297301
const int layerHitCounter = hitCounterPerLayer[layer]++;
298302
this->addClusterExternalIndexToLayer(layer, layerHitCounter);
299303
this->mClusterSize[layer].push_back(1);
@@ -344,10 +348,12 @@ int TimeFrameMixin<nLayers, Base>::loadROFrameData(const std::array<gsl::span<co
344348
this->mUnsortedClusters[iLayer].clear();
345349
this->mTrackingFrameInfo[iLayer].clear();
346350
this->mClusterExternalIndices[iLayer].clear();
351+
mClusterSensorIDs[iLayer].clear();
347352
this->mClusterSize[iLayer].clear();
348353
this->mUnsortedClusters[iLayer].reserve(layerClusters[iLayer].size());
349354
this->mTrackingFrameInfo[iLayer].reserve(layerClusters[iLayer].size());
350355
this->mClusterExternalIndices[iLayer].reserve(layerClusters[iLayer].size());
356+
mClusterSensorIDs[iLayer].reserve(layerClusters[iLayer].size());
351357
this->mClusterSize[iLayer].reserve(layerClusters[iLayer].size());
352358
}
353359

@@ -436,6 +442,7 @@ int TimeFrameMixin<nLayers, Base>::loadROFrameData(const std::array<gsl::span<co
436442
std::array<float, 2>{trkXYZ.y(), trkXYZ.z()},
437443
std::array<float, 3>{sigmaY2, 0.f, sigmaZ2});
438444
this->addClusterToLayer(iLayer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), this->mUnsortedClusters[iLayer].size());
445+
mClusterSensorIDs[iLayer].push_back(c.chipID);
439446
this->addClusterExternalIndexToLayer(iLayer, clusterId);
440447
this->mClusterSize[iLayer].push_back(std::clamp(static_cast<unsigned int>(c.size), 0u, 255u));
441448
}

‎Detectors/Upgrades/ALICE3/GlobalReconstruction/reconstruction/include/ALICE3GlobalReconstruction/TrackerACTS.h‎

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,24 @@
1919
#ifndef ALICE3_GLOBALRECONSTRUCTION_INCLUDE_TRACKERACTS_H_
2020
#define ALICE3_GLOBALRECONSTRUCTION_INCLUDE_TRACKERACTS_H_
2121

22-
#include "Acts/Definitions/Units.hpp"
23-
#include "Framework/Logger.h"
24-
25-
#include "ITStracking/TimeFrame.h"
26-
#include "TH2F.h"
27-
22+
#include <Acts/Definitions/Units.hpp>
23+
#include <chrono>
24+
#include <cmath>
25+
#include <iomanip>
26+
#include <string_view>
27+
#include <Framework/Logger.h>
28+
#include <array>
29+
#include <vector>
30+
#include <unordered_set>
31+
#include "DataFormatsITS/TrackITS.h"
32+
#include <ITStracking/TimeFrame.h>
33+
#include <TH2F.h>
34+
35+
namespace Acts
36+
{
37+
class Surface;
38+
class BoundTrackParameters;
39+
}
2840
namespace o2::trk
2941
{
3042

@@ -62,6 +74,8 @@ struct SpacePoint {
6274
int layer{-1};
6375
int clusterId{-1};
6476
int rof{-1};
77+
int sensorId{-1};
78+
const Acts::Surface* surface{nullptr};
6579

6680
// Derived quantities
6781
float r() const { return std::hypot(x, y); }
@@ -98,6 +112,10 @@ class TrackerACTS
98112

99113
/// Adopt a TimeFrame for processing
100114
void adoptTimeFrame(o2::its::TimeFrame<nLayers>& tf);
115+
void adoptSensorIDs(const std::array<std::vector<int>, nLayers>& sensorIDs)
116+
{
117+
mSensorIDs = &sensorIDs;
118+
}
101119

102120
/// Main tracking entry point: convert clusters to tracks
103121
void clustersToTracks();
@@ -125,13 +143,14 @@ class TrackerACTS
125143
/// Create seeds (triplets) from space points using ACTS SeedFinder
126144
void createSeeds();
127145

128-
/// Estimate track parameters from a seed using ACTS
129-
bool estimateTrackParams(const SeedACTS& seed, o2::its::TrackITSExt& track) const;
130-
131146
/// Run track finding from seeds
132147
void findTracks();
133148

134-
/// Assign MC labels to tracks
149+
/// Convert fitted ACTS states to a TrackITSExt and publish it in the TimeFrame.
150+
bool acceptTrack(const Acts::BoundTrackParameters& inner,
151+
const Acts::BoundTrackParameters& outer,
152+
const SeedACTS& seed, float chi2);
153+
/// Assign one MC label per accepted track, after all ROFs have been processed.
135154
void computeTracksMClabels();
136155

137156
/// Helper: time a task
@@ -150,12 +169,17 @@ class TrackerACTS
150169

151170
// Seeds
152171
std::vector<SeedACTS> mSeeds;
172+
// Avoid accepting seeds which reuse a cluster already assigned to a track.
173+
std::unordered_set<uint64_t> mAcceptedClusters;
174+
// Layer-local indices in mUnsortedClusters, in the same order as getTracks().
175+
// Keep them separate from the external indices stored in TrackITSExt.
176+
std::vector<std::array<int, nLayers>> mAcceptedTrackClusterIndices;
153177

154178
// Tracking state
155179
float mBz{0.5f}; ///< Magnetic field in Tesla
156180
unsigned int mTimeFrameCounter{0};
157181
double mTotalTime{0.};
158-
182+
const std::array<std::vector<int>, nLayers>* mSensorIDs = nullptr;
159183
// Tracking states for logging
160184
enum State {
161185
SpacePointBuilding = 0,

0 commit comments

Comments
 (0)