30struct consoleArgumentError :
public std::runtime_error {
33 static constexpr std::pair<char, const char*> names[] = {{
's',
"string"}, {
'i',
"int"}, {
'd',
"double"}, {
'a',
"any"}, {
'+',
"[optional]"}};
35 if (
const auto*
n = std::find_if(std::begin(names), std::end(names), [
t](
const auto&
entry) {
return entry.first ==
t; });
n != std::end(names)) {
36 usage += (
usage.size() > 1 ?
" " :
"") + std::string(
n->second);
41 std::string command,
usage;
50 mScroll = std::clamp<int64_t>((int64_t)
mScroll + lines, 0, maxScroll);
55 if (
key == KEY_PAGEUP ||
key == KEY_PAGEDOWN || (shift && (
key == KEY_UP ||
key == KEY_DOWN))) {
57 scroll(
key == KEY_PAGEUP ||
key == KEY_UP ? lines : -lines);
62 if (
key == KEY_UP ||
key == KEY_DOWN) {
65 while (--
i >= 1 && isOutput(
i)) {
70 while (++
i < nHistory && isOutput(
i)) {
76 }
else if (
key == KEY_ENTER) {
78 command.erase(0, std::min(command.size(), command.find_first_not_of(
' ')));
81 if (!command.empty()) {
86 }
else if (
key != KEY_LEFT &&
key != KEY_RIGHT &&
key != KEY_BACKSPACE &&
key != KEY_DELETE && (key < 32 || key >= 127)) {
93 if (
key == KEY_LEFT ||
key == KEY_RIGHT) {
98 if (
key == KEY_LEFT) {
100 }
else if (
key == KEY_RIGHT) {
102 }
else if (
key == KEY_BACKSPACE) {
106 }
else if (
key == KEY_DELETE) {
117 va_list args, argsCopy;
119 va_copy(argsCopy, args);
120 std::string
buffer(std::max(0, vsnprintf(
nullptr, 0,
format, args)),
'\0');
126 GPUInfo(
"%s",
buffer.c_str());
132 const auto now = std::chrono::steady_clock::now();
150 const size_t size = std::max<uint32_t>(historySize, 2);
167 std::vector<std::pair<std::string, bool>> tokens;
169 bool inToken =
false, plainText =
false, escape =
false;
171 auto finishToken = [&]() {
173 tokens.emplace_back(std::move(token), plainText);
175 inToken = plainText =
false;
188 }
else if (
c ==
'\\') {
189 escape = inToken = plainText =
true;
190 }
else if (
c ==
'"' ||
c ==
'\'') {
192 inToken = plainText =
true;
193 }
else if (
c ==
' ') {
200 if (quote || escape) {
201 throw std::runtime_error(quote ?
"unterminated quote" :
"backslash at the end");
204 if (tokens.empty()) {
205 throw std::runtime_error(
"empty command");
208 const std::string&
name = tokens[0].first;
211 throw std::runtime_error(
"unknown command " +
name);
213 const std::string&
types = it->second.args;
214 const bool more =
types.size() &&
types.back() ==
'+';
215 const size_t nFixed =
types.size() - more, nArgs = tokens.size() - 1;
216 if (nArgs < nFixed || (!more && nArgs > nFixed)) {
219 auto autoType = [](
const std::string& text,
bool plain) ->
consoleArg {
220 const char *begin = text.c_str() + (text[0] ==
'+' || text[0] ==
'-'), *
end = text.c_str() + text.size();
221 const bool number = !plain && begin <
end && ((*begin >=
'0' && *begin <=
'9') || *begin ==
'.') && std::all_of(begin,
end, [](
char c) {
return (
c >=
'0' &&
c <=
'9') ||
c ==
'.' ||
c ==
'e' ||
c ==
'E' ||
c ==
'+' ||
c ==
'-'; });
225 int64_t intValue = 0;
226 double doubleValue = 0.;
227 if (
const auto rInt = std::from_chars(begin,
end, intValue); rInt.ec == std::errc() && rInt.ptr ==
end) {
228 return text[0] ==
'-' ? -intValue : intValue;
229 }
else if (
const auto rDouble = std::from_chars(begin,
end, doubleValue); rDouble.ec == std::errc() && rDouble.ptr ==
end) {
230 return text[0] ==
'-' ? -doubleValue : doubleValue;
234 std::vector<consoleArg> args;
235 for (
size_t i = 0;
i < nArgs;
i++) {
236 const auto& [text, plain] = tokens[
i + 1];
239 if (
type ==
'i' && !std::holds_alternative<int64_t>(
value)) {
240 throw consoleArgumentError(
name,
"argument " +
std::to_string(
i + 1) +
" (" + text +
") must be an integer",
types);
241 }
else if (
type ==
'd') {
242 if (std::holds_alternative<int64_t>(
value)) {
244 }
else if (!std::holds_alternative<double>(
value)) {
248 throw std::runtime_error(
name +
": invalid argument types " +
types);
250 args.emplace_back(std::move(
value));
252 return {it->second, std::move(args)};
257 if (cmd.find_first_not_of(
' ') == std::string_view::npos) {
261 std::vector<consoleArg> args;
264 command = &std::get<0>(parsed);
265 args = std::move(std::get<1>(parsed));
266 }
catch (
const consoleArgumentError&
e) {
267 consolePrint(
"Invalid arguments for %s: %s %s",
e.command.c_str(),
e.what(),
e.usage.c_str());
269 }
catch (
const std::runtime_error&
e) {
275 }
catch (
const std::exception&
e) {
286 std::vector<ScriptLine> lines;
287 for (
size_t pos = 0;
pos < script.size();) {
288 const size_t end = std::min(script.find_first_of(
"\r\n",
pos), script.size());
305 const double time = std::chrono::duration<double>(std::chrono::steady_clock::now() -
mBenchmarkStart).count();
335 std::stringstream content;
336 content <<
file.rdbuf();
342 std::vector<const std::pair<const std::string, GPUDisplayConsoleCommand>*>
commands;
346 std::sort(
commands.begin(),
commands.end(), [](
const auto*
a,
const auto*
b) { return a->first < b->first; });
347 print(
"Console commands (argument types: s string, i integer, d number, a any, + further arguments):");
349 print(
" " +
c->first + (
c->second.args.empty() ?
"" :
" ") +
c->second.args +
": " +
c->second.description);
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 Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
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 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 Print launch bounds used for RTC code as debugging for exit after Allow RTC with slave GPUReconstruction instances with optConstexpr and optSpecialcode Maximum number of RTC cache files per backend in the cache the oldest are removed(0=no limit)") AddOption(prependCommand
char error[CURL_ERROR_SIZE]
void consoleInfo(const char *format, const char *text)
void processScripts(bool newFrame)
uint32_t mBenchmarkFrames
void consolePrint(const char *format,...)
std::vector< std::string > mConsoleHistory
std::chrono::steady_clock::time_point mWaitUntil
GPUDisplayConsole(const std::string &title)
const std::string & shownText() const
void runScriptFile(const std::string &filename)
std::tuple< const GPUDisplayConsoleCommand &, std::vector< consoleArg > > parseConsoleCommand(std::string_view cmd) const
std::deque< ScriptLine > mScriptQueue
std::string mConsoleInfoLastMessage
void runScript(std::string_view script)
void consoleLimitHistory(uint32_t historySize)
std::variant< int64_t, double, std::string > consoleArg
void handleConsoleKey(uint8_t key, bool shift)
void startBenchmark(uint32_t n)
std::chrono::steady_clock::time_point mConsoleInfoLastTime
std::chrono::steady_clock::time_point mBenchmarkStart
void scroll(int32_t lines)
std::function< bool()> mWaitCondition
uint32_t mConsoleTextCurrent
void printCommands(const std::function< void(const std::string &)> &print) const
void handleConsoleCommand(std::string_view cmd)
std::unordered_map< std::string, GPUDisplayConsoleCommand > mConsoleCommands
void consoleAppend(std::string line)
GLsizei GLenum GLenum * types
GLuint const GLchar * name
GLsizei const GLubyte * commands
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
GLboolean GLboolean GLboolean GLboolean a
GLint GLint GLsizei GLint GLenum format
GLsizeiptr const void GLenum usage
RuntimeErrorRef runtime_error(const char *)
std::string to_string(gsl::span< T, Size > span)
std::function< void(std::span< const consoleArg >)> func