16#include "frontend/GPUDisplayInfo.inc"
26#include <condition_variable>
29#include "../utils/linux_helpers.h"
44#include "helpers/GPUDisplayColors.inc"
46constexpr hmm_mat4 MY_HMM_IDENTITY = {{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}};
52 static GPUSettingsDisplay defaultConfig;
53 return (
chain &&
chain->mConfigDisplay) ? *
chain->mConfigDisplay : defaultConfig;
58 static GPUSettingsProcessing defaultConfig;
62GPUDisplay::GPUDisplay(
GPUDisplayFrontend* frontend,
GPUChainTracking*
chain,
GPUQA* qa,
const GPUParam*
param,
const GPUCalibObjectsConst* calib,
const GPUSettingsDisplay* config,
const GPUSettingsProcessing*
proc) :
GPUDisplayInterface(), mFrontend(frontend), mChain(
chain), mConfig(config ? *config : GetConfig(
chain)), mProcessingSettings(
proc ? *
proc : GetProcessingConfig(
chain)), mQA(qa)
64 mViewMatrix = std::make_unique<hmm_mat4>();
65 mModelMatrix = std::make_unique<hmm_mat4>();
68 mCfgL = mConfig.light;
69 mCfgH = mConfig.heavy;
70 mCfgR = mConfig.renderer;
73 throw std::runtime_error(
"Error obtaining display backend");
75 mBackend->mDisplay =
this;
80void GPUDisplay::calcXYZ(
const float* matrix)
82 mXYZ[0] = -(matrix[0] * matrix[12] + matrix[1] * matrix[13] + matrix[2] * matrix[14]);
83 mXYZ[1] = -(matrix[4] * matrix[12] + matrix[5] * matrix[13] + matrix[6] * matrix[14]);
84 mXYZ[2] = -(matrix[8] * matrix[12] + matrix[9] * matrix[13] + matrix[10] * matrix[14]);
86 mAngle[0] = -asinf(matrix[6]);
87 float A = cosf(mAngle[0]);
88 if (fabsf(
A) > 0.005) {
89 mAngle[1] = atan2f(-matrix[2] /
A, matrix[10] /
A);
90 mAngle[2] = atan2f(matrix[4] /
A, matrix[5] /
A);
93 mAngle[2] = atan2f(-matrix[1], matrix[0]);
96 mRPhiTheta[0] = sqrtf(mXYZ[0] * mXYZ[0] + mXYZ[1] * mXYZ[1] + mXYZ[2] * mXYZ[2]);
97 mRPhiTheta[1] = atan2f(mXYZ[0], mXYZ[2]);
98 mRPhiTheta[2] = atan2f(mXYZ[1], sqrtf(mXYZ[0] * mXYZ[0] + mXYZ[2] * mXYZ[2]));
100 createQuaternionFromMatrix(mQuat, matrix);
118 mNCollissions = std::max<uint32_t>(mNCollissions, collision + 1);
119 mOverlayTFClusters.resize(mNCollissions);
120 mOverlayTFClusters[collision][
sector] = cluster;
123void GPUDisplay::mAnimationCloseAngle(
float& newangle,
float lastAngle)
125 const float delta = lastAngle > newangle ? (2 * CAMath::Pi()) : (-2 *
CAMath::Pi());
126 while (fabsf(newangle + delta - lastAngle) < fabsf(newangle - lastAngle)) {
130void GPUDisplay::mAnimateCloseQuaternion(
float*
v,
float lastx,
float lasty,
float lastz,
float lastw)
132 float distPos2 = (lastx -
v[0]) * (lastx -
v[0]) + (lasty -
v[1]) * (lasty -
v[1]) + (lastz -
v[2]) * (lastz -
v[2]) + (lastw -
v[3]) * (lastw -
v[3]);
133 float distNeg2 = (lastx +
v[0]) * (lastx +
v[0]) + (lasty +
v[1]) * (lasty +
v[1]) + (lastz +
v[2]) * (lastz +
v[2]) + (lastw +
v[3]) * (lastw +
v[3]);
134 if (distPos2 > distNeg2) {
135 for (int32_t
i = 0;
i < 4;
i++) {
150 mCfgC.resetScene.store(
true);
156void GPUDisplay::updateConfig()
158 mBackend->setQuality();
159 mBackend->setDepthBuffer();
164 mNDrawCalls += mBackend->drawVertices(
v,
t);
172 retVal = InitDisplay_internal();
176 if (mConfig.listFrontendOptionHandling) {
177 mFrontend->listConfig();
180 }
catch (
const std::runtime_error&
e) {
181 GPUError(
"%s",
e.what());
184 mOldCfg = {mCfgH, mCfgL, mCfgR};
186 mInitResult =
retVal == 0 ? 1 : -1;
188 mFrontend->
mInitCV.notify_all();
193int32_t GPUDisplay::InitDisplay_internal()
195 mThreadBuffers.resize(getNumThreads());
196 mThreadTracks.resize(getNumThreads());
197 if (mBackend->InitBackend()) {
200 mYFactor = mBackend->getYFactor();
213 mBackend->ExitBackend();
219 mSemLockDisplay.
Lock();
228 }
else if (!mOverlayTFClusters.size()) {
231 if (mCfgL.showCollision >= mNCollissions) {
232 mCfgL.showCollision = -1;
233 mUpdateDrawCommands =
true;
236 DrawGLScene_internal(suspended);
237 }
catch (
const std::runtime_error&
e) {
238 GPUError(
"Runtime error %s during display",
e.what());
242 if (mLoadAndShowEvent) {
244 std::lock_guard<std::mutex> lock(mMutexLoadAndShowEvent);
245 mLoadAndShowEvent =
false;
247 mCVLoadAndShowEvent.notify_one();
255void GPUDisplay::DrawGLScene_cameraAndAnimation(
bool suspended,
float animateTime,
float& mixSlaveImage,
hmm_mat4& nextViewMatrix)
259 if (
mCfgC.showConsole && mMouseWheelTmp) {
260 mFrontend->mConsole->scroll(mMouseWheelTmp / 100 ? mMouseWheelTmp / 100 : (mMouseWheelTmp > 0) - (mMouseWheelTmp < 0));
264 bool lookOrigin = mCfgR.camLookOrigin ^ mFrontend->
keyMapDown(mFrontend->KEY_MAP_FOCUS_ORIGIN);
265 bool yUp = mCfgR.camYUp ^ mFrontend->
keyMapDown(mFrontend->KEY_MAP_FOCUS_ORIENT_UP) ^ lookOrigin;
266 bool rotateModelTPC =
mCfgO.rotateAroundZ || mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_AROUND_Z);
267 bool rotateModel = rotateModelTPC ||
mCfgO.rotateModel || mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_MODEL);
270 float scalefactor = mFrontend->
mKeys[mFrontend->KEY_SHIFT] ? 0.2f : 1.0f;
271 float rotatescalefactor = scalefactor * 0.25f;
272 if (mCfgL.drawSector != -1) {
275 float*
const mViewMatrixP = &mViewMatrix->Elements[0][0];
276 float sqrdist = sqrtf(sqrtf(mViewMatrixP[12] * mViewMatrixP[12] + mViewMatrixP[13] * mViewMatrixP[13] + mViewMatrixP[14] * mViewMatrixP[14]) * GL_SCALE_FACTOR) * 0.8f;
277 if (sqrdist < 0.2f) {
283 scalefactor *= sqrdist;
287 if (animateCamera(suspended, animateTime, mixSlaveImage, nextViewMatrix)) {
289 }
else if (
mCfgC.resetScene.load()) {
290 const float initialZpos = mCfgH.projectXY ? 16 : (mParam->
par.continuousTracking ? (mMaxClusterZ * GL_SCALE_FACTOR + 8) : 8);
291 nextViewMatrix = nextViewMatrix *
HMM_Translate({{0, 0, -initialZpos}});
295 mCfgL.pointSize = 2.0f;
296 mCfgL.lineWidth = 1.4f;
297 mCfgL.drawSector = -1;
298 mCfgL.showCollision = -1;
300 mCfgR.camLookOrigin = mCfgR.camYUp =
false;
301 mAngleRollOrigin = -1e9f;
303 mUpdateDrawCommands =
true;
305 mCfgC.resetScene.store(
false);
307 float moveZ = scalefactor * ((
float)mMouseWheelTmp / 150 + (
float)(mFrontend->
keyMapDown(mFrontend->KEY_MAP_FORWARD) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_BACKWARD)) * (!mFrontend->
mKeys[mFrontend->KEY_SHIFT]) * 0.2f * mFPSScale);
308 float moveY = scalefactor * ((
float)(mFrontend->
keyMapDown(mFrontend->KEY_MAP_STRAFE_DOWN) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_STRAFE_UP)) * (!mFrontend->
mKeys[mFrontend->KEY_SHIFT]) * 0.2f * mFPSScale);
309 float moveX = scalefactor * ((
float)(mFrontend->
keyMapDown(mFrontend->KEY_MAP_STRAFE_LEFT) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_STRAFE_RIGHT)) * (!mFrontend->
mKeys[mFrontend->KEY_SHIFT]) * 0.2f * mFPSScale);
310 float rotRoll = rotatescalefactor * mFPSScale * 2 * (mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_LEFT) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_RIGHT)) * (!mFrontend->
mKeys[mFrontend->KEY_SHIFT]);
311 float rotYaw = rotatescalefactor * mFPSScale * 2 * (mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_YAW_RIGHT) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_YAW_LEFT)) * (!mFrontend->
mKeys[mFrontend->KEY_SHIFT]);
312 float rotPitch = rotatescalefactor * mFPSScale * 2 * (mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_PITCH_DOWN) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_ROTATE_PITCH_UP)) * (!mFrontend->
mKeys[mFrontend->KEY_SHIFT]);
314 float mouseScale = 1920.f / std::max<float>(1920.f, mBackend->mScreenWidth);
326 if (mFrontend->
keyMapDown(mFrontend->KEY_MAP_CHANGE_ANIMATION_INTERVAL)) {
327 mCfgO.animationDelay += moveX;
328 if (
mCfgO.animationDelay < 0.05f) {
329 mCfgO.animationDelay = 0.05f;
330 }
else if (
mCfgO.animationDelay > 20.f) {
331 mCfgO.animationDelay = 20.f;
335 SetInfo(
"Animation delay set to %1.2f",
mCfgO.animationDelay);
339 mAngleRollOrigin = 0;
340 }
else if (!lookOrigin) {
341 mAngleRollOrigin = -1e6;
345 if (mAngleRollOrigin < -1e6) {
346 mAngleRollOrigin = yUp ? 0.f : -mAngle[2];
348 mAngleRollOrigin += rotRoll;
349 nextViewMatrix = nextViewMatrix *
HMM_Rotate(mAngleRollOrigin, {{0, 0, 1}});
350 float tmpX = moveX, tmpY = moveY;
351 moveX = tmpX * cosf(mAngle[2]) - tmpY * sinf(mAngle[2]);
352 moveY = tmpX * sinf(mAngle[2]) + tmpY * cosf(mAngle[2]);
355 const float x = mXYZ[0],
y = mXYZ[1],
z = mXYZ[2];
356 float r = sqrtf(
x *
x + +
y *
y +
z *
z);
357 float r2 = sqrtf(
x *
x +
z *
z);
358 float phi = atan2f(
z,
x);
360 float theta = atan2f(mXYZ[1], r2);
361 theta -= moveY * 0.1f;
362 const float max_theta = CAMath::Pi() / 2 - 0.01f;
363 if (theta >= max_theta) {
365 }
else if (theta <= -max_theta) {
368 if (moveZ >=
r - 0.1f) {
372 r2 =
r * cosf(theta);
373 mXYZ[0] = r2 * cosf(phi);
374 mXYZ[2] = r2 * sinf(phi);
375 mXYZ[1] =
r * sinf(theta);
380 nextViewMatrix = nextViewMatrix *
HMM_LookAt({{mXYZ[0], mXYZ[1], mXYZ[2]}}, {{0, 0, 0}}, {{0, 1, 0}});
382 nextViewMatrix = nextViewMatrix *
HMM_Translate({{moveX, moveY * mYFactor, moveZ}});
384 nextViewMatrix = nextViewMatrix * cameraRotation({rotYaw, rotPitch, yUp ? 0.f : rotRoll});
386 nextViewMatrix = nextViewMatrix * *mViewMatrix;
388 calcXYZ(&nextViewMatrix.
Elements[0][0]);
389 nextViewMatrix =
HMM_Rotate(mAngle[2] * 180.f / CAMath::Pi(), {{0, 0, 1}}) * nextViewMatrix;
395 if (rotPitch != 0.f) {
398 if (rotRoll != 0.f) {
399 if (rotateModelTPC) {
400 *mModelMatrix =
HMM_Rotate(-rotRoll, {{0, 0, 1}}) * *mModelMatrix;
409 float minSize = 0.4f / (mCfgR.drawQualityDownsampleFSAA > 1 ? mCfgR.drawQualityDownsampleFSAA : 1);
410 int32_t deltaLine = (mFrontend->
keyMapDown(mFrontend->KEY_MAP_INCREASE_WIDTH) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_DECREASE_WIDTH)) * mFrontend->
mKeys[mFrontend->KEY_SHIFT];
411 mCfgL.lineWidth += (
float)deltaLine * mFPSScale * 0.02f * mCfgL.lineWidth;
412 if (mCfgL.lineWidth <
minSize) {
416 SetInfo(
"%s line width: %f", deltaLine > 0 ?
"Increasing" :
"Decreasing", mCfgL.lineWidth);
417 mUpdateDrawCommands =
true;
420 int32_t deltaPoint = (mFrontend->
keyMapDown(mFrontend->KEY_MAP_INCREASE_WIDTH) - mFrontend->
keyMapDown(mFrontend->KEY_MAP_DECREASE_WIDTH)) * !mFrontend->
mKeys[mFrontend->KEY_SHIFT];
421 mCfgL.pointSize += (
float)deltaPoint * mFPSScale * 0.02f * mCfgL.pointSize;
422 if (mCfgL.pointSize <
minSize) {
426 SetInfo(
"%s point size: %f", deltaPoint > 0 ?
"Increasing" :
"Decreasing", mCfgL.pointSize);
427 mUpdateDrawCommands =
true;
432 if (animateTime < 0) {
433 *mViewMatrix = nextViewMatrix;
434 calcXYZ(&mViewMatrix->Elements[0][0]);
441 if (timer.IsRunning()) {
442 GPUInfo(
"Display Time: Camera:\t\t%6.0f us", timer.GetCurrentElapsedTime(
true) * 1e6);
446void GPUDisplay::DrawGLScene_drawCommands()
448#define LOOP_SECTOR for (int32_t iSector = (mCfgL.drawSector == -1 ? 0 : (mCfgL.drawRelatedSectors ? (mCfgL.drawSector % (NSECTORS / 4)) : mCfgL.drawSector)); iSector < NSECTORS; iSector += (mCfgL.drawSector == -1 ? 1 : (mCfgL.drawRelatedSectors ? (NSECTORS / 4) : NSECTORS)))
449#define LOOP_SECTOR2 for (int32_t iSector = (mCfgL.drawSector == -1 ? 0 : (mCfgL.drawRelatedSectors ? (mCfgL.drawSector % (NSECTORS / 4)) : mCfgL.drawSector)) % (NSECTORS / 2); iSector < NSECTORS / 2; iSector += (mCfgL.drawSector == -1 ? 1 : (mCfgL.drawRelatedSectors ? (NSECTORS / 4) : NSECTORS)))
450#define LOOP_COLLISION for (int32_t iCol = (mCfgL.showCollision == -1 ? 0 : mCfgL.showCollision); iCol < mNCollissions; iCol += (mCfgL.showCollision == -1 ? 1 : mNCollissions))
451#define LOOP_COLLISION_COL(cmd) \
454 if (mCfgL.colorCollisions) { \
455 SetCollisionColor(iCol); \
460 if (mCfgL.drawGrid) {
470 if (mCfgL.drawClusters) {
473 mBackend->lineWidthFactor(2);
475 if (mCfgL.drawFinal && mCfgL.colorClusters) {
479 mBackend->lineWidthFactor(1);
483 mBackend->pointSizeFactor(2);
486 mBackend->pointSizeFactor(1);
497 if (mCfgL.drawInitLinks) {
498 if (mCfgL.excludeClusters) {
501 if (mCfgL.colorClusters) {
507 if (mCfgL.drawLinks) {
508 if (mCfgL.excludeClusters) {
511 if (mCfgL.colorClusters) {
519 if (mCfgL.drawSeeds) {
520 if (mCfgL.excludeClusters) {
523 if (mCfgL.colorClusters) {
531 if (mCfgL.drawTracklets) {
532 if (mCfgL.excludeClusters) {
535 if (mCfgL.colorClusters) {
541 if (mCfgL.drawTracks) {
542 if (mCfgL.excludeClusters) {
545 if (mCfgL.colorClusters) {
552 if (mCfgL.drawExtrapolatedTracks) {
553 if (mCfgL.excludeClusters) {
556 if (mCfgL.colorClusters) {
557 SetColorExtrapolatedTracks();
565 if (mCfgL.drawFinal && mCfgL.propagateTracks < 2) {
566 if (mCfgL.excludeClusters) {
569 if (mCfgL.colorClusters) {
578 if (!mCfgH.clustersOnly && mCfgL.excludeClusters != 1) {
580 if (mCfgL.drawInitLinks) {
584 if (mCfgL.drawLinks) {
588 if (mCfgL.drawSeeds) {
592 if (mCfgL.drawTracklets) {
596 if (mCfgL.drawTracks) {
600 if (mCfgL.drawExtrapolatedTracks) {
601 SetColorExtrapolatedTracks();
605 if (mCfgL.drawFinal) {
609 if (mCfgL.colorCollisions) {
610 SetCollisionColor(iCol);
612 if (mCfgL.propagateTracks < 2) {
615 if (mCfgL.propagateTracks > 0 && mCfgL.propagateTracks < 3) {
618 if (mCfgL.propagateTracks == 2) {
621 if (mCfgL.propagateTracks == 3) {
625 if (mCfgH.drawTracksAndFilter ? (mCfgH.drawTPCTracks || mCfgH.drawTRDTracks || mCfgH.drawTOFTracks) : mCfgH.drawITSTracks) {
629 if (mCfgH.markClusters || mCfgH.markAdjacentClusters || mCfgH.markFakeClusters) {
630 if (mCfgH.markFakeClusters) {
631 mBackend->pointSizeFactor(3);
635 if (mCfgH.markFakeClusters) {
636 mBackend->pointSizeFactor(1);
642void GPUDisplay::DrawGLScene_internal(
bool suspended,
float animateTime,
bool renderToMixBuffer)
644 if (
mCfgC.requestScreenshot ||
mCfgO.animateScreenshot) {
645 const uint32_t factor = std::max(1, mCfgR.drawQualityDownsampleFSAA) * std::max(1, mCfgR.screenshotScaleFactor);
646 if (std::max(mBackend->mScreenWidth, mBackend->mScreenHeight) *
factor > mBackend->mMaxRenderSize) {
647 GPUError(
"Screenshot not taken: requested render size %u x %u (window x FSAA x screenshot scale) exceeds the maximum size %u x %u", mBackend->mScreenWidth *
factor, mBackend->mScreenHeight *
factor, mBackend->mMaxRenderSize, mBackend->mMaxRenderSize);
648 mCfgC.requestScreenshot =
false;
649 mCfgO.animateScreenshot = 0;
652 const bool animateScreenshot =
mCfgO.animateScreenshot && mAnimate;
653 const bool screenshotFrame =
mCfgC.requestScreenshot || animateScreenshot;
654 const bool doScreenshot = screenshotFrame && animateTime < 0;
657 if (animateTime < 0 && (mUpdateEventData ||
mCfgC.resetScene.load() || mUpdateVertexLists) && mIOPtrs) {
658 disableUnsupportedOptions();
660 if (mUpdateEventData || mUpdateVertexLists) {
661 mUpdateDrawCommands =
true;
665 if (animateTime < 0 && (mUpdateEventData ||
mCfgC.resetScene.load()) && mIOPtrs) {
666 timerDraw.ResetStart();
667 DrawGLScene_updateEventData();
671 mUpdateVertexLists =
true;
672 mUpdateEventData =
false;
676 float mixSlaveImage = 0.f;
677 DrawGLScene_cameraAndAnimation(suspended, animateTime, mixSlaveImage, nextViewMatrix);
680 if (mUpdateVertexLists && mIOPtrs) {
681 size_t totalVertizes = DrawGLScene_updateVertexList();
682 if (timerDraw.IsRunning()) {
683 printf(
"Event visualization time: %'d us (vertices %'ld / %'ld bytes)\n", (int32_t)(timerDraw.GetCurrentElapsedTime() * 1000000.), (
int64_t)totalVertizes, (
int64_t)(totalVertizes *
sizeof(mVertexBuffer[0][0])));
692 nextViewMatrix = nextViewMatrix * *mModelMatrix;
693 const float zFar = ((mParam->
par.continuousTracking ? (mMaxClusterZ * GL_SCALE_FACTOR) : 8.f) + 50.f) * 2.f;
694 const float aspect = mBackend->mRenderHeight ? (
float)mBackend->mRenderWidth / (
float)mBackend->mRenderHeight : 1.f;
696 if (!mBackend->prepareDraw(proj, nextViewMatrix, screenshotFrame, renderToMixBuffer, mixSlaveImage)) {
699 mBackend->pointSizeFactor(1);
700 mBackend->lineWidthFactor(1);
702 if (mUpdateDrawCommands || mBackend->backendNeedRedraw()) {
704 DrawGLScene_drawCommands();
707 if (mCfgL.drawField) {
708 mBackend->drawField();
711 mUpdateDrawCommands =
false;
712 mUpdateRenderPipeline =
false;
713 mBackend->finishDraw(doScreenshot, renderToMixBuffer, mixSlaveImage);
715 if (animateTime < 0) {
720 float fps = (double)mFramesDoneFPS / fpstime;
722 "FPS:%8.2f (Sector: %d, 1:Clusters %d, 2:Prelinks %d, 3:Links %d, 4:Seeds %d, 5:Tracklets %d, 6:Tracks %d, 7:GTracks %d, 8:Merger %d) (%d frames, %d draw calls) "
723 "(X %1.2f Y %1.2f Z %1.2f / R %1.2f Phi %1.1f Theta %1.1f) / Yaw %1.1f Pitch %1.1f Roll %1.1f - Size: %ux%u",
724 fps, mCfgL.drawSector, mCfgL.drawClusters, mCfgL.drawInitLinks, mCfgL.drawLinks, mCfgL.drawSeeds, mCfgL.drawTracklets, mCfgL.drawTracks, mCfgL.drawExtrapolatedTracks, mCfgL.drawFinal, mFramesDone, mNDrawCalls, mXYZ[0], mXYZ[1], mXYZ[2], mRPhiTheta[0], mRPhiTheta[1] * 180 / CAMath::Pi(),
725 mRPhiTheta[2] * 180 / CAMath::Pi(), mAngle[1] * 180 / CAMath::Pi(), mAngle[0] * 180 / CAMath::Pi(), mAngle[2] * 180 / CAMath::Pi(), mBackend->mScreenWidth, mBackend->mScreenHeight);
727 if (
mCfgO.printInfoText & 2) {
730 if (mFPSScaleadjust++) {
731 mFPSScale = 60 / fps;
737 const float consoleFraction = consoleVerticalFraction();
738 const bool drawText = (
mCfgO.printInfoText & 1) || consoleFraction > 0.f;
741 mBackend->prepareText();
743 if (
mCfgO.printInfoText & 1 ||
mCfgO.printInfoTextGUI) {
746 if (consoleFraction > 0.f) {
749 mConsoleCursorTimer.
Reset();
750 }
else if (!mConsoleCursorTimer.
IsRunning() || mConsoleCursorPos != mFrontend->mConsole->mConsoleTextPos) {
752 mConsoleCursorPos = mFrontend->mConsole->mConsoleTextPos;
755 auto& console = *mFrontend->mConsole;
756 console.mVisibleLines = mBackend->GLDrawConsole(consoleFraction, console.mConsoleHistory, console.shownText(), cursor ? (int32_t)console.mConsoleTextPos : -1, console.mScroll);
759 mBackend->finishText();
761 mFrontend->mConsole->consoleLimitHistory(mConfig.internal.consoleHistorySize);
764 mBackend->finishFrame(doScreenshot, renderToMixBuffer, mixSlaveImage);
766 mCfgC.requestScreenshot =
false;
767 std::vector<char>
pixels = mBackend->getPixels();
768 char tmpFileName[48];
769 if (animateScreenshot) {
770 snprintf(tmpFileName, 48,
"%d_%05d.bmp", mAnimationExport, mAnimationFrame);
772 DoScreenshot(animateScreenshot ? (
mCfgO.mscreenShotName + tmpFileName).c_str() : mScreenshotFile.c_str(),
pixels);
781 if (mMaxClusterZ <= 0) {
782 mCfgC.resetScene.store(
true);
784 mUpdateEventData =
true;
785 mLoadAndShowEvent =
true;
799 std::unique_lock<std::mutex> lock(mMutexLoadAndShowEvent);
800 while (mLoadAndShowEvent) {
801 mCVLoadAndShowEvent.wait(lock);
807 mLoadAndShowEvent =
true;
constexpr hmm_mat4 MY_HMM_IDENTITY
#define LOOP_COLLISION_COL(cmd)
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 First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
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 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 proc
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 factor
configStandalone Reconstruction rec_tpc float
HMM_INLINE hmm_mat4 HMM_Perspective(float FOV, float AspectRatio, float Near, float Far)
HMM_INLINE hmm_mat4 HMM_Translate(hmm_vec3 Translation)
HMM_EXTERN hmm_mat4 HMM_LookAt(hmm_vec3 Eye, hmm_vec3 Center, hmm_vec3 Up)
HMM_EXTERN hmm_mat4 HMM_Rotate(float Angle, hmm_vec3 Axis)
double GetCurrentElapsedTime(bool reset=false)
GPUTrackingInOutPointers & mIOPtrs
const GPUCalibObjectsConst & GetCalib() const
const GPUSettingsProcessing & GetProcessingSettings() const
const GPUParam & GetParam() const
static GPUDisplayBackend * getBackend(const char *type)
virtual void getSize(int32_t &width, int32_t &height)
std::mutex mExitStateMutex
static constexpr int32_t INIT_WIDTH
GPUDisplayBackend * mBackend
bool keyMapDown(uint32_t id) const
static constexpr int32_t INIT_HEIGHT
virtual float getDisplayScale() const
std::atomic< bool > mDisplayRunning
std::condition_variable mInitCV
GPUDisplay(GPUDisplayFrontend *frontend, GPUChainTracking *chain, GPUQA *qa, const GPUParam *param=nullptr, const GPUCalibObjectsConst *calib=nullptr, const GPUSettingsDisplay *config=nullptr, const GPUSettingsProcessing *proc=nullptr)
void SetCollisionFirstCluster(uint32_t collision, int32_t sector, int32_t cluster) override
int32_t StartDisplay() override
int32_t DrawGLScene(bool suspended=false)
GPUDisplayFrontend * frontend()
void BlockTillNextEvent() override
int32_t InitDisplay(bool initFailure=false)
void ShowNextEvent(const GPUTrackingInOutPointers *ptrs=nullptr) override
void WaitTillEventShown() override
void ResizeScene(int32_t width, int32_t height, bool init=false)
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar
GLint GLsizei GLsizei height
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
GLdouble GLdouble GLdouble z