Project
Loading...
Searching...
No Matches
GPUTPCGMPhysicalTrackModel.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
14
16#include "GPUCommonMath.h"
17
18using namespace o2::gpu;
19
20GPUd() int32_t GPUTPCGMPhysicalTrackModel::PropagateToXBzLight(float x, float Bz, float& GPUrestrict() dLp)
21{
23 if (CAMath::Abs(x - t.X()) < 1.e-8f) {
24 return 0;
25 }
26 int32_t err = t.PropagateToXBzLightNoUpdate(x, Bz, dLp);
27 if (err) {
28 return (err);
29 }
30 t.UpdateValues();
31 *this = t;
32 return 0;
33}
34
35GPUd() int32_t GPUTPCGMPhysicalTrackModel::PropagateToXBzLightNoUpdate(float x, float Bz, float& GPUrestrict() dLp)
36{
37 //
38 // transport the track to X=x in magnetic field B = ( 0, 0, Bz[kG*0.000299792458f] )
39 // dLp is a return value == path length / track momentum [cm/(GeV/c)]
40 // the method returns error code (0 == no error)
41 //
42 // Additional values are not recalculated, UpdateValues() has to be called afterwards!!
43 //
44 float b = mQ * Bz;
45 float pt2 = mPx * mPx + mPy * mPy;
46 float dx = x - mX;
47 float pye = mPy - dx * b; // extrapolated py
48 float pxe2 = pt2 - pye * pye;
49
50 if (mPx < (1.f - constants::MAX_SIN_PHI) || pxe2 < (1.f - constants::MAX_SIN_PHI) * (1.f - constants::MAX_SIN_PHI)) {
51 return -1; // can not transport to x=x
52 }
53 float pxe = CAMath::Sqrt(pxe2); // extrapolated px
54 float pti = 1.f / CAMath::Sqrt(pt2);
55
56 float ty = (mPy + pye) / (mPx + pxe);
57 float dy = dx * ty;
58 float dS; // path in XY
59 {
60 float chord = dx * CAMath::Sqrt(1.f + ty * ty); // chord to the extrapolated point == sqrt(dx^2+dy^2)*sign(dx)
61 float sa = 0.5f * chord * b * pti; // sin( half of the rotation angle ) == (chord/2) / radius
62
63 // dS = (Pt/b)*2*arcsin( sa )
64 // = (Pt/b)*2*sa*(1 + 1/6 sa^2 + 3/40 sa^4 + 5/112 sa^6 +... )
65 // = chord*(1 + 1/6 sa^2 + 3/40 sa^4 + 5/112 sa^6 +... )
66
67 float sa2 = sa * sa;
68 const float k2 = 1.f / 6.f;
69 const float k4 = 3.f / 40.f;
70 // const float k6 = 5.f/112.f;
71 dS = chord + chord * sa2 * (k2 + k4 * sa2);
72 // dS = CAMath::Sqrt(pt2)/b*2.f*CAMath::ASin( sa );
73 }
74
75 dLp = pti * dS; // path in XYZ / p == path in XY / pt
76
77 float dz = mPz * dLp;
78
79 mX = x;
80 mY += dy;
81 mZ += dz;
82 mPx = pxe;
83 mPy = pye;
84 // mPz = mPz;
85 // mQ = mQ;
86 return 0;
87}
88
89GPUd() int32_t GPUTPCGMPhysicalTrackModel::PropagateToXBxByBz(float x, float Bx, float By, float Bz, float& GPUrestrict() dLp)
90{
91 //
92 // transport the track to X=x in magnetic field B = ( Bx, By, Bz )[kG*0.000299792458f]
93 // xyzPxPyPz as well as all the additional values will change. No need to call UpdateValues() afterwards.
94 // the method returns error code (0 == no error)
95 //
96
97 if (0) { // simple transport in Bz for test proposes
98 return PropagateToXBzLight(x, Bz, dLp);
99 }
100 dLp = 0.f;
101
103
104 // Rotate to the system where Bx=By=0.
105
106 float bt = CAMath::Sqrt(Bz * Bz + By * By);
107 float bb = CAMath::Sqrt(Bx * Bx + By * By + Bz * Bz);
108
109 float c1 = 1.f, s1 = 0.f;
110 float c2 = 1.f, s2 = 0.f;
111
112 if (bt > 1.e-4f) {
113 c1 = Bz / bt;
114 s1 = By / bt;
115 c2 = bt / bb;
116 s2 = -Bx / bb;
117 }
118
119 // rotation matrix: first around x, then around y'
120 // after the first rotation: Bx'==Bx, By'==0, Bz'==Bt, X'==X
121 // after the second rotation: Bx''==0, By''==0, Bz''==B, X'' axis is as close as possible to the original X
122
123 //
124 // ( c2 0 s2 ) ( 1 0 0 )
125 // R = ( 0 1 0 ) X ( 0 c1 -s1 )
126 // (-s2 0 c2 ) ( 0 s1 c1 )
127 //
128
129 float R0[3] = {c2, s1 * s2, c1 * s2};
130 float R1[3] = {0, c1, -s1};
131 float R2[3] = {-s2, s1 * c2, c1 * c2};
132
133 // parameters and the extrapolation point in the rotated coordinate system
134 {
135 float lx = t.X(), ly = t.Y(), lz = t.Z(), lpx = t.Px(), lpy = t.Py(), lpz = t.Pz();
136
137 t.X() = R0[0] * lx + R0[1] * ly + R0[2] * lz;
138 t.Y() = R1[0] * lx + R1[1] * ly + R1[2] * lz;
139 t.Z() = R2[0] * lx + R2[1] * ly + R2[2] * lz;
140
141 t.Px() = R0[0] * lpx + R0[1] * lpy + R0[2] * lpz;
142 t.Py() = R1[0] * lpx + R1[1] * lpy + R1[2] * lpz;
143 t.Pz() = R2[0] * lpx + R2[1] * lpy + R2[2] * lpz;
144 }
145
146 float dx = x - mX;
147 float xe = t.X() + dx; // propagate on same dx in rotated system
148
149 // transport in rotated coordinate system to X''=xe:
150
151 if (t.Px() < (1.f - constants::MAX_SIN_PHI)) {
152 t.Px() = 1.f - constants::MAX_SIN_PHI;
153 }
154 if (t.PropagateToXBzLightNoUpdate(xe, bb, dLp) != 0) {
155 return -1;
156 }
157
158 // rotate coordinate system back to the original R{-1}==R{T}
159 {
160 float lx = t.X(), ly = t.Y(), lz = t.Z(), lpx = t.Px(), lpy = t.Py(), lpz = t.Pz();
161
162 t.X() = R0[0] * lx + R1[0] * ly + R2[0] * lz;
163 t.Y() = R0[1] * lx + R1[1] * ly + R2[1] * lz;
164 t.Z() = R0[2] * lx + R1[2] * ly + R2[2] * lz;
165
166 t.Px() = R0[0] * lpx + R1[0] * lpy + R2[0] * lpz;
167 t.Py() = R0[1] * lpx + R1[1] * lpy + R2[1] * lpz;
168 t.Pz() = R0[2] * lpx + R1[2] * lpy + R2[2] * lpz;
169 }
170
171 // a small (hopefully) additional step to X=x. Perhaps it may be replaced by linear extrapolation.
172
173 float ddLp = 0;
174 if (t.Px() < (1.f - constants::MAX_SIN_PHI)) {
175 t.Px() = 1.f - constants::MAX_SIN_PHI;
176 }
177 if (t.PropagateToXBzLightNoUpdate(x, Bz, ddLp) != 0) {
178 return -1;
179 }
180
181 dLp += ddLp;
182
183 t.UpdateValues();
184 *this = t;
185 return 0;
186}
187
188GPUd() int32_t GPUTPCGMPhysicalTrackModel::PropagateToLpBz(float Lp, float Bz)
189{
190 // Lp is path length L over track momentum p in [cm/GeV], Bz in kG*clight
191 //
192 // it is a copy of AliExternalTrackParam: ghelix3 routine.
193 //
194 // the method returns error code (0 == no error)
195 //
196
197 float qfield = mQ * Bz;
198
199 float step = Lp;
200
201 const float kOvSqSix = CAMath::Sqrt(1.f / 6.f);
202
203 float px = mPx;
204 float py = mPy;
205 float pz = mPz;
206
207 float tet = qfield * step;
208
209 float tsint, sintt, sint, cos1t;
210 if (CAMath::Abs(tet) > 0.03f) {
211 sint = CAMath::Sin(tet);
212 sintt = sint / tet;
213 tsint = (tet - sint) / tet;
214 float t = CAMath::Sin(0.5f * tet);
215 cos1t = 2.f * t * t / tet;
216 } else {
217 tsint = tet * tet / 6.f;
218 sintt = (1.f - tet * kOvSqSix) * (1.f + tet * kOvSqSix); // 1.- tsint;
219 sint = tet * sintt;
220 cos1t = 0.5f * tet;
221 }
222
223 float f1 = step * sintt;
224 float f2 = step * cos1t;
225 float f3 = step * tsint;
226 float f4 = -tet * cos1t;
227 float f5 = sint;
228
229 mX += f1 * px - f2 * py;
230 mY += f1 * py + f2 * px;
231 mZ += f1 * pz + f3 * pz;
232
233 mPx += f4 * px - f5 * py;
234 mPy += f4 * py + f5 * px;
235
236 UpdateValues();
237
238 return 0;
239}
240
241#if !defined(GPUCA_GPUCODE)
242#include <iostream>
243#endif
244
245GPUd() void GPUTPCGMPhysicalTrackModel::Print() const
246{
247#if !defined(GPUCA_GPUCODE)
248 std::cout << "GPUTPCGMPhysicalTrackModel: x " << mX << " y " << mY << " z " << mZ << " px " << mPx << " py " << mPy << " pz " << mPz << " q " << mQ << std::endl;
249#endif
250}
#define GPUrestrict()
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
const int16_t bb
GPUd() int32_t GPUTPCGMPhysicalTrackModel
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition glcorearb.h:5034
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GPUdoubleBinary64 b
const float k2
Definition MathUtils.h:75
value_T f3
Definition TrackUtils.h:93
value_T sint
Definition TrackUtils.h:77
value_T f4
Definition TrackUtils.h:94
value_T step
Definition TrackUtils.h:42
value_T f1
Definition TrackUtils.h:91
value_T f5
Definition TrackUtils.h:95
constexpr value_T kOvSqSix
Definition TrackUtils.h:70
value_T sintt
Definition TrackUtils.h:77
value_T f2
Definition TrackUtils.h:92
value_T tet
Definition TrackUtils.h:75
value_T cos1t
Definition TrackUtils.h:77
value_T tsint
Definition TrackUtils.h:77