Project
Loading...
Searching...
No Matches
TrackerACTS.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
18
19#ifndef ALICE3_INCLUDE_TRACKERACTS_H_
20#define ALICE3_INCLUDE_TRACKERACTS_H_
21
22#include "Acts/Definitions/Units.hpp"
23#include "Framework/Logger.h"
24
26#include "TH2F.h"
27
28namespace o2::trk
29{
30
33 // Seeding parameters
34 float minPt = 0.4f * Acts::UnitConstants::GeV;
35 float maxImpactParameter = 10.f * Acts::UnitConstants::mm;
36 float cotThetaMax = std::sinh(4.0f);
37
38 // Delta R cuts for doublet/triplet formation
39 float deltaRMinBottom = 5.f * Acts::UnitConstants::mm;
40 float deltaRMaxBottom = 200.f * Acts::UnitConstants::mm;
41 float deltaRMinTop = 5.f * Acts::UnitConstants::mm;
42 float deltaRMaxTop = 200.f * Acts::UnitConstants::mm;
43
44 // Z cuts
45 float zMin = -3000.f * Acts::UnitConstants::mm;
46 float zMax = 3000.f * Acts::UnitConstants::mm;
47
48 // Collision region
49 float collisionRegionMin = -150.f * Acts::UnitConstants::mm;
50 float collisionRegionMax = 150.f * Acts::UnitConstants::mm;
51
52 // Quality cuts
54 float deltaPhiMax = 0.1f;
55};
56
58struct SpacePoint {
59 float x{0.f};
60 float y{0.f};
61 float z{0.f};
62 int layer{-1};
63 int clusterId{-1};
64 int rof{-1};
65
66 // Derived quantities
67 float r() const { return std::hypot(x, y); }
68 float radius() const { return r(); } // required by Acts::CylindricalGridElement concept
69 float phi() const { return std::atan2(y, x); }
70
71 // Variance estimates (can be refined based on cluster properties)
72 float varianceR{0.01f}; // ~100 um resolution squared
73 float varianceZ{0.01f};
74};
75
77struct SeedACTS {
78 const SpacePoint* bottom{nullptr};
79 const SpacePoint* middle{nullptr};
80 const SpacePoint* top{nullptr};
81 float quality{0.f};
82};
83
85template <int nLayers>
87{
88 public:
91 {
92 if (mHistSpacePoints) {
93 mHistSpacePoints->SaveAs("/tmp/mHistSpacePoints.C");
94 delete mHistSpacePoints;
95 mHistSpacePoints = nullptr;
96 }
97 }
98
101
103 void clustersToTracks();
104
106 void setConfig(const TrackerACTSConfig& cfg) { mConfig = cfg; }
107 TrackerACTSConfig& getConfig() { return mConfig; }
108 const TrackerACTSConfig& getConfig() const { return mConfig; }
109
111 void setBz(float bz) { mBz = bz; }
112
114 float getBz() const { return mBz; }
115
117 void printSummary() const;
118
119 private:
120 TH2F* mHistSpacePoints = nullptr;
121
123 void buildSpacePoints(int rof);
124
126 void createSeeds();
127
129 bool estimateTrackParams(const SeedACTS& seed, o2::its::TrackITSExt& track) const;
130
132 void findTracks();
133
135 void computeTracksMClabels();
136
138 template <typename Func>
139 float evaluateTask(Func&& task, std::string_view taskName);
140
141 // Configuration
142 TrackerACTSConfig mConfig;
143
144 // TimeFrame data
145 o2::its::TimeFrame<nLayers>* mTimeFrame = nullptr;
146
147 // Space points built from clusters
148 std::vector<SpacePoint> mSpacePoints;
149 std::vector<std::vector<const SpacePoint*>> mSpacePointsPerLayer;
150
151 // Seeds
152 std::vector<SeedACTS> mSeeds;
153
154 // Tracking state
155 float mBz{0.5f};
156 unsigned int mTimeFrameCounter{0};
157 double mTotalTime{0.};
158
159 // Tracking states for logging
160 enum State {
161 SpacePointBuilding = 0,
162 Seeding,
163 TrackFinding,
164 NStates,
165 };
166 State mCurState{SpacePointBuilding};
167 static constexpr std::array<const char*, NStates> StateNames{
168 "Space point building",
169 "ACTS seeding",
170 "Track finding"};
171};
172
173template <int nLayers>
174template <typename Func>
175float TrackerACTS<nLayers>::evaluateTask(Func&& task, std::string_view taskName)
176{
177 LOG(debug) << " + Starting " << taskName;
178 const auto start = std::chrono::high_resolution_clock::now();
179 task();
180 const auto end = std::chrono::high_resolution_clock::now();
181 std::chrono::duration<double, std::milli> diff{end - start};
182
183 LOG(debug) << " - " << taskName << " completed in: " << std::fixed << std::setprecision(2) << diff.count() << " ms";
184 return static_cast<float>(diff.count());
185}
186
187} // namespace o2::trk
188
189#endif /* ALICE3_INCLUDE_TRACKERACTS_H_ */
std::ostringstream debug
TRK Tracker using ACTS algorithms for seeding and track finding.
Definition TrackerACTS.h:87
void setBz(float bz)
Set the magnetic field strength.
void setConfig(const TrackerACTSConfig &cfg)
Configuration.
void clustersToTracks()
Main tracking entry point: convert clusters to tracks.
void adoptTimeFrame(o2::its::TimeFrame< nLayers > &tf)
Adopt a TimeFrame for processing.
void printSummary() const
Print tracking summary.
TrackerACTSConfig & getConfig()
float getBz() const
Get the magnetic field strength.
const TrackerACTSConfig & getConfig() const
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint GLuint end
Definition glcorearb.h:469
GLdouble GLdouble GLdouble GLdouble top
Definition glcorearb.h:4077
GLint GLint bottom
Definition glcorearb.h:1979
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLuint start
Definition glcorearb.h:469
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
std::unique_ptr< GPUReconstructionTimeframe > tf
Seed (triplet of space points)
Definition TrackerACTS.h:77
const SpacePoint * middle
Definition TrackerACTS.h:79
Space point representation for tracking.
Definition TrackerACTS.h:58
float radius() const
Definition TrackerACTS.h:68
float r() const
Definition TrackerACTS.h:67
float phi() const
Definition TrackerACTS.h:69
Configuration for the ACTS-based tracker.
Definition TrackerACTS.h:32
float deltaRMinBottom
Min deltaR for bottom-middle.
Definition TrackerACTS.h:39
float minPt
Minimum pT for seeds.
Definition TrackerACTS.h:34
float deltaPhiMax
Maximum phi difference for doublets.
Definition TrackerACTS.h:54
float deltaRMinTop
Min deltaR for middle-top.
Definition TrackerACTS.h:41
float maxImpactParameter
Maximum impact parameter.
Definition TrackerACTS.h:35
float deltaRMaxBottom
Max deltaR for bottom-middle.
Definition TrackerACTS.h:40
float deltaRMaxTop
Max deltaR for middle-top.
Definition TrackerACTS.h:42
float cotThetaMax
Maximum cot(theta), corresponds to eta ~4.
Definition TrackerACTS.h:36
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"