Project
Loading...
Searching...
No Matches
TrackFinder.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
16
17#ifndef O2_MCH_TRACKFINDER_H_
18#define O2_MCH_TRACKFINDER_H_
19
20#include <chrono>
21#include <unordered_map>
22#include <unordered_set>
23#include <list>
24#include <array>
25#include <vector>
26#include <utility>
27
28#include <gsl/span>
29
31#include "MCHBase/ErrorMap.h"
32#include "MCHTracking/Track.h"
34
35namespace o2
36{
37namespace mch
38{
39
42{
43 public:
44 TrackFinder() = default;
45 ~TrackFinder() = default;
46
47 TrackFinder(const TrackFinder&) = delete;
51
52 void init();
53 void initField(float l3Current, float dipoleCurrent);
54
55 const std::list<Track>& findTracks(gsl::span<const Cluster> clusters);
56
58 ErrorMap& getErrorMap() { return mErrorMap; }
59
61 void debug(int debugLevel) { mDebugLevel = debugLevel; }
62
63 void printStats() const;
64 void printTimers() const;
65
66 private:
67 const std::list<Track>& findTracks(const std::unordered_map<int, std::list<const Cluster*>>& clusters);
68
69 void findTrackCandidates();
70 void findTrackCandidatesInSt5();
71 void findTrackCandidatesInSt4();
72 void findMoreTrackCandidates();
73 std::list<Track>::iterator findTrackCandidates(int plane1, int plane2, bool skipUsedPairs, const std::list<Track>::iterator& itFirstTrack);
74
75 std::list<Track>::iterator followTrackInOverlapDE(const std::list<Track>::iterator& itTrack, int currentDE, int plane);
76 std::list<Track>::iterator followTrackInChamber(std::list<Track>::iterator& itTrack,
77 int chamber, int lastChamber, bool canSkip,
78 std::unordered_map<int, std::unordered_set<uint32_t>>& excludedClusters);
79 std::list<Track>::iterator followTrackInChamber(std::list<Track>::iterator& itTrack,
80 int plane1, int plane2, int lastChamber,
81 std::unordered_map<int, std::unordered_set<uint32_t>>& excludedClusters);
82 std::list<Track>::iterator addClustersAndFollowTrack(std::list<Track>::iterator& itTrack, const TrackParam& paramAtCluster1,
83 const TrackParam* paramAtCluster2, int nextChamber, int lastChamber,
84 std::unordered_map<int, std::unordered_set<uint32_t>>& excludedClusters);
85
86 void improveTracks();
87
88 void removeConnectedTracks(int stMin, int stMax);
89
90 void refineTracks();
91
92 void finalize();
93
94 void createTrack(const Cluster& cl1, const Cluster& cl2);
95 std::list<Track>::iterator addTrack(const std::list<Track>::iterator& pos, const Track& track);
96
97 bool isAcceptable(const TrackParam& param) const;
98
99 void prepareForwardTracking(std::list<Track>::iterator& itTrack, bool runSmoother);
100 void prepareBackwardTracking(std::list<Track>::iterator& itTrack, bool refit);
101 void setCurrentParam(Track& track, const TrackParam& param, int chamber, bool smoothed = false);
102 bool propagateCurrentParam(Track& track, int chamber);
103
104 bool areUsed(const Cluster& cl1, const Cluster& cl2, const std::vector<std::array<uint32_t, 4>>& usedClusters);
105 void excludeClustersFromIdenticalTracks(const std::array<uint32_t, 4>& currentClusters,
106 const std::vector<std::array<uint32_t, 8>>& usedClusters,
107 std::unordered_map<int, std::unordered_set<uint32_t>>& excludedClusters);
108 void moveClusters(std::unordered_map<int, std::unordered_set<uint32_t>>& source, std::unordered_map<int, std::unordered_set<uint32_t>>& destination);
109
110 bool isCompatible(const TrackParam& param, const Cluster& cluster, TrackParam& paramAtCluster);
111 bool tryOneClusterFast(const TrackParam& param, const Cluster& cluster);
112 double tryOneCluster(const TrackParam& param, const Cluster& cluster, TrackParam& paramAtCluster);
113
114 uint8_t requestedStationMask() const;
115
116 int getTrackIndex(const std::list<Track>::iterator& itCurrentTrack) const;
117 void printTracks() const;
118 void printTrack(const Track& track) const;
119 void printTrackParam(const TrackParam& trackParam) const;
120 template <class... Args>
121 void print(Args... args) const;
122
124 int getChamberId(int plane) { return (plane < 8) ? plane / 2 : 4 + (plane - 8) / 4; }
125
127 static constexpr double SMaxNonBendingDistanceToTrack = 1.;
129 static constexpr double SMaxBendingDistanceToTrack = 1.;
130 static constexpr double SMinBendingMomentum = 0.8;
132 static constexpr double SDefaultChamberZ[10] = {-526.16, -545.24, -676.4, -695.4, -967.5,
133 -998.5, -1276.5, -1307.5, -1406.6, -1437.6};
135 static constexpr double SChamberThicknessInX0[10] = {0.065, 0.065, 0.075, 0.075, 0.035,
136 0.035, 0.035, 0.035, 0.035, 0.035};
137 static constexpr int SNDE[10] = {4, 4, 4, 4, 18, 18, 26, 26, 26, 26};
138
139 TrackFitter mTrackFitter{};
140
142 std::array<std::vector<std::pair<const int, const std::list<const Cluster*>*>>, 32> mClusters{};
143
144 std::list<Track> mTracks{};
145
146 std::chrono::time_point<std::chrono::steady_clock> mStartTime{};
147
148 ErrorMap mErrorMap{};
149
150 double mChamberResolutionX2 = 0.;
151 double mChamberResolutionY2 = 0.;
152 double mBendingVertexDispersion2 = 0.;
153 double mMaxChi2ForTracking = 0.;
154 double mMaxChi2ForImprovement = 0.;
155
156 double mMaxMCSAngle2[10]{};
157
158 int mDebugLevel = 0;
159
160 std::size_t mNCandidates = 0;
161 std::size_t mNCallTryOneCluster = 0;
162 std::size_t mNCallTryOneClusterFast = 0;
163
164 std::chrono::duration<double> mTimeFindCandidates{};
165 std::chrono::duration<double> mTimeFindMoreCandidates{};
166 std::chrono::duration<double> mTimeFollowTracks{};
167 std::chrono::duration<double> mTimeImproveTracks{};
168 std::chrono::duration<double> mTimeCleanTracks{};
169 std::chrono::duration<double> mTimeRefineTracks{};
170};
171
172} // namespace mch
173} // namespace o2
174
175#endif // O2_MCH_TRACKFINDER_H_
Definition of the MCH cluster minimal structure.
Definition of the MCH track for internal use.
void print() const
Definition of a class to fit a track to a set of clusters.
uint16_t pos
Definition RawData.h:3
A container class to summarize errors encountered during processing.
Definition ErrorMap.h:38
Class to reconstruct tracks.
Definition TrackFinder.h:42
TrackFinder & operator=(TrackFinder &&)=delete
const std::list< Track > & findTracks(gsl::span< const Cluster > clusters)
TrackFinder(TrackFinder &&)=delete
TrackFinder & operator=(const TrackFinder &)=delete
void debug(int debugLevel)
set the debug level defining the verbosity
Definition TrackFinder.h:61
ErrorMap & getErrorMap()
return the counting of encountered errors
Definition TrackFinder.h:58
void initField(float l3Current, float dipoleCurrent)
TrackFinder(const TrackFinder &)=delete
track parameters for internal use
Definition TrackParam.h:34
track for internal use
Definition Track.h:33
GLsizei GLsizei GLchar * source
Definition glcorearb.h:798
GLenum GLfloat param
Definition glcorearb.h:271
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
cluster minimal structure
Definition Cluster.h:31
std::vector< Cluster > clusters