Project
Loading...
Searching...
No Matches
CookedTracker.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
15
16#ifndef ALICEO2_ITS_COOKEDTRACKER_H
17#define ALICEO2_ITS_COOKEDTRACKER_H
18
19//-------------------------------------------------------------------------
20// A stand-alone ITS tracker
21// The pattern recongintion based on the "cooked covariance" approach
22//-------------------------------------------------------------------------
23
24#include <vector>
25#include <tuple>
27#include "MathUtils/Cartesian.h"
33
35
36namespace o2
37{
38class MCCompLabel;
39namespace dataformats
40{
41template <typename T>
43}
44namespace itsmft
45{
46class TopologyDictionary;
47class CompClusterExt;
48} // namespace itsmft
49namespace its
50{
52{
56
57 public:
58 CookedTracker(Int_t nThreads = 1);
59 CookedTracker(const CookedTracker&) = delete;
61 ~CookedTracker() = default;
62
64 {
65 const auto& par = CookedConfigParam::Instance();
66 LOG(info) << " Setting configurable parameters...";
67
68 gzWin = par.zWin;
69 gminPt = par.minPt;
70 gmaxDCAxy = par.maxDCAxy;
71 gmaxDCAz = par.maxDCAz;
72 gSigma2 = par.sigma * par.sigma;
73 gRoadY = par.roadY;
74 gRoadZ = par.roadZ;
75 gminNumberOfClusters = par.minNumberOfClusters;
76 }
77 void setParameters(const std::vector<float>& par)
78 {
79 gzWin = par[0];
80 gminPt = par[1];
81 gmaxDCAxy = par[3];
82 gmaxDCAz = par[4];
83 gSeedingLayer1 = par[5];
84 gSeedingLayer2 = par[6];
85 gSeedingLayer3 = par[7];
86 gSigma2 = par[8] * par[8];
87 gmaxChi2PerCluster = par[9];
88 gmaxChi2PerTrack = par[10];
89 gRoadY = par[11];
90 gRoadZ = par[12];
91 gminNumberOfClusters = par[13];
92 }
94 {
95 // seed "windows" in z and phi: makeSeeds
96 gzWin = 84.; // length of the L3
97 gminPt = 10.;
98 // Maximal accepted impact parameters for the seeds
99 gmaxDCAxy = 19.4; // radius of the L3
100 gmaxDCAz = 42.; // half-lenght of the L3
101 // Space point resolution
102 gSigma2 = 0.2 * 0.2;
103 // Tracking "road" from layer to layer
104 gRoadY = 1.5; // Chip size in Y
105 gRoadZ = 3.0; // Chip size in Z
106 }
107
108 void setVertices(const std::vector<Vertex>& vertices)
109 {
110 mVertices = &vertices;
111 }
112
113 Double_t getX() const { return mX; }
114 Double_t getY() const { return mY; }
115 Double_t getZ() const { return mZ; }
116 Double_t getSigmaX() const { return mSigmaX; }
117 Double_t getSigmaY() const { return mSigmaY; }
118 Double_t getSigmaZ() const { return mSigmaZ; }
121 Double_t getBz() const;
122 void setBz(Double_t bz) { mBz = bz; }
123
124 void setNumberOfThreads(Int_t n) { mNumOfThreads = n; }
125 Int_t getNumberOfThreads() const { return mNumOfThreads; }
126
127 using TrackInserter = std::function<int(const TrackITSExt& t)>;
128 // These functions must be implemented
129 template <typename U, typename V>
130 void process(gsl::span<const CompClusterExt> clusters, gsl::span<const unsigned char>::iterator& it, const o2::itsmft::TopologyDictionary* dict, U& tracks, V& clusIdx, o2::itsmft::ROFRecord& rof)
131 {
132 TrackInserter inserter = [&tracks, &clusIdx, this](const TrackITSExt& t) -> int {
133 // convert internal track to output format
134 auto& trackNew = tracks.emplace_back(t);
135 int noc = t.getNumberOfClusters();
136 int clEntry = clusIdx.size();
137 for (int i = 0; i < noc; i++) {
138 const Cluster* c = this->getCluster(t.getClusterIndex(i));
139 Int_t idx = c - &mClusterCache[0]; // Index of this cluster in event
140 clusIdx.emplace_back(this->mFirstInFrame + idx);
141 }
142 trackNew.setClusterRefs(clEntry, noc);
143 trackNew.setPattern(0x7f); // this tracker finds only complete tracks
144 return tracks.size();
145 };
146 process(clusters, it, dict, inserter, rof);
147 }
148 void process(gsl::span<const CompClusterExt> const& clusters, gsl::span<const unsigned char>::iterator& it, const o2::itsmft::TopologyDictionary* dict, TrackInserter& inserter, o2::itsmft::ROFRecord& rof);
149 const Cluster* getCluster(Int_t index) const;
150
152 void setMCTruthContainers(const o2::dataformats::MCTruthContainer<o2::MCCompLabel>* clsLabels, std::vector<o2::MCCompLabel>* trkLabels)
153 {
154 mClsLabels = clsLabels;
155 mTrkLabels = trkLabels;
156 }
157
158 void setContinuousMode(bool mode) { mContinuousMode = mode; }
159 bool getContinuousMode() { return mContinuousMode; }
160
161 static void setMostProbablePt(float pt) { mMostProbablePt = pt; }
162 static auto getMostProbablePt() { return mMostProbablePt; }
163
164 // internal helper classes
165 class ThreadData;
166 class Layer;
167
168 protected:
169 static constexpr int kNLayers = 7;
170 int loadClusters();
171 void unloadClusters();
172 std::tuple<int, int> processLoadedClusters(TrackInserter& inserter);
173
174 std::vector<TrackITSExt> trackInThread(Int_t first, Int_t last);
175 o2::its::TrackITSExt cookSeed(const Point3Df& r1, Point3Df& r2, const Point3Df& tr3, float rad2, float rad3, float_t alpha, float_t bz);
176 void makeSeeds(std::vector<TrackITSExt>& seeds, Int_t first, Int_t last);
177 void trackSeeds(std::vector<TrackITSExt>& seeds);
178
179 Bool_t attachCluster(Int_t& volID, Int_t nl, Int_t ci, TrackITSExt& t, const TrackITSExt& o) const;
180
181 void makeBackPropParam(std::vector<TrackITSExt>& seeds) const;
182 bool makeBackPropParam(TrackITSExt& track) const;
183
184 private:
185 /*** Tracking parameters ***/
186 // seed "windows" in z and phi: makeSeeds
187 static Float_t gzWin;
188 static Float_t gminPt;
189 static Float_t mMostProbablePt;
190 // Maximal accepted impact parameters for the seeds
191 static Float_t gmaxDCAxy;
192 static Float_t gmaxDCAz;
193 // Layers for the seeding
194 static Int_t gSeedingLayer1;
195 static Int_t gSeedingLayer2;
196 static Int_t gSeedingLayer3;
197 // Space point resolution
198 static Float_t gSigma2;
199 // Max accepted chi2
200 static Float_t gmaxChi2PerCluster;
201 static Float_t gmaxChi2PerTrack;
202 // Tracking "road" from layer to layer
203 static Float_t gRoadY;
204 static Float_t gRoadZ;
205 // Minimal number of attached clusters
206 static Int_t gminNumberOfClusters;
207
208 bool mContinuousMode = true;
209 const o2::its::GeometryTGeo* mGeom = nullptr;
210 const o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mClsLabels = nullptr;
211 std::vector<o2::MCCompLabel>* mTrkLabels = nullptr;
212 std::uint32_t mFirstInFrame = 0;
213
214 Int_t mNumOfThreads;
215
216 Double_t mBz;
217
218 const std::vector<Vertex>* mVertices = nullptr;
219 Double_t mX = 0.;
220 Double_t mY = 0.;
221 Double_t mZ = 0.;
222
223 Double_t mSigmaX = 2.;
224 Double_t mSigmaY = 2.;
225 Double_t mSigmaZ = 2.;
226
227 static Layer sLayers[kNLayers];
228 std::vector<TrackITSExt> mSeeds;
229
230 std::vector<Cluster> mClusterCache;
231
232 ClassDefNV(CookedTracker, 1);
233};
234
236{
237 public:
238 Layer();
239 Layer(const Layer&) = delete;
240 Layer& operator=(const Layer& tr) = delete;
241
242 void init();
243 Bool_t insertCluster(const Cluster* c);
244 void setR(Double_t r) { mR = r; }
245 void unloadClusters();
246 void selectClusters(std::vector<Int_t>& s, Float_t phi, Float_t dy, Float_t z, Float_t dz);
247 Int_t findClusterIndex(Float_t z) const;
248 Float_t getR() const { return mR; }
249 const Cluster* getCluster(Int_t i) const { return mClusters[i]; }
250 Float_t getAlphaRef(Int_t i) const { return mAlphaRef[i]; }
251 Float_t getClusterPhi(Int_t i) const { return mPhi[i]; }
252 Int_t getNumberOfClusters() const { return mClusters.size(); }
254
255 protected:
256 enum { kNSectors = 21 };
257
259 const o2::its::GeometryTGeo* mGeom = nullptr;
260 std::vector<const Cluster*> mClusters;
261 std::vector<Float_t> mAlphaRef;
262 std::vector<Float_t> mPhi;
263 std::vector<std::pair<int, float>> mSectors[kNSectors];
264};
265} // namespace its
266} // namespace o2
267#endif /* ALICEO2_ITS_COOKEDTRACKER_H */
Definition of the ITSMFT cluster.
int32_t i
bool o
Definition of the GeometryTGeo class.
Definition of the ITSMFT ROFrame (trigger) record.
uint32_t c
Definition RawData.h:2
Definition of the ITS track.
std::vector< Float_t > mPhi
cluster phi
const o2::its::GeometryTGeo * mGeom
interface to geometry
Layer & operator=(const Layer &tr)=delete
Int_t findClusterIndex(Float_t z) const
Float_t mR
mean radius of this layer
void selectClusters(std::vector< Int_t > &s, Float_t phi, Float_t dy, Float_t z, Float_t dz)
Float_t getAlphaRef(Int_t i) const
Layer(const Layer &)=delete
void setGeometry(o2::its::GeometryTGeo *geom)
Float_t getClusterPhi(Int_t i) const
const Cluster * getCluster(Int_t i) const
std::vector< const Cluster * > mClusters
All clusters.
std::vector< Float_t > mAlphaRef
alpha of the reference plane
Bool_t insertCluster(const Cluster *c)
std::vector< std::pair< int, float > > mSectors[kNSectors]
Cluster indices sector-by-sector.
void makeSeeds(std::vector< TrackITSExt > &seeds, Int_t first, Int_t last)
void process(gsl::span< const CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &it, const o2::itsmft::TopologyDictionary *dict, U &tracks, V &clusIdx, o2::itsmft::ROFRecord &rof)
void setGeometry(o2::its::GeometryTGeo *geom)
Double_t getSigmaX() const
void setContinuousMode(bool mode)
Double_t getZ() const
std::tuple< int, int > processLoadedClusters(TrackInserter &inserter)
CookedTracker(const CookedTracker &)=delete
void setParameters(const std::vector< float > &par)
o2::its::TrackITSExt cookSeed(const Point3Df &r1, Point3Df &r2, const Point3Df &tr3, float rad2, float rad3, float_t alpha, float_t bz)
Double_t getSigmaY() const
std::function< int(const TrackITSExt &t)> TrackInserter
void setBz(Double_t bz)
void makeBackPropParam(std::vector< TrackITSExt > &seeds) const
Double_t getSigmaZ() const
void setExternalIndices(TrackITSExt &t) const
void setMCTruthContainers(const o2::dataformats::MCTruthContainer< o2::MCCompLabel > *clsLabels, std::vector< o2::MCCompLabel > *trkLabels)
void trackSeeds(std::vector< TrackITSExt > &seeds)
Int_t getNumberOfThreads() const
CookedTracker & operator=(const CookedTracker &tr)=delete
static void setMostProbablePt(float pt)
std::vector< TrackITSExt > trackInThread(Int_t first, Int_t last)
void process(gsl::span< const CompClusterExt > const &clusters, gsl::span< const unsigned char >::iterator &it, const o2::itsmft::TopologyDictionary *dict, TrackInserter &inserter, o2::itsmft::ROFRecord &rof)
Double_t getY() const
void setNumberOfThreads(Int_t n)
static auto getMostProbablePt()
const Cluster * getCluster(Int_t index) const
static constexpr int kNLayers
o2::MCCompLabel cookLabel(TrackITSExt &t, Float_t wrong) const
Bool_t attachCluster(Int_t &volID, Int_t nl, Int_t ci, TrackITSExt &t, const TrackITSExt &o) const
void setVertices(const std::vector< Vertex > &vertices)
Double_t getX() const
Cluster class for the ITSMFT.
Definition Cluster.h:34
GLdouble n
Definition glcorearb.h:1982
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLenum mode
Definition glcorearb.h:266
GLuint index
Definition glcorearb.h:781
GLboolean r
Definition glcorearb.h:1233
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cluster > clusters