id int64 1 356 | name stringlengths 11 11 | comment stringlengths 162 1.57k | answer stringlengths 50 76.1k |
|---|---|---|---|
1 | sample_0001 | Please write C++ code to create an interactive graphical application that displays a window with a list of twenty programmatically generated entries labeled "Entry 1" through "Entry 20", a checkbox to enable multiple selections, and two buttons: one labeled "Show" that prints the currently selected entry (or all select... | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of how to create a list box and how to set and use its multiple selection feature.
/// To run it do either:
/// ~~~
/// .x listBox.C
/// .x listBox.C++
/// ~~~
///
/// \macro_code
///
/// \author Ilka Antcheva 1/12/2006
#include <TApplication.h>
#in... |
2 | sample_0002 | Please write C++ code to customize the context menu that appears when right-clicking on a one-dimensional histogram, replacing the default menu labels with more descriptive ones such as 'Add histos...', 'Divide histos...', 'Draw panel...', 'Fit one function...', 'Fit panel...', 'Multiply histos...', 'Rebin...', 'Set ma... | /// \file
/// \ingroup tutorial_gui
/// Example showing how to customize a context menu for a class
///
/// \macro_code
///
/// \author Ilka antcheva
{
cl = gROOT->GetClass("TH1F");
cl->MakeCustomMenuList();
ml = cl->GetMenuList();
((TClassMenuItem *)ml->At(1))->SetTitle("Add histos...");
((TClassMenu... |
3 | sample_0003 | Please write C++ code to create a graphical user interface window that contains an integer number entry field, a label displaying the entered value, and an exit button; when the user changes the number in the entry field, the label updates immediately to show the new value, and clicking the exit button terminates the a... | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of how to create a number entry and how to update a label according to the changed value
/// of this number entry. To run it do either:
/// ~~~
/// .x numberEntry.C
/// .x numberEntry.C++
/// ~~~
///
/// \macro_code
///
/// \author Ilka Antcheva 1/12... |
4 | sample_0004 | Please write C++ code to open a graphical window displaying a world map image, define interactive clickable polygonal regions over Russia, USA, France, UK, and Australia, each with a tooltip showing the country name, and when the user left‑clicks a region show a message box with the country’s phone code, and when the u... | /// \file
/// \ingroup tutorial_gui
/// This macro shows how to use a TGImageMap class.
/// A TGImageMap provides the functionality like a clickable image in with sensitive regions (similar to MAP HTML tag).
///
/// \macro_code
///
/// \author Valeriy Onuchin
#include <TGPicture.h>
#include <TGMenu.h>
#include <TGImag... |
5 | sample_0005 | Please write C++ code to replay a recorded interactive session from the URL http://root.cern/files/guitest_playback.root, which will automatically generate eleven script files named guitest001.C through guitest011.C. After the replay finishes, compute the character count of each generated file while ignoring carriage r... | /// \file
/// \ingroup tutorial_gui
/// This macro plays a recorded ROOT session showing how to perform various interactive GUI operations with the
/// guitest.C macro While replaying the session, several temporary macros (guitest0xx.C) macros will be saved. These
/// files will be later on compared with some reference... |
6 | sample_0006 | Please write C++ code to create an interactive graphical window for a data analysis environment that contains a button with a dropdown menu; the button can be toggled between a split state (showing a separate arrow for the menu) and a combined state via a checkbox, another checkbox enables or disables the button, and t... | /// \file
/// \ingroup tutorial_gui
/// A simple example that shows the usage of a TGSplitButton.
/// The checkbutton is used to change the split state of the button.
///
/// \macro_code
///
/// \author Roel Aaij 13/07/2007
#include <iostream>
#include <TApplication.h>
#include <TGClient.h>
#include <TGButton.h>
#incl... |
7 | sample_0007 | Please write C++ code to create an interactive application that plots a log-normal distribution function on a drawing canvas with logarithmic y-axis and grid, providing a triple slider to adjust the location parameter (mu) and the x-axis display range, with corresponding editable text fields showing the slider values a... | /// \file
/// \ingroup tutorial_gui
/// Simple macro showing capabilities of triple slider
///
/// \macro_code
///
/// \author Bertrand Bellenot, Ilka Antcheva
#include "TGButton.h"
#include "TRootEmbeddedCanvas.h"
#include "TGLayout.h"
#include "TF1.h"
#include "TMath.h"
#include "TCanvas.h"
#include "TGTextEntry.h"
... |
8 | sample_0008 | Please write C++ code to create an interactive visualization window that displays a sine wave graph calculated from internally generated coordinates (x from 0 to 1.9 in steps of 0.1, y = 10 * sin(x + 0.2)), drawn with a red line, blue circular markers, labeled axes ("X title" and "Y title"), a grid, and a title "a simp... | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of how to create a status bar related to an embedded canvas that shows the info of the
/// selected object, exactly as the status bar of any canvas window. To run it do either:
/// ~~~
/// .x statusBar.C
/// .x statusBar.C++
/// ~~~
///
/// \macro_code... |
9 | sample_0009 | Please write C++ code to create a graphical window that displays four labels: one with a bold 18-point Times font, yellow background, and blue text; another with the same font and blue text but no background; a standard default label; and a multi-line label resized to 350×80 pixels using the custom font and yellow back... | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of how to create different kind of labels and the possibility to enable/disable them.
/// To run it do either:
/// ~~~
/// .x guilabels.C
/// .x guilabels.C++
/// ~~~
///
/// \macro_code
///
/// \author Ilka Antcheva 1/12/2006
#include <TApplication... |
10 | sample_0010 | Please write C++ code to build a graphical window containing a text entry for typing interpreted C++ commands, a drop-down list of past commands, and a text area that displays the output of executed commands. The program should load a saved history of previously entered commands from a history file, allow the user to s... | /// \file
/// \ingroup tutorial_gui
/// A simple example of entering CLING commands and having the CLING output in a ROOT GUI application window.
/// An editable combo box is used as a CLING prompt, a text view widget displays the command output.
///
/// \macro_code
///
/// \author Ilka Antcheva 06/07/2007
#include ... |
11 | sample_0011 | Please write C++ code to create a resizable graphical user interface window titled "Vertical Splitter" that contains a vertical splitter dividing two panes, with the left pane displaying the text "Left Frame" and the right pane displaying "Right Frame", and includes Save and Exit buttons at the bottom. Clicking Save pr... | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of how to create a vertical splitter.
/// To run it do either:
/// ~~~
/// .x splitterVertical.C
/// .x splitterVertical.C++
/// ~~~
///
/// \macro_code
///
/// \author Ilka Antcheva 1/12/2006
#include <TGClient.h>
#include <TGButton.h>
#include <TG... |
12 | sample_0012 | Please write C++ code to create a graphical application that lets the user type a command into a text field, executes it as a system command, and displays the resulting text output in a scrollable area, while also providing a button to clear the output and another button to exit the program. | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of how to use the TGTextViewostream widget.
/// Simply type a command in the "Command" text entry, then the output is redirected to theTGTextViewostream.
/// To run it do either:
/// ~~~
/// .x textviewostream.C
/// .x textviewostream.C++
/// ~~~
///
/... |
13 | sample_0013 | Please write C++ code to create a graphical user interface window that contains a horizontal splitter dividing the display area into a top region labeled "Top Frame" and a bottom region labeled "Bottom Frame". The window shall include a "Save" button that, when clicked, stores the current interface layout, and an "Exit... | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of how to create a horizontal splitter.
/// To run it do either:
/// ~~~
/// .x splitterHorizontal.C
/// .x splitterHorizontal.C++
/// ~~~
///
/// \macro_code
///
/// \author Ilka Antcheva 1/12/2006
#include <TGClient.h>
#include <TGButton.h>
#inclu... |
14 | sample_0014 | Please write C++ code to display a graphical window titled “Buttons’ Layout” that contains a vertical fixed-width container holding a “Test” button stretched across its full width, a horizontal container with “Draw” and “Help” buttons equally sharing the available width, and another horizontal container with “OK”, “Can... | /// \file
/// \ingroup tutorial_gui
/// This macro gives an example of different buttons' layout.
/// To run it do either:
/// ~~~
/// .x buttonsLayout.C
/// .x buttonsLayout.C++
/// ~~~
///
/// \macro_code
///
/// \author Ilka Antcheva 1/12/2006
#include <TGClient.h>
#include <TGButton.h>
class MyMainFrame : publi... |
15 | sample_0015 | Please write C++ code to create an interactive graphical user interface that demonstrates a variety of controls for data analysis tasks, including a main window with a menu bar, a color-gradient display of 256 cells, file dialogs, directory and file browsing, message boxes, sliders, a shutter widget, progress bars, num... | /// \file
/// \ingroup tutorial_gui
/// Test program for ROOT native GUI classes
/// Exactly like $ROOTSYS/test/guitest.cxx but using the new signal and slots communication mechanism.
/// It is now possible to run this entire test program in the interpreter.
/// Do either:
/// ~~~{.cpp}
/// .x guitest.C
/// .x guitest.... |
16 | sample_0016 | Please write C++ code to create a visualization consisting of a pie chart with five slices whose data values are defined within the program (0.8, 1.2, 1.2, 0.8, 1.0), where each slice is filled with a radial gradient that transitions from an opaque orange color at the start to a semi-transparent red at the edge; the pi... | /// \file
/// \ingroup tutorial_gl
/// Features:
/// 1. Radial and linear gradients
/// 2. Transparent/semitransparent colours.
///
/// \macro_image(nobatch)
/// \macro_code
///
/// \authors Timur Pocheptsov, Sergey Linev
// Includes for ACLiC:
#include "TColorGradient.h"
#include "TCanvas.h"
#include "TError.h"
#i... |
17 | sample_0017 | Please write C++ code to run a user-supplied script that opens one or more graphical user interface windows, capture the content of each top-level window that appears, and save each captured image as a PNG file whose name is formed from the script basename followed by an underscore and a sequential index; before execut... | /// \file
/// \ingroup tutorial_gui
/// This utility macro executes the macro "macro" given as first argument and save a capture in a png file.
/// This macro is used by stressGUI to execute and compare the output of the GUI tutorials.
///
/// \macro_code
///
/// \author Bertrand Bellenot
#include "TSystem.h"
#include... |
18 | sample_0018 | Please write C++ code to generate two histograms with 10 bins each, one spanning the range -2 to 3 and the other spanning -3 to 3, fill them with 100,000 random numbers each from Landau and Gaussian distributions using a fixed random seed for reproducibility, and draw them in the same graphical window with semi-transpa... | /// \file
/// \ingroup tutorial_gl
/// This demo shows how to use transparency.
///
/// \macro_image(nobatch)
/// \macro_code
///
/// \authors Timur Pocheptsov, Sergey Linev
// Includes for ACLiC (cling does not need them).
#include "TCanvas.h"
#include "TColor.h"
#include "TError.h"
#include "TStyle.h"
#include "TH1F... |
19 | sample_0019 | Please write C++ code to display an interactive 3D surface plot of the Klein bottle, a closed non-orientable surface, using hardware-accelerated 3D graphics. The surface should be rendered with different color styles that the user can cycle through by pressing the 's' key, and the plot should include a label explaining... | /// \file
/// \ingroup tutorial_gl
/// Draws the Klein bottle.
/// Klein bottle is closed non-orientable surface that has no inside or
/// outside. TF3 can be drawn in several styles:
/// - default - like surface4
/// - kMaple0 - very nice colours
/// - kMaple1 - nice colours and outlines
/// - kMaple2 - nice colou... |
20 | sample_0020 | Please write C++ code to generate and display a 3D model of an atomic nucleus containing a user‑specified number of protons and neutrons. Each nucleon is shown as a sphere (red for protons, blue for neutrons) placed at a random location inside a larger spherical volume whose radius is automatically calculated from the ... | /// \file
/// \ingroup tutorial_gl
/// Model of a nucleus built from TGeo classes.
///
/// \macro_code
///
/// \author Otto Schaile
void nucleus(Int_t nProtons = 40, Int_t nNeutrons = 60)
{
Double_t NeutronRadius = 60, ProtonRadius = 60, NucleusRadius, distance = 60;
Double_t vol = nProtons + nNeutrons;
vol =... |
21 | sample_0021 | Please write C++ code to create a 3D surface visualization of the function f(x,y) = cos(y)*sin(x) + cos(x)*sin(y) over the domain from -6 to 6 in both x and y, rendered in a polar coordinate system with a smooth surface using a 30×30 grid, 10 contour levels, and a custom color palette that ranges from beige to pink. Th... | /// \file
/// \ingroup tutorial_gl
/// Render a TF2 looking like a rose.
///
/// It defines and set a user's palette, and use polar system.
///
/// \macro_image(nobatch)
/// \macro_code
///
/// \author Timur Pocheptsov
void glrose()
{
const Int_t paletteSize = 10;
Float_t rgb[paletteSize * 3] = {0.80f, 0.55f, 0... |
22 | sample_0022 | Please write C++ code to generate 10,000 Gaussian-distributed random numbers, fill a histogram with 20 equal‑width bins from –3 to 3, and display the histogram on a canvas that supports smooth gradient rendering. The histogram fill must use a 45‑degree linear gradient from yellow to orange to red; the canvas background... | /// \file
/// \ingroup tutorial_gl
/// This macro demonstrates how to create and use linear gradients to fill
/// a histogram or a pad.
///
/// \macro_image(nobatch)
/// \macro_code
///
/// \authors Timur Pocheptsov, Sergey Linev
// Includes for ACLiC (cling does not need them).
#include "TColorGradient.h"
#include "... |
23 | sample_0023 | Please write C++ code to generate a 3D scene consisting of many randomly shaped, colored geometric solids (spheres, tubes, and cut tubes) placed either randomly within a large bounding volume or on a regular grid, and then display the resulting geometry in an interactive 3D viewer to explore rendering detail levels. Th... | /// \file
/// \ingroup tutorial_gl
/// To set the Level Of Details when rendering geometry shapes.
///
/// \macro_code
///
/// \author Richard Maunder
void glViewerLOD(Int_t reqNodes = 1000, Bool_t randomDist = kTRUE, Bool_t reqSpheres = kTRUE, Bool_t reqTubes = kTRUE)
{
TGeoManager *geom = new TGeoManager("LODTest... |
24 | sample_0024 | Please write C++ code to create a graphical control panel with buttons that launch different 3D visualization demonstrations of mathematical surfaces and data histograms, including a surface plot, a polar surface, a user-defined 3D function surface, a 3D box plot of a three-dimensional histogram, and a parametric surfa... | /// \file
/// \ingroup tutorial_gl
/// Menu for running GL demos.
///
/// \macro_code
///
/// \author Timur Pocheptsov
void gldemos()
{
TControlBar *bar = new TControlBar("vertical", "GL painter demo", 20, 20);
bar->AddButton("Help on demos", "help()", "Description");
bar->AddButton("glsurfaces", ".x $ROOTSYS... |
25 | sample_0025 | Please write C++ code to generate and display a 3D event visualization containing randomly generated electron or positron tracks propagating in a constant magnetic field, randomly oriented jet cones, and a box with slightly randomized vertex positions, with an additional overlay text label shown in a separate overlay s... | /// \file
/// \ingroup tutorial_eve_7
/// Demonstrates usage of TEveBox class.
///
/// \image html eve_box.png
/// \macro_code
///
/// \author Matevz Tadel
#include <ROOT/REveBox.hxx>
#include <ROOT/REveScene.hxx>
#include <ROOT/REveManager.hxx>
#include <ROOT/REveTrackPropagator.hxx>
#include <ROOT/REveTrack.hxx>
#inc... |
26 | sample_0026 | Please write C++ code to create and display a 3D scene consisting of three colored geometric shapes: a red cube centered at the origin, a blue rectangular box positioned at (50, 100, 200), and a green square-based pyramid with its base at (20, 25, 45) and a height of 90. The shapes should be rendered using a local Open... | /// \file
/// \ingroup tutorial_gl
/// Demonstrates 3D viewer architecture TVirtualViewer3D and TBuffer3D in the master frame.
/// Here each shape is described directly in a TBuffer3D
/// class, with identity translation matrix c.f. viewer3DLocal.C
///
/// Our abstract base shape class.
///
/// As we overload TObject::... |
27 | sample_0027 | Please write C++ code to render several mathematical surfaces using hardware-accelerated (OpenGL) graphics, with display styles including Gouraud shading, color mesh, cylindrical coordinate mapping, polar coordinate mapping, and 3D volumetric rendering. Define the surfaces from expressions: f(x,y)=x^2+y^2-x^3-8*x*y^4 o... | /// \file
/// \ingroup tutorial_gl
/// Various surfaces rendered with GL.
/// This example draws 6 surfaces using OpenGL in pad (one is remake
/// of a classic surfaces.C, another contains 4 surfaces).
///
/// The commands used are exactly the same as with a normal pad.
/// The only command to add is: `gStyle->SetCanva... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 42