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) {
81 int32_t iSec = trdGeometry()->GetSector(mIOPtrs->
trdTracklets[
i].GetDetector());
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);
127 if (mClusterBufferSizeCache[
iSector].
size() < (uint32_t)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)) {
155 int32_t
select = mGlobalPos[cid].
w;
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++) {
196 uint32_t
count = vertexCache[iCol][
i].size();
197 mClusterBufferSizeCache[
iSector][iCol][
i] = std::max(mClusterBufferSizeCache[
iSector][iCol][
i],
count);
198 memcpy((
void*)(mVertexBuffer[
iSector].
data() + startCountInner), (
const void*)vertexCache[iCol][
i].
data(),
count *
sizeof(vertexCache[iCol][
i][0]));
199 size_t startCount = mVertexBufferStart[
iSector].size();
200 insertVertexList(
iSector, startCountInner, startCountInner +
count);
201 startCountInner +=
count;
207GPUDisplay::vboList GPUDisplay::DrawLinks(
const GPUTPCTracker& tracker, int32_t
id,
bool dodown)
209 uint32_t
iSector = tracker.ISector();
210 if (mCfgH.clustersOnly) {
211 return (vboList(0, 0,
iSector));
213 size_t startCount = mVertexBufferStart[
iSector].size();
214 size_t startCountInner = mVertexBuffer[
iSector].size();
219 const GPUTPCRow& rowUp = tracker.Data().Row(
i + 2);
220 for (uint32_t
j = 0;
j <
row.NHits();
j++) {
223 const int32_t cid2 =
GET_CID(
iSector, tracker.Data().ClusterDataIndex(rowUp, tracker.Data().HitLinkUpData(
row,
j)));
224 drawPointLinestrip(
iSector, cid1,
id);
225 drawPointLinestrip(
iSector, cid2,
id);
230 if (dodown &&
i >= 2) {
231 const GPUTPCRow& rowDown = tracker.Data().Row(
i - 2);
232 for (uint32_t
j = 0;
j <
row.NHits();
j++) {
235 const int32_t cid2 =
GET_CID(
iSector, tracker.Data().ClusterDataIndex(rowDown, tracker.Data().HitLinkDownData(
row,
j)));
236 drawPointLinestrip(
iSector, cid1,
id);
237 drawPointLinestrip(
iSector, cid2,
id);
243 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
246GPUDisplay::vboList GPUDisplay::DrawSeeds(
const GPUTPCTracker& tracker)
248 uint32_t
iSector = tracker.ISector();
249 if (mCfgH.clustersOnly) {
250 return (vboList(0, 0,
iSector));
252 size_t startCount = mVertexBufferStart[
iSector].size();
253 for (uint32_t
i = 0;
i < *tracker.NStartHits();
i++) {
255 size_t startCountInner = mVertexBuffer[
iSector].size();
256 int32_t
ir = hit.RowIndex();
257 calink ih = hit.HitIndex();
261 drawPointLinestrip(
iSector, cid, tSEED);
263 ih = tracker.Data().HitLinkUpData(
row, ih);
267 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
270GPUDisplay::vboList GPUDisplay::DrawTracklets(
const GPUTPCTracker& tracker)
272 uint32_t
iSector = tracker.ISector();
273 if (mCfgH.clustersOnly) {
274 return (vboList(0, 0,
iSector));
276 size_t startCount = mVertexBufferStart[
iSector].size();
277 for (uint32_t
i = 0;
i < *tracker.NTracklets();
i++) {
279 size_t startCountInner = mVertexBuffer[
iSector].size();
281 for (uint32_t
j = tracklet.FirstRow();
j <= tracklet.LastRow();
j++) {
282 const calink rowHit = tracker.TrackletRowHits()[tracklet.FirstHit() + (
j - tracklet.FirstRow())];
285 const int32_t cid =
GET_CID(
iSector, tracker.Data().ClusterDataIndex(
row, rowHit));
286 oldpos = mGlobalPos[cid];
287 drawPointLinestrip(
iSector, cid, tTRACKLET);
292 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
295GPUDisplay::vboList GPUDisplay::DrawTracks(
const GPUTPCTracker& tracker, int32_t global)
297 uint32_t
iSector = tracker.ISector();
298 if (mCfgH.clustersOnly) {
299 return (vboList(0, 0,
iSector));
301 size_t startCount = mVertexBufferStart[
iSector].size();
302 for (uint32_t
i = (global ? tracker.CommonMemory()->nLocalTracks : 0);
i < (global ? *tracker.NTracks() : tracker.CommonMemory()->nLocalTracks);
i++) {
304 size_t startCountInner = mVertexBuffer[
iSector].size();
305 for (int32_t
j = 0;
j < track.NHits();
j++) {
306 const GPUTPCHitId& hit = tracker.TrackHits()[track.FirstHitID() +
j];
307 const GPUTPCRow&
row = tracker.Data().Row(hit.RowIndex());
308 const int32_t cid =
GET_CID(
iSector, tracker.Data().ClusterDataIndex(
row, hit.HitIndex()));
309 drawPointLinestrip(
iSector, cid, tSECTORTRACK + global);
313 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
316void GPUDisplay::DrawTrackITS(int32_t trackId, int32_t
iSector)
318 const auto& trk = mIOPtrs->
itsTracks[trackId];
319 for (int32_t k = 0; k < trk.getNClusters(); k++) {
320 int32_t cid = mIOPtrs->
itsTrackClusIdx[trk.getFirstClusterEntry() + k];
321 mVertexBuffer[
iSector].emplace_back(mGlobalPosITS[cid].
x, mGlobalPosITS[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosITS[cid].
z);
322 mGlobalPosITS[cid].
w = tITSATTACHED;
326GPUDisplay::vboList GPUDisplay::DrawFinalITS()
329 size_t startCount = mVertexBufferStart[
iSector].size();
331 if (mITSStandaloneTracks[
i]) {
332 size_t startCountInner = mVertexBuffer[
iSector].size();
337 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
343 auto& vBuf = threadBuffer.vBuf;
344 auto&
buffer = threadBuffer.buffer;
345 uint32_t nTracks = std::max(trackList[0].
size(), trackList[1].
size());
346 if (mCfgH.clustersOnly) {
349 for (uint32_t ii = 0; ii < nTracks; ii++) {
351 const T* track =
nullptr;
352 int32_t lastCluster = -1;
354 if (ii >= trackList[0].
size()) {
357 i = trackList[0][ii];
359 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
362 }
else if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
369 throw std::runtime_error(
"invalid type");
372 size_t startCountInner = mVertexBuffer[
iSector].size();
373 bool drawing =
false;
374 uint32_t lastSide = -1;
376 if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
385 if (mCfgH.trackFilter && !mTrackFilter[
i]) {
390 if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
394 mVertexBuffer[
iSector].emplace_back(mGlobalPosTOF[cid].
x, mGlobalPosTOF[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTOF[cid].
z);
395 mGlobalPosTOF[cid].
w = tTOFATTACHED;
396 lastSide = mGlobalPosTOF[cid].
z < 0;
401 auto tmpDoTRDTracklets = [&](
const auto& trk) {
402 for (int32_t k = 5; k >= 0; k--) {
403 int32_t cid = trk.getTrackletIndex(k);
408 mVertexBuffer[
iSector].emplace_back(mGlobalPosTRD2[cid].
x, mGlobalPosTRD2[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTRD2[cid].
z);
409 mVertexBuffer[
iSector].emplace_back(mGlobalPosTRD[cid].
x, mGlobalPosTRD[cid].
y * mYFactor, mCfgH.projectXY ? 0 : mGlobalPosTRD[cid].
z);
410 lastSide = mGlobalPosTRD[cid].
z < 0;
411 mGlobalPosTRD[cid].
w = tTRDATTACHED;
417 tmpDoTRDTracklets(mIOPtrs->
trdTracksO2[mTRDTrackIds[
i]]);
419 tmpDoTRDTracklets(mIOPtrs->
trdTracks[mTRDTrackIds[
i]]);
422 }
else if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
426 const auto& trk = container[mIOPtrs->
tpcLinkTRD[
i] & 0x3FFFFFFF];
427 tmpDoTRDTracklets(trk);
433 int32_t separateExtrapolatedTracksLimit = (mCfgH.separateExtrapolatedTracks ? tEXTRAPOLATEDTRACK : TRACK_TYPE_ID_LIMIT);
434 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
435 if (track->PrevSegment() >= 0) {
436 const auto& prevtrk = mIOPtrs->
mergedTracks[track->PrevSegment()];
437 for (int32_t iChk = prevtrk.NClusters() - 1; iChk >= 0; iChk--) {
438 const auto& hit = mIOPtrs->
mergedTrackHits[prevtrk.FirstClusterRef() + iChk];
440 drawPointLinestrip(
iSector, hit.num, tFINALTRACK, separateExtrapolatedTracksLimit);
441 lastSide = mGlobalPos[hit.num].
z < 0;
449 for (int32_t k = 0; k <
nClusters; k++) {
450 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
456 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
461 int32_t
w = mGlobalPos[cid].
w;
463 if (mCfgH.splitCETracks && lastSide != (mGlobalPos[cid].z < 0)) {
464 insertVertexList(vBuf[0], startCountInner, mVertexBuffer[
iSector].
size());
468 drawPointLinestrip(
iSector, cid, tFINALTRACK, separateExtrapolatedTracksLimit);
471 if (
w == separateExtrapolatedTracksLimit) {
473 insertVertexList(vBuf[0], startCountInner, mVertexBuffer[
iSector].
size());
478 startCountInner = mVertexBuffer[
iSector].size();
479 if (lastCluster != -1 && (!mCfgH.splitCETracks || lastSide == (mGlobalPos[cid].z < 0))) {
481 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
486 drawPointLinestrip(
iSector, lastcid, tFINALTRACK, separateExtrapolatedTracksLimit);
488 drawPointLinestrip(
iSector, cid, tFINALTRACK, separateExtrapolatedTracksLimit);
493 lastSide = mGlobalPos[cid].
z < 0;
497 if constexpr (std::is_same_v<T, o2::tpc::TrackTPC>) {
502 insertVertexList(vBuf[0], startCountInner, mVertexBuffer[
iSector].
size());
509 if (mCfgL.propagateTracks == 0) {
514 for (int32_t iMC = 0; iMC < 2; iMC++) {
516 if (ii >= trackList[1].
size()) {
519 i = trackList[1][ii];
521 if (track ==
nullptr) {
524 if (lastCluster == -1) {
527 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
528 if (track->MergedLooperConnected()) {
534 size_t startCountInner = mVertexBuffer[
iSector].size();
535 for (int32_t inFlyDirection = 0; inFlyDirection < 2; inFlyDirection++) {
544 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
545 trkParam.Set(track->GetParam());
546 alphaOrg = mParam->Alpha(
iSector);
549 convertTrackParam(t, *track);
550 alphaOrg = track->getAlpha();
555 if constexpr (std::is_same_v<T, GPUTPCGMMergedTrack>) {
556 auto cl = mIOPtrs->
mergedTrackHits[track->FirstClusterRef() + lastCluster];
558 GPUTPCConvertImpl::convert(*mCalib->
fastTransform, *mParam, cl.sector, cl.row, cln.getPad(), cln.getTime(),
x,
y,
z);
563 GPUTPCConvertImpl::convert(*mCalib->
fastTransform, *mParam, sector,
row, cln.getPad(), cln.getTime(),
x,
y,
z);
575 if (mc.
t0 == -100.f) {
579 alphaOrg = mParam->Alpha(
iSector);
580 float c = cosf(alphaOrg);
581 float s = sinf(alphaOrg);
585 mclocal[0] =
x *
c +
y *
s;
586 mclocal[1] = -
x *
s +
y *
c;
589 mclocal[2] = px *
c + py *
s;
590 mclocal[3] = -px *
s + py *
c;
595 trkParam.Set(mclocal[0], mclocal[1], mc.
z, mclocal[2], mclocal[3], mc.
pZ, -
charge);
596 if (mParam->
par.continuousTracking) {
600 if (fabsf(mc.
z) > GPUTPCGeometry::TPCLength()) {
601 ZOffset = mc.
z > 0 ? (mc.
z - GPUTPCGeometry::TPCLength()) : (mc.
z +
GPUTPCGeometry::TPCLength());
603 trkParam.Set(mclocal[0], mclocal[1], mc.
z - ZOffset, mclocal[2], mclocal[3], mc.
pZ,
charge);
606 float z0 = trkParam.
Z();
607 if (iMC && inFlyDirection == 0) {
613 if (fabsf(trkParam.SinPhi()) > 1) {
616 float alpha = alphaOrg;
620 while (nPoints++ < 5000) {
621 if ((inFlyDirection == 0 &&
x < 0) || (inFlyDirection &&
x *
x + trkParam.
Y() * trkParam.
Y() > (iMC ? (450 * 450) : (300 * 300)))) {
624 if (fabsf(trkParam.
Z() + ZOffset) > mMaxClusterZ) {
627 if (fabsf(trkParam.
Z() - z0) > (iMC ? GPUTPCGeometry::TPCLength() :
GPUTPCGeometry::TPCLength())) {
630 if (inFlyDirection) {
631 if (fabsf(trkParam.SinPhi()) > 0.4f) {
632 float dalpha = asinf(trkParam.SinPhi());
633 trkParam.Rotate(dalpha);
636 x = trkParam.X() + 1.f;
637 if (!mCfgH.propagateLoopers) {
638 float diff = fabsf(
alpha - alphaOrg) / (2.f * CAMath::Pi());
640 if (diff > 0.25f && diff < 0.75f) {
646 prop->GetBxByBz(
alpha, trkParam.GetX(), trkParam.GetY(), trkParam.GetZ(),
B);
648 if (trkParam.PropagateToXBxByBz(
x,
B[0],
B[1],
B[2], dLp)) {
651 if (fabsf(trkParam.SinPhi()) > 0.9f) {
655 float drawX = trkParam.X() + mCfgH.xAdd;
656 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);
657 x += inFlyDirection ? 1 : -1;
660 if (inFlyDirection == 0) {
662 for (int32_t k = (int32_t)
buffer.size() - 1; k >= 0; k--) {
666 insertVertexList(vBuf[1], startCountInner, mVertexBuffer[
iSector].
size());
667 startCountInner = mVertexBuffer[
iSector].size();
671 insertVertexList(vBuf[iMC ? 3 : 2], startCountInner, mVertexBuffer[
iSector].
size());
676GPUDisplay::vboList GPUDisplay::DrawGrid(
const GPUTPCTracker& tracker)
678 uint32_t
iSector = tracker.ISector();
679 size_t startCount = mVertexBufferStart[
iSector].size();
680 size_t startCountInner = mVertexBuffer[
iSector].size();
683 for (int32_t
j = 0;
j <= (signed)
row.Grid().Ny();
j++) {
684 float z1 =
row.Grid().ZMin();
685 float z2 =
row.Grid().ZMax();
686 float x =
row.X() + mCfgH.xAdd;
687 float y =
row.Grid().YMin() + (float)
j /
row.Grid().StepYInv();
688 float zz1, zz2, yy1, yy2, xx1, xx2;
689 mParam->Sector2Global(tracker.ISector(),
x,
y,
z1, &xx1, &yy1, &zz1);
690 mParam->Sector2Global(tracker.ISector(),
x,
y,
z2, &xx2, &yy2, &zz2);
698 mVertexBuffer[
iSector].emplace_back(xx1 * GL_SCALE_FACTOR, yy1 * GL_SCALE_FACTOR * mYFactor, zz1 * GL_SCALE_FACTOR);
699 mVertexBuffer[
iSector].emplace_back(xx2 * GL_SCALE_FACTOR, yy2 * GL_SCALE_FACTOR * mYFactor, zz2 * GL_SCALE_FACTOR);
701 for (int32_t
j = 0;
j <= (signed)
row.Grid().Nz();
j++) {
702 float y1 =
row.Grid().YMin();
703 float y2 =
row.Grid().YMax();
704 float x =
row.X() + mCfgH.xAdd;
705 float z =
row.Grid().ZMin() + (float)
j /
row.Grid().StepZInv();
706 float zz1, zz2, yy1, yy2, xx1, xx2;
707 mParam->Sector2Global(tracker.ISector(),
x,
y1,
z, &xx1, &yy1, &zz1);
708 mParam->Sector2Global(tracker.ISector(),
x,
y2,
z, &xx2, &yy2, &zz2);
716 mVertexBuffer[
iSector].emplace_back(xx1 * GL_SCALE_FACTOR, yy1 * GL_SCALE_FACTOR * mYFactor, zz1 * GL_SCALE_FACTOR);
717 mVertexBuffer[
iSector].emplace_back(xx2 * GL_SCALE_FACTOR, yy2 * GL_SCALE_FACTOR * mYFactor, zz2 * GL_SCALE_FACTOR);
720 insertVertexList(tracker.ISector(), startCountInner, mVertexBuffer[
iSector].size());
721 return (vboList(startCount, mVertexBufferStart[
iSector].
size() - startCount,
iSector));
724GPUDisplay::vboList GPUDisplay::DrawGridTRD(int32_t sector)
727 size_t startCount = mVertexBufferStart[sector].size();
728 size_t startCountInner = mVertexBuffer[sector].size();
729 auto* geo = trdGeometry();
731 int32_t trdsector = NSECTORS / 2 - 1 - sector;
732 float alpha = geo->GetAlpha() / 2.f + geo->GetAlpha() * trdsector;
733 if (trdsector >= 9) {
734 alpha -= 2 * CAMath::Pi();
738 int32_t iDet = geo->GetDetector(iLy, iStack, trdsector);
739 auto matrix = geo->GetClusterMatrix(iDet);
743 auto pp = geo->GetPadPlane(iDet);
744 for (int32_t
i = 0;
i < pp->GetNrows();
i++) {
749 xyzLoc1[0] = xyzLoc2[0] = geo->AnodePos();
750 xyzLoc1[1] = pp->GetCol0();
751 xyzLoc2[1] = pp->GetColEnd();
752 xyzLoc1[2] = xyzLoc2[2] = pp->GetRowPos(
i) - pp->GetRowPos(pp->GetNrows() / 2);
753 matrix->LocalToMaster(xyzLoc1, xyzGlb1);
754 matrix->LocalToMaster(xyzLoc2, xyzGlb2);
755 float x1Tmp = xyzGlb1[0];
756 xyzGlb1[0] = xyzGlb1[0] * cosf(
alpha) + xyzGlb1[1] * sinf(
alpha);
757 xyzGlb1[1] = -x1Tmp * sinf(
alpha) + xyzGlb1[1] * cosf(
alpha);
758 float x2Tmp = xyzGlb2[0];
759 xyzGlb2[0] = xyzGlb2[0] * cosf(
alpha) + xyzGlb2[1] * sinf(
alpha);
760 xyzGlb2[1] = -x2Tmp * sinf(
alpha) + xyzGlb2[1] * cosf(
alpha);
761 mVertexBuffer[sector].emplace_back(xyzGlb1[0] * GL_SCALE_FACTOR, xyzGlb1[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb1[2] * GL_SCALE_FACTOR);
762 mVertexBuffer[sector].emplace_back(xyzGlb2[0] * GL_SCALE_FACTOR, xyzGlb2[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb2[2] * GL_SCALE_FACTOR);
764 for (int32_t
j = 0;
j < pp->GetNcols(); ++
j) {
769 xyzLoc1[0] = xyzLoc2[0] = geo->AnodePos();
770 xyzLoc1[1] = xyzLoc2[1] = pp->GetColPos(
j) + pp->GetColSize(
j) / 2.f;
771 xyzLoc1[2] = pp->GetRow0() - pp->GetRowPos(pp->GetNrows() / 2);
772 xyzLoc2[2] = pp->GetRowEnd() - pp->GetRowPos(pp->GetNrows() / 2);
773 matrix->LocalToMaster(xyzLoc1, xyzGlb1);
774 matrix->LocalToMaster(xyzLoc2, xyzGlb2);
775 float x1Tmp = xyzGlb1[0];
776 xyzGlb1[0] = xyzGlb1[0] * cosf(
alpha) + xyzGlb1[1] * sinf(
alpha);
777 xyzGlb1[1] = -x1Tmp * sinf(
alpha) + xyzGlb1[1] * cosf(
alpha);
778 float x2Tmp = xyzGlb2[0];
779 xyzGlb2[0] = xyzGlb2[0] * cosf(
alpha) + xyzGlb2[1] * sinf(
alpha);
780 xyzGlb2[1] = -x2Tmp * sinf(
alpha) + xyzGlb2[1] * cosf(
alpha);
781 mVertexBuffer[sector].emplace_back(xyzGlb1[0] * GL_SCALE_FACTOR, xyzGlb1[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb1[2] * GL_SCALE_FACTOR);
782 mVertexBuffer[sector].emplace_back(xyzGlb2[0] * GL_SCALE_FACTOR, xyzGlb2[1] * GL_SCALE_FACTOR * mYFactor, xyzGlb2[2] * GL_SCALE_FACTOR);
787 insertVertexList(sector, startCountInner, mVertexBuffer[sector].
size());
788 return (vboList(startCount, mVertexBufferStart[sector].
size() - startCount, sector));
791size_t GPUDisplay::DrawGLScene_updateVertexList()
794 for (int32_t
i = 0;
i < NSECTORS;
i++) {
795 mVertexBuffer[
i].clear();
796 mVertexBufferStart[
i].clear();
797 mVertexBufferCount[
i].clear();
800 for (int32_t
i = 0;
i < mCurrentClusters;
i++) {
801 mGlobalPos[
i].
w = tCLUSTER;
803 for (int32_t
i = 0;
i < mCurrentSpacePointsTRD;
i++) {
804 mGlobalPosTRD[
i].
w = tTRDCLUSTER;
808 for (int32_t
i = 0;
i < N_POINTS_TYPE;
i++) {
809 mGlDLPoints[
iSector][
i].resize(mNCollissions);
811 for (int32_t
i = 0;
i < N_FINAL_TYPE;
i++) {
812 mGlDLFinal[
iSector].resize(mNCollissions);
815 if (timer.IsRunning()) {
816 GPUInfo(
"Display Time: Vertex Init:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
819 int32_t numThreads = getNumThreads();
820 tbb::task_arena(numThreads).execute([&] {
822 tbb::parallel_for(0, NSECTORS, [&](int32_t iSector) {
823 GPUTPCTracker& tracker = (GPUTPCTracker&)sectorTracker(iSector);
824 tracker.SetPointersDataLinks(tracker.LinkTmpMemory());
825 mGlDLLines[iSector][tINITLINK] = DrawLinks(tracker, tINITLINK, true);
826 tracker.SetPointersDataLinks(mChain->rec()->Res(tracker.MemoryResLinks()).Ptr());
827 }, tbb::simple_partitioner());
828 if (timer.IsRunning()) {
829 GPUInfo(
"Display Time: Vertex Links:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
832 tbb::parallel_for(0, NSECTORS, [&](int32_t
iSector) {
835 mGlDLLines[
iSector][tLINK] = DrawLinks(tracker, tLINK);
836 mGlDLLines[
iSector][tSEED] = DrawSeeds(tracker);
837 mGlDLLines[
iSector][tTRACKLET] = DrawTracklets(tracker);
838 mGlDLLines[
iSector][tSECTORTRACK] = DrawTracks(tracker, 0);
839 mGlDLGrid[
iSector] = DrawGrid(tracker);
843 }, tbb::simple_partitioner());
844 if (timer.IsRunning()) {
845 GPUInfo(
"Display Time: Vertex Seeds:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
848 tbb::parallel_for(0, NSECTORS, [&](int32_t
iSector) {
850 mGlDLLines[
iSector][tEXTRAPOLATEDTRACK] = DrawTracks(tracker, 1);
851 }, tbb::simple_partitioner());
852 if (timer.IsRunning()) {
853 GPUInfo(
"Display Time: Vertex Sector Tracks:\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
856 tbb::parallel_for(0, numThreads, [&](int32_t iThread) {
857 mThreadTracks[iThread].resize(mNCollissions);
858 for (int32_t
i = 0;
i < mNCollissions;
i++) {
859 for (int32_t
j = 0;
j < NSECTORS;
j++) {
860 for (int32_t k = 0; k < 2; k++) {
861 mThreadTracks[iThread][
i][
j][k].clear();
865 }, tbb::simple_partitioner());
866 if (mConfig.showTPCTracksFromO2Format) {
871 if (mIOPtrs->clustersNative) {
872 mIOPtrs->outputTracksTPCO2[i].getCluster(mIOPtrs->outputClusRefsTPCO2, 0, *mIOPtrs->clustersNative, sector, row);
877 col = mQA->GetMCLabelCol(mIOPtrs->outputTracksTPCO2MC[i]);
883 tbb::parallel_for<uint32_t>(0, mIOPtrs->nMergedTracks, [&](
auto i) {
884 const GPUTPCGMMergedTrack* track = &mIOPtrs->mergedTracks[i];
885 if (track->NClusters() == 0) {
888 if (mCfgH.hideRejectedTracks && !track->OK()) {
891 int32_t sector = mIOPtrs->mergedTrackHits[track->FirstClusterRef() + track->NClusters() - 1].sector;
894 const auto&
label = mQA->GetMCTrackLabel(
i);
898 while (
label.isValid() &&
col < mOverlayTFClusters.size() && mOverlayTFClusters[
col][NSECTORS] <
label.track) {
906 for (uint32_t
col = 0;
col < mIOPtrs->nMCInfosTPCCol;
col++) {
907 tbb::parallel_for(mIOPtrs->mcInfosTPCCol[
col].first, mIOPtrs->mcInfosTPCCol[
col].first + mIOPtrs->mcInfosTPCCol[
col].num, [&](uint32_t
i) {
908 const GPUTPCMCInfo& mc = mIOPtrs->mcInfosTPC[i];
909 if (mc.charge == 0.f) {
916 float alpha = atan2f(mc.
y, mc.
x);
918 alpha += 2 * CAMath::Pi();
920 int32_t sector =
alpha / (2 * CAMath::Pi()) * 18;
927 if (timer.IsRunning()) {
928 GPUInfo(
"Display Time: Vertex Sort merged tracks:\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
932 prop.SetMaxSinPhi(.999);
933 prop.SetMaterialTPC();
934 prop.SetPolynomialField(&mParam->polynomialField);
936 tbb::parallel_for(0, NSECTORS, [&](int32_t
iSector) {
938 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
939 mThreadBuffers[numThread].clear();
940 for (int32_t iSet = 0; iSet < numThreads; iSet++) {
941 if (mConfig.showTPCTracksFromO2Format) {
942 DrawFinal<o2::tpc::TrackTPC>(
iSector, iCol, &prop, mThreadTracks[iSet][iCol][
iSector], mThreadBuffers[numThread]);
944 DrawFinal<GPUTPCGMMergedTrack>(
iSector, iCol, &prop, mThreadTracks[iSet][iCol][
iSector], mThreadBuffers[numThread]);
948 for (int32_t
i = 0;
i < N_FINAL_TYPE;
i++) {
949 size_t startCount = mVertexBufferStart[
iSector].size();
950 for (uint32_t
j = 0;
j < mThreadBuffers[numThread].start[
i].size();
j++) {
951 mVertexBufferStart[
iSector].emplace_back(mThreadBuffers[numThread].
start[
i][
j]);
952 mVertexBufferCount[
iSector].emplace_back(mThreadBuffers[numThread].
count[
i][
j]);
957 }, tbb::simple_partitioner());
958 if (timer.IsRunning()) {
959 GPUInfo(
"Display Time: Vertex Merged Tracks:\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
962 tbb::parallel_for(0, NSECTORS, [&](int32_t
iSector) {
964 }, tbb::simple_partitioner());
965 if (timer.IsRunning()) {
966 GPUInfo(
"Display Time: Vertex Clusters:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
971 mGlDLFinalITS = DrawFinalITS();
973 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++) {
974 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
981 if (timer.IsRunning()) {
982 GPUInfo(
"Display Time: Vertex ITS:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
986 for (int32_t
i = N_POINTS_TYPE_TPC;
i < N_POINTS_TYPE_TPC + N_POINTS_TYPE_TRD;
i++) {
987 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
992 if (timer.IsRunning()) {
993 GPUInfo(
"Display Time: Vertex TRD:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
997 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++) {
998 for (int32_t iCol = 0; iCol < mNCollissions; iCol++) {
1004 if (timer.IsRunning()) {
1005 GPUInfo(
"Display Time: Vertex TOF:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
1008 mTracksArePropagated = mCfgL.propagateTracks != 0;
1009 mUpdateVertexLists =
false;
1010 size_t totalVertizes = 0;
1011 for (int32_t
i = 0;
i < NSECTORS;
i++) {
1012 totalVertizes += mVertexBuffer[
i].size();
1014 if (totalVertizes > 0xFFFFFFFF) {
1015 throw std::runtime_error(
"Display vertex count exceeds 32bit uint32_t counter");
1017 size_t needMultiVBOSize = mBackend->needMultiVBO();
1018 mUseMultiVBO = needMultiVBOSize && (totalVertizes *
sizeof(mVertexBuffer[0][0]) >= needMultiVBOSize);
1019 if (!mUseMultiVBO) {
1020 size_t totalYet = mVertexBuffer[0].size();
1021 mVertexBuffer[0].resize(totalVertizes);
1023 for (uint32_t
j = 0;
j < mVertexBufferStart[
i].size();
j++) {
1024 mVertexBufferStart[
i][
j] += totalYet;
1026 memcpy(&mVertexBuffer[0][totalYet], &mVertexBuffer[
i][0], mVertexBuffer[
i].
size() *
sizeof(mVertexBuffer[
i][0]));
1027 totalYet += mVertexBuffer[
i].size();
1028 mVertexBuffer[
i].clear();
1031 mBackend->loadDataToGPU(totalVertizes);
1033 mVertexBuffer[
i].clear();
1035 if (timer.IsRunning()) {
1036 GPUInfo(
"Display Time: Vertex Final:\t\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
1039 return totalVertizes;
std::vector< std::string > labels
A const (ready only) version of MCTruthContainer.
#define GET_CID(sector, i)
#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.
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()
static constexpr uint32_t NROWS
static constexpr uint32_t NSECTORS
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)
uint8_t itsSharedClusterMap uint8_t
std::vector< InputSpec > select(char const *matcher="")
float float float float float z2
float float float float z1
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