28#include "GPUParam.inc"
39#include <oneapi/tbb.h>
43#define GET_CID(sector, i) (mIOPtrs->clustersNative->clusterOffset[sector][0] + i)
53 vBuf.first->emplace_back(
first);
54 vBuf.second->emplace_back(last -
first);
56inline void GPUDisplay::insertVertexList(int32_t
iSector,
size_t first,
size_t last)
59 insertVertexList(vBuf,
first, last);
62inline void GPUDisplay::drawPointLinestrip(int32_t
iSector, int32_t cid, int32_t
id, int32_t id_limit)
64 mVertexBuffer[
iSector].emplace_back(mGlobalPos[cid].
x, mGlobalPos[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPos[cid].
z);
66 while ((curVal = mGlobalPos[cid].
w) < id_limit) {
67 if (CAMath::AtomicCAS(&mGlobalPos[cid].
w, curVal, (
float)
id)) {
70 curVal = mGlobalPos[cid].
w;
74GPUDisplay::vboList GPUDisplay::DrawSpacePointsTRD(int32_t
iSector, int32_t
select, int32_t iCol)
76 size_t startCount = mVertexBufferStart[
iSector].size();
77 size_t startCountInner = mVertexBuffer[
iSector].size();
79 if (iCol == 0 && mCurrentSpacePointsTRD > 0) {
84 mVertexBuffer[
iSector].emplace_back(mGlobalPosTRD[
i].
x, mGlobalPosTRD[
i].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTRD[
i].
z);
85 mVertexBuffer[
iSector].emplace_back(mGlobalPosTRD2[
i].
x, mGlobalPosTRD2[
i].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTRD2[
i].
z);
91 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
94GPUDisplay::vboList GPUDisplay::DrawSpacePointsTOF(int32_t
iSector, int32_t
select, int32_t iCol)
96 size_t startCount = mVertexBufferStart[
iSector].size();
97 size_t startCountInner = mVertexBuffer[
iSector].size();
99 if (iCol == 0 &&
iSector == 0) {
101 mVertexBuffer[
iSector].emplace_back(mGlobalPosTOF[
i].
x, mGlobalPosTOF[
i].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTOF[
i].
z);
106 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
109GPUDisplay::vboList GPUDisplay::DrawSpacePointsITS(int32_t
iSector, int32_t
select, int32_t iCol)
111 size_t startCount = mVertexBufferStart[
iSector].size();
112 size_t startCountInner = mVertexBuffer[
iSector].size();
116 mVertexBuffer[
iSector].emplace_back(mGlobalPosITS[
i].
x, mGlobalPosITS[
i].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosITS[
i].
z);
121 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
124void GPUDisplay::DrawClusters(int32_t
iSector)
126 std::vector<std::array<vecpod<vtx>, N_POINTS_TYPE_TPC>> vertexCache(mNCollissions);
128 mClusterBufferSizeCache[
iSector].resize(mNCollissions);
130 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
131 for (int32_t
i = 0;
i < N_POINTS_TYPE_TPC;
i++) {
132 vertexCache[iCol][
i].reserve(mClusterBufferSizeCache[
iSector][iCol][
i]);
139 for (int32_t cidInSector = 0; cidInSector < nClustersInSector; cidInSector++) {
142 if (checkClusterCollision) {
147 if (mOverlayTFClusters.size()) {
148 while (
col < mOverlayTFClusters.size() && cidInSector >= mOverlayTFClusters[
col][
iSector]) {
152 if (mCfgH.hideUnmatchedClusters && mQA && mQA->
SuppressHit(cid)) {
157 if (mCfgH.markAdjacentClusters) {
160 if (mCfgH.markAdjacentClusters >= 32) {
161 if (mQA && mQA->
clusterRemovable(attach, mCfgH.markAdjacentClusters == 33)) {
172 }
else if (mCfgH.markAdjacentClusters & 8) {
178 }
else if (mCfgH.markClusters) {
181 if (
flags & mCfgH.markClusters) {
184 }
else if (mCfgH.markFakeClusters) {
189 vertexCache[
col][
select].emplace_back(mGlobalPos[cid].
x, mGlobalPos[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPos[cid].
z);
192 size_t startCountInner = mVertexBuffer[
iSector].size();
194 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
195 for (int32_t
i = 0;
i < N_POINTS_TYPE_TPC;
i++) {
197 mClusterBufferSizeCache[
iSector][iCol][
i] = std::max(mClusterBufferSizeCache[
iSector][iCol][
i],
count);
199 memcpy((
void*)(mVertexBuffer[
iSector].
data() + startCountInner), (
const void*)vertexCache[iCol][
i].
data(),
count *
sizeof(vertexCache[iCol][
i][0]));
201 size_t startCount = mVertexBufferStart[
iSector].size();
202 insertVertexList(
iSector, startCountInner, startCountInner +
count);
203 startCountInner +=
count;
209GPUDisplay::vboList GPUDisplay::DrawLinks(
const GPUTPCTracker& tracker, int32_t
id,
bool dodown)
212 if (mCfgH.clustersOnly) {
213 return (vboList(0, 0,
iSector));
215 size_t startCount = mVertexBufferStart[
iSector].size();
216 size_t startCountInner = mVertexBuffer[
iSector].size();
217 for (
uint32_t i = 0;
i < GPUTPCGeometry::NROWS;
i++) {
220 if (
i < GPUTPCGeometry::NROWS - 2) {
221 const GPUTPCRow& rowUp = tracker.Data().Row(
i + 2);
226 drawPointLinestrip(
iSector, cid1,
id);
227 drawPointLinestrip(
iSector, cid2,
id);
232 if (dodown &&
i >= 2) {
233 const GPUTPCRow& rowDown = tracker.Data().Row(
i - 2);
238 drawPointLinestrip(
iSector, cid1,
id);
239 drawPointLinestrip(
iSector, cid2,
id);
245 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
248GPUDisplay::vboList GPUDisplay::DrawSeeds(
const GPUTPCTracker& tracker)
251 if (mCfgH.clustersOnly) {
252 return (vboList(0, 0,
iSector));
254 size_t startCount = mVertexBufferStart[
iSector].size();
255 for (
uint32_t i = 0;
i < *tracker.NStartHits();
i++) {
257 size_t startCountInner = mVertexBuffer[
iSector].size();
259 calink ih = hit.HitIndex();
263 drawPointLinestrip(
iSector, cid, tSEED);
265 ih = tracker.Data().HitLinkUpData(
row, ih);
269 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
272GPUDisplay::vboList GPUDisplay::DrawTracklets(
const GPUTPCTracker& tracker)
275 if (mCfgH.clustersOnly) {
276 return (vboList(0, 0,
iSector));
278 size_t startCount = mVertexBufferStart[
iSector].size();
279 for (
uint32_t i = 0;
i < *tracker.NTracklets();
i++) {
281 size_t startCountInner = mVertexBuffer[
iSector].size();
283 for (
uint32_t j = tracklet.FirstRow();
j <= tracklet.LastRow();
j++) {
284 const calink rowHit = tracker.TrackletRowHits()[tracklet.FirstHit() + (
j - tracklet.FirstRow())];
288 oldpos = mGlobalPos[cid];
289 drawPointLinestrip(
iSector, cid, tTRACKLET);
294 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
297GPUDisplay::vboList GPUDisplay::DrawTracks(
const GPUTPCTracker& tracker, int32_t global)
300 if (mCfgH.clustersOnly) {
301 return (vboList(0, 0,
iSector));
303 size_t startCount = mVertexBufferStart[
iSector].size();
304 for (
uint32_t i = (global ? tracker.CommonMemory()->nLocalTracks : 0);
i < (global ? *tracker.NTracks() : tracker.CommonMemory()->nLocalTracks);
i++) {
306 size_t startCountInner = mVertexBuffer[
iSector].size();
307 for (int32_t
j = 0;
j <
track.NHits();
j++) {
309 const GPUTPCRow&
row = tracker.Data().Row(hit.RowIndex());
311 drawPointLinestrip(
iSector, cid, tSECTORTRACK + global);
315 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
318void GPUDisplay::DrawTrackITS(int32_t trackId, int32_t
iSector)
320 const auto& trk = mIOPtrs->
itsTracks[trackId];
321 for (int32_t k = 0; k < trk.getNClusters(); k++) {
323 mVertexBuffer[
iSector].emplace_back(mGlobalPosITS[cid].
x, mGlobalPosITS[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosITS[cid].
z);
324 mGlobalPosITS[cid].
w = tITSATTACHED;
328GPUDisplay::vboList GPUDisplay::DrawFinalITS()
331 size_t startCount = mVertexBufferStart[
iSector].size();
333 if (mITSStandaloneTracks[
i]) {
334 size_t startCountInner = mVertexBuffer[
iSector].size();
339 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
345 auto& vBuf = threadBuffer.vBuf;
346 auto&
buffer = threadBuffer.buffer;
348 if (mCfgH.clustersOnly) {
351 for (
uint32_t ii = 0; ii < nTracks; ii++) {
356 if (ii >= trackList[0].
size()) {
359 i = trackList[0][ii];
361 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
364 }
else if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
371 throw std::runtime_error(
"invalid type");
374 size_t startCountInner = mVertexBuffer[
iSector].size();
375 bool drawing =
false;
378 if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
387 if (mCfgH.trackFilter && !mTrackFilter[
i]) {
392 if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
396 mVertexBuffer[
iSector].emplace_back(mGlobalPosTOF[cid].
x, mGlobalPosTOF[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTOF[cid].
z);
397 mGlobalPosTOF[cid].
w = tTOFATTACHED;
398 lastSide = mGlobalPosTOF[cid].
z < 0;
403 auto tmpDoTRDTracklets = [
this, &drawing, &lastSide,
iSector](
const auto& trk) {
404 for (int32_t k = 5; k >= 0; k--) {
405 int32_t cid = trk.getTrackletIndex(k);
410 mVertexBuffer[
iSector].emplace_back(mGlobalPosTRD2[cid].
x, mGlobalPosTRD2[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTRD2[cid].
z);
411 mVertexBuffer[
iSector].emplace_back(mGlobalPosTRD[cid].
x, mGlobalPosTRD[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTRD[cid].
z);
412 lastSide = mGlobalPosTRD[cid].
z < 0;
413 mGlobalPosTRD[cid].
w = tTRDATTACHED;
419 tmpDoTRDTracklets(mIOPtrs->
trdTracksO2[mTRDTrackIds[
i]]);
421 tmpDoTRDTracklets(mIOPtrs->
trdTracks[mTRDTrackIds[
i]]);
424 }
else if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
428 const auto& trk = container[mIOPtrs->
tpcLinkTRD[
i] & 0x3FFFFFFF];
429 tmpDoTRDTracklets(trk);
435 int32_t separateExtrapolatedTracksLimit = (mCfgH.separateExtrapolatedTracks ? tEXTRAPOLATEDTRACK : TRACK_TYPE_ID_LIMIT);
436 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
437 if (
track->PrevSegment() >= 0) {
439 for (int32_t iChk = prevtrk.NClusters() - 1; iChk >= 0; iChk--) {
440 const auto& hit = mIOPtrs->
mergedTrackHits[prevtrk.FirstClusterRef() + iChk];
442 drawPointLinestrip(
iSector, hit.num, tFINALTRACK, separateExtrapolatedTracksLimit);
443 lastSide = mGlobalPos[hit.num].
z < 0;
451 for (int32_t k = 0; k <
nClusters; k++) {
452 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
458 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
465 if (mCfgH.splitCETracks && lastSide != (mGlobalPos[cid].z < 0)) {
466 insertVertexList(vBuf[0], startCountInner, mVertexBuffer[
iSector].
size());
470 drawPointLinestrip(
iSector, cid, tFINALTRACK, separateExtrapolatedTracksLimit);
473 if (
w == separateExtrapolatedTracksLimit) {
475 insertVertexList(vBuf[0], startCountInner, mVertexBuffer[
iSector].
size());
480 startCountInner = mVertexBuffer[
iSector].size();
481 if (lastCluster != -1 && (!mCfgH.splitCETracks || lastSide == (mGlobalPos[cid].z < 0))) {
483 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
488 drawPointLinestrip(
iSector, lastcid, tFINALTRACK, separateExtrapolatedTracksLimit);
490 drawPointLinestrip(
iSector, cid, tFINALTRACK, separateExtrapolatedTracksLimit);
495 lastSide = mGlobalPos[cid].
z < 0;
499 if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
504 insertVertexList(vBuf[0], startCountInner, mVertexBuffer[
iSector].
size());
511 if (mCfgL.propagateTracks == 0) {
516 for (int32_t iMC = 0; iMC < 2; iMC++) {
518 if (ii >= trackList[1].
size()) {
521 i = trackList[1][ii];
523 if (track ==
nullptr) {
526 if (lastCluster == -1) {
529 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
530 if (
track->MergedLooperConnected()) {
536 size_t startCountInner = mVertexBuffer[
iSector].size();
537 for (int32_t inFlyDirection = 0; inFlyDirection < 2; inFlyDirection++) {
546 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
547 trkParam.Set(
track->GetParam());
548 alphaOrg = mParam->Alpha(
iSector);
551 convertTrackParam(
t, *track);
552 alphaOrg =
track->getAlpha();
557 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
560 GPUTPCConvertImpl::convert(*mCalib->
fastTransform, *mParam, cl.sector, cl.row, cln.getPad(), cln.getTime(),
x,
y,
z);
577 if (mc.
t0 == -100.f) {
581 alphaOrg = mParam->Alpha(
iSector);
582 float c = cosf(alphaOrg);
583 float s = sinf(alphaOrg);
587 mclocal[0] =
x *
c +
y *
s;
588 mclocal[1] = -
x *
s +
y *
c;
591 mclocal[2] = px *
c + py *
s;
592 mclocal[3] = -px *
s + py *
c;
597 trkParam.Set(mclocal[0], mclocal[1], mc.
z, mclocal[2], mclocal[3], mc.
pZ, -
charge);
598 if (mParam->
par.continuousTracking) {
602 if (fabsf(mc.
z) > GPUTPCGeometry::TPCLength()) {
603 ZOffset = mc.
z > 0 ? (mc.
z - GPUTPCGeometry::TPCLength()) : (mc.
z +
GPUTPCGeometry::TPCLength());
605 trkParam.Set(mclocal[0], mclocal[1], mc.
z - ZOffset, mclocal[2], mclocal[3], mc.
pZ,
charge);
608 float z0 = trkParam.
Z();
609 if (iMC && inFlyDirection == 0) {
615 if (fabsf(trkParam.SinPhi()) > 1) {
618 float alpha = alphaOrg;
622 while (nPoints++ < 5000) {
623 if ((inFlyDirection == 0 &&
x < 0) || (inFlyDirection &&
x *
x + trkParam.
Y() * trkParam.
Y() > (iMC ? (450 * 450) : (300 * 300)))) {
626 if (fabsf(trkParam.
Z() + ZOffset) > mMaxClusterZ) {
629 if (fabsf(trkParam.
Z() - z0) > (iMC ? GPUTPCGeometry::TPCLength() :
GPUTPCGeometry::TPCLength())) {
632 if (inFlyDirection) {
633 if (fabsf(trkParam.SinPhi()) > 0.4f) {
634 float dalpha = asinf(trkParam.SinPhi());
635 trkParam.Rotate(dalpha);
638 x = trkParam.X() + 1.f;
639 if (!mCfgH.propagateLoopers) {
640 float diff = fabsf(
alpha - alphaOrg) / (2.f * CAMath::Pi());
642 if (diff > 0.25f && diff < 0.75f) {
648 prop->GetBxByBz(
alpha, trkParam.GetX(), trkParam.GetY(), trkParam.GetZ(),
B);
650 if (trkParam.PropagateToXBxByBz(
x,
B[0],
B[1],
B[2], dLp)) {
653 if (fabsf(trkParam.SinPhi()) > 0.9f) {
657 float drawX = trkParam.X() + mCfgH.xzAdd;
658 useBuffer.emplace_back((ca * drawX - sa * trkParam.
Y()) * GL_SCALE_FACTOR, (ca * trkParam.
Y() + sa * drawX) * mYFactor * GL_SCALE_FACTOR, mCfgH.projectXY ? 0 : (trkParam.Z() + ZOffset) * GL_SCALE_FACTOR);
659 x += inFlyDirection ? 1 : -1;
662 if (inFlyDirection == 0) {
664 for (int32_t k = (int32_t)
buffer.size() - 1; k >= 0; k--) {
668 insertVertexList(vBuf[1], startCountInner, mVertexBuffer[
iSector].
size());
669 startCountInner = mVertexBuffer[
iSector].size();
673 insertVertexList(vBuf[iMC ? 3 : 2], startCountInner, mVertexBuffer[
iSector].
size());
678GPUDisplay::vboList GPUDisplay::DrawGrid(
const GPUTPCTracker& tracker)
681 size_t startCount = mVertexBufferStart[
iSector].size();
682 size_t startCountInner = mVertexBuffer[
iSector].size();
683 for (
uint32_t i = 0;
i < GPUTPCGeometry::NROWS;
i++) {
685 for (int32_t
j = 0;
j <= (signed)
row.Grid().Ny();
j++) {
686 float z1 =
row.Grid().ZMin();
687 float z2 =
row.Grid().ZMax();
688 float x =
row.X() + mCfgH.xzAdd;
689 float y =
row.Grid().YMin() + (
float)
j /
row.Grid().StepYInv();
690 float zz1, zz2, yy1, yy2, xx1, xx2;
691 mParam->Sector2Global(tracker.ISector(),
x,
y,
z1, &xx1, &yy1, &zz1);
692 mParam->Sector2Global(tracker.ISector(),
x,
y,
z2, &xx2, &yy2, &zz2);
700 mVertexBuffer[
iSector].emplace_back(xx1 * GL_SCALE_FACTOR, yy1 * GL_SCALE_FACTOR * mYFactor, zz1 * GL_SCALE_FACTOR);
701 mVertexBuffer[
iSector].emplace_back(xx2 * GL_SCALE_FACTOR, yy2 * GL_SCALE_FACTOR * mYFactor, zz2 * GL_SCALE_FACTOR);
703 for (int32_t
j = 0;
j <= (signed)
row.Grid().Nz();
j++) {
704 float y1 =
row.Grid().YMin();
705 float y2 =
row.Grid().YMax();
706 float x =
row.X() + mCfgH.xzAdd;
707 float z =
row.Grid().ZMin() + (
float)
j /
row.Grid().StepZInv();
708 float zz1, zz2, yy1, yy2, xx1, xx2;
709 mParam->Sector2Global(tracker.ISector(),
x,
y1,
z, &xx1, &yy1, &zz1);
710 mParam->Sector2Global(tracker.ISector(),
x,
y2,
z, &xx2, &yy2, &zz2);
718 mVertexBuffer[
iSector].emplace_back(xx1 * GL_SCALE_FACTOR, yy1 * GL_SCALE_FACTOR * mYFactor, zz1 * GL_SCALE_FACTOR);
719 mVertexBuffer[
iSector].emplace_back(xx2 * GL_SCALE_FACTOR, yy2 * GL_SCALE_FACTOR * mYFactor, zz2 * GL_SCALE_FACTOR);
722 insertVertexList(tracker.ISector(), startCountInner, mVertexBuffer[
iSector].size());
723 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
726GPUDisplay::vboList GPUDisplay::DrawGridTRD(int32_t
sector)
729 size_t startCount = mVertexBufferStart[
sector].size();
730 size_t startCountInner = mVertexBuffer[
sector].size();
731 auto* geo = trdGeometry();
734 float alpha = geo->GetAlpha() / 2.f + geo->GetAlpha() * trdsector;
735 if (trdsector >= 9) {
736 alpha -= 2 * CAMath::Pi();
740 int32_t iDet = geo->GetDetector(iLy, iStack, trdsector);
741 auto matrix = geo->GetClusterMatrix(iDet);
745 auto pp = geo->GetPadPlane(iDet);
746 for (int32_t
i = 0;
i <
pp->GetNrows();
i++) {
751 xyzLoc1[0] = xyzLoc2[0] = geo->AnodePos();
752 xyzLoc1[1] =
pp->GetCol0();
753 xyzLoc2[1] =
pp->GetColEnd();
754 xyzLoc1[2] = xyzLoc2[2] =
pp->GetRowPos(
i) -
pp->GetRowPos(
pp->GetNrows() / 2);
755 matrix->LocalToMaster(xyzLoc1, xyzGlb1);
756 matrix->LocalToMaster(xyzLoc2, xyzGlb2);
757 float x1Tmp = xyzGlb1[0];
758 xyzGlb1[0] = xyzGlb1[0] * cosf(
alpha) + xyzGlb1[1] * sinf(
alpha);
759 xyzGlb1[1] = -x1Tmp * sinf(
alpha) + xyzGlb1[1] * cosf(
alpha);
760 float x2Tmp = xyzGlb2[0];
761 xyzGlb2[0] = xyzGlb2[0] * cosf(
alpha) + xyzGlb2[1] * sinf(
alpha);
762 xyzGlb2[1] = -x2Tmp * sinf(
alpha) + xyzGlb2[1] * cosf(
alpha);
763 mVertexBuffer[
sector].emplace_back(xyzGlb1[0] * GL_SCALE_FACTOR, xyzGlb1[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb1[2] * GL_SCALE_FACTOR);
764 mVertexBuffer[
sector].emplace_back(xyzGlb2[0] * GL_SCALE_FACTOR, xyzGlb2[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb2[2] * GL_SCALE_FACTOR);
766 for (int32_t
j = 0;
j <
pp->GetNcols(); ++
j) {
771 xyzLoc1[0] = xyzLoc2[0] = geo->AnodePos();
772 xyzLoc1[1] = xyzLoc2[1] =
pp->GetColPos(
j) +
pp->GetColSize(
j) / 2.f;
773 xyzLoc1[2] =
pp->GetRow0() -
pp->GetRowPos(
pp->GetNrows() / 2);
774 xyzLoc2[2] =
pp->GetRowEnd() -
pp->GetRowPos(
pp->GetNrows() / 2);
775 matrix->LocalToMaster(xyzLoc1, xyzGlb1);
776 matrix->LocalToMaster(xyzLoc2, xyzGlb2);
777 float x1Tmp = xyzGlb1[0];
778 xyzGlb1[0] = xyzGlb1[0] * cosf(
alpha) + xyzGlb1[1] * sinf(
alpha);
779 xyzGlb1[1] = -x1Tmp * sinf(
alpha) + xyzGlb1[1] * cosf(
alpha);
780 float x2Tmp = xyzGlb2[0];
781 xyzGlb2[0] = xyzGlb2[0] * cosf(
alpha) + xyzGlb2[1] * sinf(
alpha);
782 xyzGlb2[1] = -x2Tmp * sinf(
alpha) + xyzGlb2[1] * cosf(
alpha);
783 mVertexBuffer[
sector].emplace_back(xyzGlb1[0] * GL_SCALE_FACTOR, xyzGlb1[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb1[2] * GL_SCALE_FACTOR);
784 mVertexBuffer[
sector].emplace_back(xyzGlb2[0] * GL_SCALE_FACTOR, xyzGlb2[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb2[2] * GL_SCALE_FACTOR);
790 return (vboList(startCount, mVertexBufferStart[
sector].
size() - startCount,
sector));
793size_t GPUDisplay::DrawGLScene_updateVertexList()
796 for (int32_t
i = 0;
i < NSECTORS;
i++) {
797 mVertexBuffer[
i].clear();
798 mVertexBufferStart[
i].clear();
799 mVertexBufferCount[
i].clear();
802 for (int32_t
i = 0;
i < mCurrentClusters;
i++) {
803 mGlobalPos[
i].
w = tCLUSTER;
805 for (int32_t
i = 0;
i < mCurrentSpacePointsTRD;
i++) {
806 mGlobalPosTRD[
i].
w = tTRDCLUSTER;
810 for (int32_t
i = 0;
i < N_POINTS_TYPE;
i++) {
811 mGlDLPoints[
iSector][
i].resize(mNCollissions);
813 for (int32_t
i = 0;
i < N_FINAL_TYPE;
i++) {
814 mGlDLFinal[
iSector].resize(mNCollissions);
817 if (timer.IsRunning()) {
818 GPUInfo(
"Display Time: Vertex Init:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
821 int32_t numThreads = getNumThreads();
822 tbb::task_arena(numThreads).execute([
this, &timer, numThreads] {
824 tbb::parallel_for(0, NSECTORS, [this](int32_t iSector) {
825 GPUTPCTracker& tracker = (GPUTPCTracker&)sectorTracker(iSector);
826 tracker.SetPointersDataLinks(tracker.LinkTmpMemory());
827 mGlDLLines[iSector][tINITLINK] = DrawLinks(tracker, tINITLINK, true);
828 tracker.SetPointersDataLinks(mChain->rec()->Res(tracker.MemoryResLinks()).Ptr());
829 }, tbb::simple_partitioner());
830 if (timer.IsRunning()) {
831 GPUInfo(
"Display Time: Vertex Links:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
834 tbb::parallel_for(0, NSECTORS, [
this](int32_t
iSector) {
837 mGlDLLines[
iSector][tLINK] = DrawLinks(tracker, tLINK);
838 mGlDLLines[
iSector][tSEED] = DrawSeeds(tracker);
839 mGlDLLines[
iSector][tTRACKLET] = DrawTracklets(tracker);
840 mGlDLLines[
iSector][tSECTORTRACK] = DrawTracks(tracker, 0);
841 mGlDLGrid[
iSector] = DrawGrid(tracker);
845 }, tbb::simple_partitioner());
846 if (timer.IsRunning()) {
847 GPUInfo(
"Display Time: Vertex Seeds:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
850 tbb::parallel_for(0, NSECTORS, [
this](int32_t
iSector) {
852 mGlDLLines[
iSector][tEXTRAPOLATEDTRACK] = DrawTracks(tracker, 1);
853 }, tbb::simple_partitioner());
854 if (timer.IsRunning()) {
855 GPUInfo(
"Display Time: Vertex Sector Tracks:\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
858 tbb::parallel_for(0, numThreads, [
this](int32_t iThread) {
859 mThreadTracks[iThread].resize(mNCollissions);
860 for (int32_t
i = 0;
i < mNCollissions;
i++) {
861 for (int32_t
j = 0;
j < NSECTORS;
j++) {
862 for (int32_t k = 0; k < 2; k++) {
863 mThreadTracks[iThread][
i][
j][k].clear();
867 }, tbb::simple_partitioner());
868 if (mConfig.showTPCTracksFromO2Format) {
873 if (mIOPtrs->clustersNative) {
874 mIOPtrs->outputTracksTPCO2[i].getCluster(mIOPtrs->outputClusRefsTPCO2, 0, *mIOPtrs->clustersNative, sector, row);
879 col = mQA->GetMCLabelCol(mIOPtrs->outputTracksTPCO2MC[i]);
885 tbb::parallel_for<uint32_t>(0, mIOPtrs->nMergedTracks, [
this](
auto i) {
886 const GPUTPCGMMergedTrack* track = &mIOPtrs->mergedTracks[i];
887 if (track->NClusters() == 0) {
890 if (mCfgH.hideRejectedTracks && !
track->OK()) {
893 int32_t
sector = mIOPtrs->mergedTrackHits[
track->FirstClusterRef() +
track->NClusters() - 1].sector;
896 const auto&
label = mQA->GetMCTrackLabel(
i);
900 while (
label.isValid() &&
col < mOverlayTFClusters.size() && mOverlayTFClusters[
col][NSECTORS] <
label.track) {
909 tbb::parallel_for(mIOPtrs->mcInfosTPCCol[
col].first, mIOPtrs->mcInfosTPCCol[
col].first + mIOPtrs->mcInfosTPCCol[
col].num, [
this,
col](
uint32_t i) {
910 const GPUTPCMCInfo& mc = mIOPtrs->mcInfosTPC[i];
911 if (mc.charge == 0.f) {
918 float alpha = atan2f(mc.
y, mc.
x);
920 alpha += 2 * CAMath::Pi();
929 if (timer.IsRunning()) {
930 GPUInfo(
"Display Time: Vertex Sort merged tracks:\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
934 prop.SetMaxSinPhi(.999);
935 prop.SetMaterialTPC();
936 prop.SetPolynomialField(&mParam->polynomialField);
938 tbb::parallel_for(0, NSECTORS, [
this, numThreads, prop](int32_t
iSector) {
940 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
941 mThreadBuffers[numThread].clear();
942 for (int32_t iSet = 0; iSet < numThreads; iSet++) {
943 if (mConfig.showTPCTracksFromO2Format) {
944 DrawFinal<o2::tpc::TrackTPC>(
iSector, iCol, &prop, mThreadTracks[iSet][iCol][
iSector], mThreadBuffers[numThread]);
946 DrawFinal<GPUTPCGMMergedTrack>(
iSector, iCol, &prop, mThreadTracks[iSet][iCol][
iSector], mThreadBuffers[numThread]);
950 for (int32_t
i = 0;
i < N_FINAL_TYPE;
i++) {
951 size_t startCount = mVertexBufferStart[
iSector].size();
952 for (
uint32_t j = 0;
j < mThreadBuffers[numThread].start[
i].size();
j++) {
953 mVertexBufferStart[
iSector].emplace_back(mThreadBuffers[numThread].
start[
i][
j]);
954 mVertexBufferCount[
iSector].emplace_back(mThreadBuffers[numThread].
count[
i][
j]);
959 }, tbb::simple_partitioner());
960 if (timer.IsRunning()) {
961 GPUInfo(
"Display Time: Vertex Merged Tracks:\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
964 tbb::parallel_for(0, NSECTORS, [
this](int32_t
iSector) {
966 }, tbb::simple_partitioner());
967 if (timer.IsRunning()) {
968 GPUInfo(
"Display Time: Vertex Clusters:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
973 mGlDLFinalITS = DrawFinalITS();
975 for (int32_t
i = N_POINTS_TYPE_TPC + N_POINTS_TYPE_TRD + N_POINTS_TYPE_TOF;
i < N_POINTS_TYPE_TPC + N_POINTS_TYPE_TRD + N_POINTS_TYPE_TOF + N_POINTS_TYPE_ITS;
i++) {
976 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
984 if (timer.IsRunning()) {
985 GPUInfo(
"Display Time: Vertex ITS:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
989 for (int32_t
i = N_POINTS_TYPE_TPC;
i < N_POINTS_TYPE_TPC + N_POINTS_TYPE_TRD;
i++) {
990 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
995 if (timer.IsRunning()) {
996 GPUInfo(
"Display Time: Vertex TRD:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
1000 for (int32_t
i = N_POINTS_TYPE_TPC + N_POINTS_TYPE_TRD;
i < N_POINTS_TYPE_TPC + N_POINTS_TYPE_TRD + N_POINTS_TYPE_TOF;
i++) {
1001 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
1008 if (timer.IsRunning()) {
1009 GPUInfo(
"Display Time: Vertex TOF:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
1012 mTracksArePropagated = mCfgL.propagateTracks != 0;
1013 mUpdateVertexLists =
false;
1014 size_t totalVertizes = 0;
1015 for (int32_t
i = 0;
i < NSECTORS;
i++) {
1016 totalVertizes += mVertexBuffer[
i].size();
1018 if (totalVertizes > 0xFFFFFFFF) {
1019 throw std::runtime_error(
"Display vertex count exceeds 32bit uint32_t counter");
1021 size_t needMultiVBOSize = mBackend->needMultiVBO();
1022 mUseMultiVBO = needMultiVBOSize && (totalVertizes *
sizeof(mVertexBuffer[0][0]) >= needMultiVBOSize);
1023 if (!mUseMultiVBO) {
1024 size_t totalYet = mVertexBuffer[0].size();
1025 mVertexBuffer[0].resize(totalVertizes);
1026 for (
uint32_t i = 1;
i < GPUTPCGeometry::NSECTORS;
i++) {
1027 for (
uint32_t j = 0;
j < mVertexBufferStart[
i].size();
j++) {
1028 mVertexBufferStart[
i][
j] += totalYet;
1030 memcpy(&mVertexBuffer[0][totalYet], &mVertexBuffer[
i][0], mVertexBuffer[
i].
size() *
sizeof(mVertexBuffer[
i][0]));
1031 totalYet += mVertexBuffer[
i].size();
1032 mVertexBuffer[
i].clear();
1035 mBackend->loadDataToGPU(totalVertizes);
1036 for (
uint32_t i = 0;
i < (mUseMultiVBO ? GPUTPCGeometry::NSECTORS : 1);
i++) {
1037 mVertexBuffer[
i].clear();
1039 if (timer.IsRunning()) {
1040 GPUInfo(
"Display Time: Vertex Final:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
1043 return totalVertizes;
A const (ready only) version of MCTruthContainer.
#define GET_CID(sector, i)
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char pp
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
configStandalone Reconstruction rec_tpc float
#define CALINK_DEAD_CHANNEL
Online TRD tracker based on extrapolated TPC tracks.
TRD Tracklet word for GPU tracker - 32bit tracklet info + half chamber ID + index.
std::vector< o2::MCCompLabel > labels
Definition of the ITS track.
GPUReconstruction::RecoStepField GetRecoSteps() const
const GPUSettingsProcessing & GetProcessingSettings() const
const GPUConstantMem * GetProcessors() const
const GPUSettingsProcessing & GetProcessingSettings() const
bool clusterRemovable(int32_t attach, bool prot) const
int32_t HitAttachStatus(int32_t iHit) const
bool SuppressHit(int32_t iHit) const
static int32_t getHostThreadIndex()
GLfloat GLfloat GLfloat alpha
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLsizei const GLchar * label
GLubyte GLubyte GLubyte GLubyte w
GLdouble GLdouble GLdouble z
bool list(IEventListener &reporter, Config const &config)
std::vector< InputSpec > select(char const *matcher="")
float float float float float z2
float float float float z1
const bool const int TrackITSInternal< NLayers > & track
if(!okForPhiMin(phi0, phi1))
S< o2::trd::GeometryFlat >::type * trdGeometry
S< TPCFastTransformPOD >::type * fastTransform
GPUTPCTracker tpcTrackers[GPUTPCGeometry::NSECTORS]
const o2::tpc::ClusterNativeAccess * clustersNative
const GPUTPCMCInfo * mcInfosTPC
const uint32_t * outputClusRefsTPCO2
const int32_t * itsTrackClusIdx
const o2::BaseCluster< float > * itsClusters
const uint32_t * mergedTrackHitAttachment
const GPUTRDTrackGPU * trdTracks
uint32_t nTRDTracksTPCTRD
const GPUTRDTrackletWord * trdTracklets
const GPUTRDTrack * trdTracksO2
const o2::its::TrackITS * itsTracks
const o2::MCCompLabel * outputTracksTPCO2MC
uint32_t nOutputTracksTPCO2
const o2::tpc::TrackTPC * outputTracksTPCO2
const GPUTPCGMMergedTrackHit * mergedTrackHits
const GPUTRDTrack * trdTracksITSTPCTRD
uint32_t nTRDTracksITSTPCTRD
const GPUTPCGMMergedTrack * mergedTracks
int32_t continuousMaxTimeBin
unsigned int nClustersSector[constants::MAXSECTOR]
const o2::dataformats::ConstMCTruthContainerView< o2::MCCompLabel > * clustersMCTruth
const ClusterNative * clustersLinear
o2::InteractionRecord ir(0, 0)
typename std::vector< T, vecpod_allocator< T > > vecpod