Project
Loading...
Searching...
No Matches
Configuration.cxx
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
12#include <algorithm>
13#include <format>
14#include <limits>
15#include <string_view>
16#include <vector>
17
18#include "Framework/Logger.h"
22
23using namespace o2::its;
24
26{
27 std::string str = std::format("NZb:{} NPhB:{} PerVtx:{} DropFail:{} ClSh:{} TtklMinPt:{:.2f} MinCl:{}",
29 bool first = true;
30 for (int il = NLayers; il >= MinTrackLength; il--) {
31 int slot = NLayers - il;
32 if (slot < (int)MinPt.size() && MinPt[slot] > 0) {
33 if (first) {
34 first = false;
35 str += " MinPt: ";
36 }
37 str += std::format("L{}:{:.2f} ", il, MinPt[slot]);
38 }
39 }
40 if (!SystErrorY2.empty() || !SystErrorZ2.empty()) {
41 str += " SystErrY/Z:";
42 for (size_t i = 0; i < SystErrorY2.size(); i++) {
43 str += std::format("{:.2e}/{:.2e} ", SystErrorY2[i], SystErrorZ2[i]);
44 }
45 }
46 if (!AddTimeError.empty()) {
47 str += " AddTimeError:";
48 for (unsigned int i : AddTimeError) {
49 str += std::format("{} ", i);
50 }
51 }
52 if (std::numeric_limits<size_t>::max() != MaxMemory) {
53 str += std::format(" MemLimit {:.2f} GB", double(MaxMemory) / constants::GB);
54 }
55 return str;
56}
57
59{
60 std::string str = std::format("NZb:{} NPhB:{} MinVtxCont:{} SupLowMultDebris:{} MaxTrkltCls:{} ZCut:{} PhCut:{} PairCut:{} ClCut:{} SeedRad:{}x{}",
62 if (std::numeric_limits<size_t>::max() != MaxMemory) {
63 str += std::format(" MemLimit {:.2f} GB", double(MaxMemory) / constants::GB);
64 }
65 return str;
66}
67
68namespace
69{
70constexpr bool iequals(std::string_view a, std::string_view b)
71{
72 return std::equal(a.begin(), a.end(), b.begin(), b.end(),
73 [](char x, char y) { return std::tolower(x) == std::tolower(y); });
74}
75} // namespace
76
78{
79 constexpr std::array smodes = {
80 std::pair{"sync", Sync},
81 std::pair{"async", Async},
82 std::pair{"cosmics", Cosmics},
83 std::pair{"unset", Unset},
84 std::pair{"off", Off}};
85
86 auto it = std::find_if(smodes.begin(), smodes.end(), [&str](const auto& pair) {
87 return iequals(str, pair.first);
88 });
89 if (it == smodes.end()) {
90 LOGP(fatal, "Unrecognized tracking mode '{}'", str);
91 }
92 return it->second;
93}
94
96{
97 if (mode == TrackingMode::Sync) {
98 return "sync";
99 } else if (mode == TrackingMode::Async) {
100 return "async";
101 } else if (mode == TrackingMode::Cosmics) {
102 return "cosmics";
103 } else if (mode == TrackingMode::Unset) {
104 return "unset";
105 } else if (mode == TrackingMode::Off) {
106 return "off";
107 }
108 LOGP(fatal, "Unrecognized tracking mode '{}'", (int)mode);
109 return ""; // not reachable
110}
111
113{
114 const auto& tc = o2::its::TrackerParamConfig::Instance();
115 std::vector<TrackingParameters> trackParams;
116
117 if (mode == TrackingMode::Async) {
118 trackParams.resize(tc.doUPCIteration ? 4 : 3);
119 trackParams[1].TrackletMinPt = 0.2f;
120 trackParams[1].CellDeltaTanLambdaSigma *= 2.;
121 trackParams[2].TrackletMinPt = 0.1f;
122 trackParams[2].CellDeltaTanLambdaSigma *= 4.;
123
124 trackParams[0].MinPt[0] = 1.f / 12; // 7cl
125 trackParams[1].MinPt[0] = 1.f / 12; // 7cl
126
127 trackParams[2].MinTrackLength = 4;
128 trackParams[2].MinPt[0] = 1.f / 12; // 7cl
129 trackParams[2].MinPt[1] = 1.f / 5; // 6cl
130 trackParams[2].MinPt[2] = 1.f / 1; // 5cl
131 trackParams[2].MinPt[3] = 1.f / 6; // 4cl
132
133 trackParams[2].StartLayerMask = (1 << 6) + (1 << 3);
134 if (tc.doUPCIteration) {
135 trackParams[3].MinTrackLength = 4;
136 trackParams[3].TrackletMinPt = 0.1f;
137 trackParams[3].CellDeltaTanLambdaSigma *= 4.;
138 }
139 for (size_t ip = 0; ip < trackParams.size(); ip++) {
140 auto& param = trackParams[ip];
141 param.ZBins = 64;
142 param.PhiBins = 32;
143 // check if something was overridden via configurable params
144 if (ip < tc.MaxIter) {
145 if (tc.startLayerMask[ip] > 0) {
146 trackParams[2].StartLayerMask = tc.startLayerMask[ip];
147 }
148 if (tc.minTrackLgtIter[ip] > 0) {
149 param.MinTrackLength = tc.minTrackLgtIter[ip];
150 }
151 for (int ilg = tc.MaxTrackLength; ilg >= tc.MinTrackLength; ilg--) {
152 int lslot0 = (tc.MaxTrackLength - ilg), lslot = lslot0 + ip * (tc.MaxTrackLength - tc.MinTrackLength + 1);
153 if (tc.minPtIterLgt[lslot] > 0.) {
154 param.MinPt[lslot0] = tc.minPtIterLgt[lslot];
155 }
156 }
157 }
158 }
159 } else if (mode == TrackingMode::Sync) {
160 trackParams.resize(1);
161 trackParams[0].ZBins = 64;
162 trackParams[0].PhiBins = 32;
163 trackParams[0].MinTrackLength = 4;
164 } else if (mode == TrackingMode::Cosmics) {
165 trackParams.resize(1);
166 trackParams[0].MinTrackLength = 4;
167 trackParams[0].CellDeltaTanLambdaSigma *= 10;
168 trackParams[0].PhiBins = 4;
169 trackParams[0].ZBins = 16;
170 trackParams[0].PVres = 1.e5f;
171 trackParams[0].MaxChi2ClusterAttachment = 60.;
172 trackParams[0].MaxChi2NDF = 40.;
173 } else {
174 LOGP(fatal, "Unsupported ITS tracking mode {} ", toString(mode));
175 }
176
177 float bFactor = std::abs(o2::base::Propagator::Instance()->getNominalBz()) / 5.0066791f;
178 float bFactorTracklets = bFactor < 0.01f ? 1.f : bFactor; // for tracklets only
179
180 // global parameters set for every iteration
181 for (auto& p : trackParams) {
182 // adjust pT settings to actual mag. field
183 p.TrackletMinPt *= bFactorTracklets;
184 for (int ilg = tc.MaxTrackLength; ilg >= tc.MinTrackLength; ilg--) {
185 int lslot = tc.MaxTrackLength - ilg;
186 p.MinPt[lslot] *= bFactor;
187 }
188 p.ReseedIfShorter = tc.reseedIfShorter;
189 p.RepeatRefitOut = tc.repeatRefitOut;
190 p.ShiftRefToCluster = tc.shiftRefToCluster;
191 p.createArtefactLabels = tc.createArtefactLabels;
192
193 p.PrintMemory = tc.printMemory;
194 p.MaxMemory = tc.maxMemory;
195 p.DropTFUponFailure = tc.dropTFUponFailure;
196 p.SaveTimeBenchmarks = tc.saveTimeBenchmarks;
197 p.FataliseUponFailure = tc.fataliseUponFailure;
198 p.AllowSharingFirstCluster = tc.allowSharingFirstCluster;
199
200 if (tc.useMatCorrTGeo) {
202 } else if (tc.useFastMaterial) {
204 } else {
206 }
207
208 if (p.NLayers == 7) {
209 for (int i{0}; i < 7; ++i) {
210 p.SystErrorY2[i] = tc.sysErrY2[i] > 0 ? tc.sysErrY2[i] : p.SystErrorY2[i];
211 p.SystErrorZ2[i] = tc.sysErrZ2[i] > 0 ? tc.sysErrZ2[i] : p.SystErrorZ2[i];
212 }
213 }
214 for (int i{0}; i < 7; ++i) {
215 p.AddTimeError[i] = tc.addTimeError[i];
216 }
217 p.DoUPCIteration = tc.doUPCIteration;
218 p.MaxChi2ClusterAttachment = tc.maxChi2ClusterAttachment > 0 ? tc.maxChi2ClusterAttachment : p.MaxChi2ClusterAttachment;
219 p.MaxChi2NDF = tc.maxChi2NDF > 0 ? tc.maxChi2NDF : p.MaxChi2NDF;
220 p.PhiBins = tc.LUTbinsPhi > 0 ? tc.LUTbinsPhi : p.PhiBins;
221 p.ZBins = tc.LUTbinsZ > 0 ? tc.LUTbinsZ : p.ZBins;
222 p.PVres = tc.pvRes > 0 ? tc.pvRes : p.PVres;
223 p.NSigmaCut *= tc.nSigmaCut > 0 ? tc.nSigmaCut : 1.f;
224 p.CellDeltaTanLambdaSigma *= tc.deltaTanLres > 0 ? tc.deltaTanLres : 1.f;
225 p.TrackletMinPt *= tc.minPt > 0 ? tc.minPt : 1.f;
226 p.PerPrimaryVertexProcessing = tc.perPrimaryVertexProcessing;
227 for (int iD{0}; iD < 3; ++iD) {
228 p.Diamond[iD] = tc.diamondPos[iD];
229 }
230 p.UseDiamond = tc.useDiamond;
231 }
232
233 if (trackParams.size() > tc.nIterations) {
234 trackParams.resize(tc.nIterations);
235 }
236
237 return trackParams;
238}
239
241{
243 std::vector<VertexingParameters> vertParams;
244 if (mode == TrackingMode::Async) {
245 vertParams.resize(2); // The number of actual iterations will be set as a configKeyVal to allow for pp/PbPb choice
246 vertParams[1].phiCut = 0.015f;
247 vertParams[1].tanLambdaCut = 0.015f;
248 } else if (mode == TrackingMode::Sync) {
249 vertParams.resize(1);
250 } else if (mode == TrackingMode::Cosmics) {
251 vertParams.resize(1);
252 } else {
253 LOGP(fatal, "Unsupported ITS vertexing mode {} ", toString(mode));
254 }
255
256 // global parameters set for every iteration
257 for (auto& p : vertParams) {
258 p.SaveTimeBenchmarks = vc.saveTimeBenchmarks;
259 p.PrintMemory = vc.printMemory;
260 p.MaxMemory = vc.maxMemory;
261 p.DropTFUponFailure = vc.dropTFUponFailure;
262 p.nIterations = vc.nIterations;
263 p.trackletSigma = vc.trackletSigma;
264 p.maxZPositionAllowed = vc.maxZPositionAllowed;
265 p.clusterContributorsCut = vc.clusterContributorsCut;
266 p.suppressLowMultDebris = vc.suppressLowMultDebris;
267 p.seedMemberRadiusTime = vc.seedMemberRadiusTime;
268 p.seedMemberRadiusZ = vc.seedMemberRadiusZ;
269 p.phiSpan = vc.phiSpan;
270 p.nThreads = vc.nThreads;
271 p.ZBins = vc.ZBins;
272 p.PhiBins = vc.PhiBins;
273
274 p.useTruthSeeding = vc.useTruthSeeding;
275 }
276 // set for now outside to not disturb status quo
277 vertParams[0].vertNsigmaCut = vc.vertNsigmaCut;
278 vertParams[0].vertRadiusSigma = vc.vertRadiusSigma;
279 vertParams[0].maxTrackletsPerCluster = vc.maxTrackletsPerCluster;
280 vertParams[0].zCut = vc.zCut;
281 vertParams[0].phiCut = vc.phiCut;
282 vertParams[0].pairCut = vc.pairCut;
283 vertParams[0].clusterCut = vc.clusterCut;
284 vertParams[0].coarseZWindow = vc.coarseZWindow;
285 vertParams[0].seedDedupZCut = vc.seedDedupZCut;
286 vertParams[0].refitDedupZCut = vc.refitDedupZCut;
287 vertParams[0].duplicateZCut = vc.duplicateZCut;
288 vertParams[0].finalSelectionZCut = vc.finalSelectionZCut;
289 vertParams[0].duplicateDistance2Cut = vc.duplicateDistance2Cut;
290 vertParams[0].tanLambdaCut = vc.tanLambdaCut;
291
292 return vertParams;
293}
int32_t i
std::string toString(CoderTag tag)
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Definition Propagator.h:178
GLint GLenum GLint x
Definition glcorearb.h:403
GLenum mode
Definition glcorearb.h:266
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLenum GLfloat param
Definition glcorearb.h:271
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
std::vector< VertexingParameters > getVertexingParameters(Type mode)
Type fromString(std::string_view str)
std::string toString(Type mode)
std::vector< TrackingParameters > getTrackingParameters(Type mode)
constexpr float GB
Definition Constants.h:30
std::string asString() const
std::vector< float > SystErrorY2
std::vector< float > SystErrorZ2
float TrackletMinPt
Trackleting cuts.
std::vector< float > MinPt
std::vector< uint32_t > AddTimeError
std::string asString() const
const std::string str