19#ifndef ALICE3_GLOBALRECONSTRUCTION_INCLUDE_TRACKERACTS_H_
20#define ALICE3_GLOBALRECONSTRUCTION_INCLUDE_TRACKERACTS_H_
22#include <Acts/Definitions/Units.hpp>
31#include <nlohmann/json.hpp>
34#include <unordered_set>
44class BoundTrackParameters;
60 LOG(info) <<
"Loading ACTS tracker configuration from " <<
configName;
61 nlohmann::json config;
64 }
catch (
const nlohmann::json::parse_error&
e) {
65 LOG(
error) <<
"Failed to parse ACTS tracker configuration file " <<
configName <<
": " <<
e.what();
68 if (!config.is_object()) {
69 LOG(
error) <<
"ACTS tracker configuration file " <<
configName <<
" must contain a JSON object";
73 const auto load = [&config](
const char*
key,
auto&
value) {
74 if (!config.contains(
key)) {
79 }
catch (
const nlohmann::json::exception&
e) {
80 LOG(
error) <<
"Failed to load ACTS tracker configuration parameter " <<
key <<
": " <<
e.what();
106 const nlohmann::json config = {
132 output << config.dump(2) <<
'\n';
136 LOG(info) <<
"Saved ACTS tracker configuration to " <<
configName;
140 float minPt = 0.4f * Acts::UnitConstants::GeV;
154 float zMin = -3000.f * Acts::UnitConstants::mm;
155 float zMax = 3000.f * Acts::UnitConstants::mm;
177 static constexpr const char*
configName =
"TrackerACTSConfig.json";
196 float r()
const {
return std::hypot(
x,
y); }
200 float phi()
const {
return std::atan2(
y,
x); }
221template <
int nLayers>
235 mSensorIDs = &sensorIDs;
253 std::unique_ptr<TFile> mDebugFile;
254 TTree* mClusterTree =
nullptr;
255 TTree* mSeedTree =
nullptr;
256 TTree* mROFTree =
nullptr;
257 std::unique_ptr<TH2F> mHistSpacePoints;
258 bool mGeometryDumped =
false;
260 struct DebugClusterRecord {
261 int tf = 0, rof = 0,
layer = 0, clusterId = -1;
262 int externalId = -1, sensorId = -1, mappingStatus = 0;
263 unsigned long long geometryId = 0;
264 float x = 0.f,
y = 0.f,
z = 0.f;
265 float r = 0.f, phi = 0.f;
266 float varianceR = 0.f, varianceZ = 0.f;
269 struct DebugSeedRecord {
270 int tf = 0, rof = 0, seedId = 0;
272 int layer[3] = {}, clusterId[3] = {}, sensorId[3] = {};
273 unsigned long long geometryId[3] = {};
274 float x[3] = {},
y[3] = {},
z[3] = {},
r[3] = {},
phi[3] = {};
277 struct DebugROFRecord {
278 int tf = 0, rof = 0, nSpacePoints = 0, nSeeds = 0;
279 int nAcceptedTracks = 0;
282 void initDebugOutput();
283 void dumpGeometryOnce();
284 bool isDebugTimeFrame()
const;
285 void fillDebugSeeds(
int rof);
288 void buildSpacePoints(
int rof);
297 bool acceptTrack(
const Acts::BoundTrackParameters& inner,
298 const Acts::BoundTrackParameters& outer,
299 const SeedACTS& seed,
float chi2);
301 void computeTracksMClabels();
304 template <
typename Func>
305 float evaluateTask(Func&& task, std::string_view taskName);
308 TrackerACTSConfig mConfig;
314 std::vector<SpacePoint> mSpacePoints;
315 std::vector<std::vector<const SpacePoint*>> mSpacePointsPerLayer;
318 std::vector<SeedACTS> mSeeds;
320 std::unordered_set<uint64_t> mAcceptedClusters;
323 std::vector<std::array<int, nLayers>> mAcceptedTrackClusterIndices;
326 unsigned int mTimeFrameCounter{0};
327 double mTotalTime{0.};
328 const std::array<std::vector<int>,
nLayers>* mSensorIDs =
nullptr;
331 SpacePointBuilding = 0,
336 State mCurState{SpacePointBuilding};
337 static constexpr std::array<const char*, NStates> StateNames{
338 "Space point building",
343template <
int nLayers>
344template <
typename Func>
345float TrackerACTS<nLayers>::evaluateTask(Func&& task, std::string_view taskName)
347 LOG(
debug) <<
" + Starting " << taskName;
348 const auto start = std::chrono::high_resolution_clock::now();
350 const auto end = std::chrono::high_resolution_clock::now();
351 std::chrono::duration<double, std::milli> diff{
end -
start};
353 LOG(
debug) <<
" - " << taskName <<
" completed in: " << std::fixed << std::setprecision(2) << diff.count() <<
" ms";
354 return static_cast<float>(diff.count());
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
char error[CURL_ERROR_SIZE]
Definition of the ITS track.
void adoptSensorIDs(const std::array< std::vector< int >, nLayers > &sensorIDs)
void setConfig(const TrackerACTSConfig &cfg)
Replace the current tracker configuration.
void clustersToTracks()
Build space points, find tracks, and publish accepted tracks in the TimeFrame.
void adoptTimeFrame(o2::its::TimeFrame< nLayers > &tf)
void printSummary() const
Print the accumulated tracking timing and processing summary.
TrackerACTSConfig & getConfig()
Access the tracker configuration for modification.
const TrackerACTSConfig & getConfig() const
Read-only access to the tracker configuration.
GLdouble GLdouble GLdouble GLdouble top
GLsizei const GLfloat * value
GLenum GLuint GLint GLint layer
GLdouble GLdouble GLdouble z
const bool const int nLayers
std::unique_ptr< GPUReconstructionTimeframe > tf
Three-space-point seed ordered from the innermost to outermost measurement.
float quality
ACTS seed quality value.
const SpacePoint * middle
Cluster-derived space point passed to the ACTS seeding algorithms.
const Acts::Surface * surface
Geometry surface associated with this measurement; not owned by the space point.
float radius() const
Radius accessor required by the ACTS cylindrical-grid element concept.
float r() const
Transverse radius in mm.
float phi() const
Azimuthal angle in radians.
int rof
Readout-frame and sensor indices identifying the source measurement.
float varianceR
Estimated radial and longitudinal position variances, in mm^2.
float deltaRMinBottom
Minimum and maximum radial separation for bottom-to-middle space-point pairs.
float minPt
Minimum transverse momentum accepted by the seeding algorithms.
float deltaPhiMax
Reserved maximum azimuthal angle difference for doublets (radians); currently unused.
float collisionRegionMin
Longitudinal range of the collision region used when constructing seeds.
float deltaRMinTop
Minimum and maximum radial separation for middle-to-top space-point pairs.
int debugMaxTimeFrames
Number of time frames with debug output; 0 disables it and -1 means all.
float maxImpactParameter
Maximum transverse distance of closest approach used in seeding.
float zMin
Longitudinal range used to select space points for seeding.
static constexpr const char * configName
std::string debugFileName
Destination ROOT file for diagnostic output.
float deltaRMaxTop
Max deltaR for middle-top.
bool writeDebugTrees
Enable diagnostic ROOT trees and histograms; disabled by default.
float maxSeedsPerMiddleSP
Maximum number of seeds retained for each middle space point.
float cotThetaMax
Maximum absolute cot(theta); the default corresponds approximately to |eta| = 4.
bool dumpTrackingGeometry
Write a JSON snapshot of the tracking geometry on the first use.
std::string geometryDumpFileName
Destination JSON file for the tracking-geometry snapshot.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"