Skip to content

Commands

peter edited this page Aug 25, 2026 · 2 revisions

Commands

This page lists the current interactive commands implemented in libraries/GRoot/GCommands.cxx and libraries/GRoot/GCanvas.cxx.

Most histogram commands are dispatched through the GRootInteract() TExec. GCanvas adds that exec automatically. A normal ROOT TCanvas can use the same command path if the exec is added manually:

canvas->AddExec("groot_interact", "GRootInteract()");

Prompt Help

The groot prompt catches these help commands before passing input to ROOT:

Prompt command Action
? Print a short command overview.
help Print the same short overview.
help commands Print a compact key and mouse command summary.
help markers Print marker usage notes.
help fitting Print 1D fit workflow notes.
help projections Print projection workflow notes.
help roi Print current ROI status and API entry points.
help journal Print semantic GUI history controls.
help root Print how to attach GRootInteract() in a normal ROOT session.

Mouse Commands

Input Context Action Notes
Left click 1D or 2D histogram Add a primary marker Primary markers are generally limited to two.
Ctrl + left click 1D histogram Add a fit marker Four fit markers are used for double-Gaussian fitting. This depends on GCanvas event-state tracking.
Ctrl + left click 2D histogram Add a cut marker This depends on GCanvas event-state tracking.
Left click after starting 2D cut mode 2D histogram Add another cut vertex Once cut markers exist, ordinary clicks continue the cut.
Shift + left click Histogram Open a clean draw-copy in a new GCanvas Copied helper objects such as markers and fits are removed from the copy.
Drag marker Marker object Move marker Handled by GMarker::ExecuteEvent.
Drag existing TCutG 2D histogram cut Let ROOT edit the cut Existing cuts are left to ROOT's native interaction.

1D Histogram Keys

These commands operate on the current 1D histogram returned by GrabHist().

Key Marker Requirement Action Notes
b None Show calculated background GH1D only.
B None Toggle background display/removal state GH1D only.
e Two primary markers Expand/zoom X range to the marker interval Markers are removed after zooming.
f Two primary markers Run PhotoPeakFit() over the marker interval Uses the photopeak fit model.
g Two primary markers Run GausFit() over the marker interval Markers are removed after a successful fit.
g Four fit markers Run DoubleGausFit() Fit markers are usually created with Ctrl + left click in GCanvas.
m None Remove markers Removes all marker types on the histogram.
n None Clear fits, markers, residual state, sumw2, and shown peak markers Does not delete the histogram.
o None Unzoom X axis Restores the full X range.
q None Unbin by a factor of two GH1D only; preserves the current viewed X range.
r None Toggle residual display GH1D only. This is the current code behavior.
s None Show searched peaks GH1D::ShowPeaks().
w None Rebin by a factor of two GH1D only; preserves the current viewed X range.
l or z None Toggle log Y scale Uses the current pad.

1D Projection Keys

These commands apply when the current 1D histogram is a GH1D projection with a GH2D parent.

Key Marker Requirement Action Notes
c Two primary markers Store the marker interval as a background range Only valid on a projection from a GH2D. Existing background markers are replaced.
p Two primary markers Project the parent matrix onto the opposite axis through the marker interval If two background markers exist, the background projection is subtracted. Current subtraction is unscaled by gate width.

2D Histogram Keys

These commands operate on 2D histograms. Some require the histogram to be a GH2D; plain ROOT TH2 support is limited to ROOT-native behavior.

Key Marker Requirement Action Notes
c At least one primary marker Convert primary markers into cut markers Starts polygon cut-vertex mode.
e Two primary markers Expand/zoom X and Y ranges to the marker box Markers are removed after zooming.
g Cut markers Build a TCutG from cut markers The cut is named cutN, added to the histogram function list, and markers are removed.
m None Remove markers Removes all marker types on the histogram.
n None Clear fits and markers Also clears Sumw2.
o None Unzoom X and Y axes Restores both axes.
x None Create and draw a full X projection in a new GCanvas GH2D only. The projection remembers its parent.
X None Enable ROOT's TH2::SetShowProjectionX(1) Works on any TH2.
y None Create and draw a full Y projection in a new GCanvas GH2D only. The projection remembers its parent.
l or z None Toggle log Z scale Uses the current pad.

GCanvas-Only Keys

These commands are handled by GCanvas, not by the GRootInteract() TExec alone.

Key Context Action Notes
Space Multi-pad canvas Make the selected pad current and update pads Useful after clicking between subpads.
Left arrow 1D histogram Slide the viewed X range left by half a window Shift or locked pads applies the slide to all histograms on the canvas.
Right arrow 1D histogram Slide the viewed X range right by half a window Shift or locked pads applies the slide to all histograms on the canvas.
Up arrow 1D projection from GH2D Draw the next projection remembered by the parent GH2D Projection-history navigation.
Down arrow 1D projection from GH2D Draw the previous projection remembered by the parent GH2D Projection-history navigation.

ROI Status

GROI currently exists as an object/API feature, not as a key-bound interactive mode. The current 1D keyboard workflow is fit-centered:

  • g and f create fits from marker ranges.
  • r toggles residual display for fit inspection.
  • ROI creation/removal is available through GROI, GROI::CreateFromMarkers(), and GROI::RemoveAll().

GUI History

Interactive prompt input is already stored by ROOT in .gint_history. In addition, groot records semantic GUI actions to .gui_history by default. The file uses JSON Lines and is meant to describe meaningful analysis operations rather than raw mouse pixels. See GUI History for the full format, controls, and inspector commands.

Currently Unbound or Stubbed

Command Status
Canvas ? key Not currently bound in GCommands.cxx; use prompt ? or help.
R remove ROIs Listed in older README text, but no current key binding was found in GCommands.cxx.
ROI creation key Intentionally not bound in the current interaction mode. Use the GROI API directly for now.
Graph commands GRootInteractGraph* functions currently return without doing meaningful work.

Clone this wiki locally