Example application demonstrating how to instantiate and run the GTree widget.
More...
#include "G4VisExecutive.hh"
#include "G4RunManagerFactory.hh"
#include "QBBC.hh"
#include "gtree.h"
#include "gtree_options.h"
#include "gdetectorConstruction.h"
#include <QApplication>
#include <QMainWindow>
#include <QTimer>
Go to the source code of this file.
|
| int | main (int argc, char *argv[]) |
| | Example program entry point that launches the geometry tree browser.
|
This example shows a minimal workflow:
- Build an option set using gtree::defineOptions()
- Construct Geant4 run manager and visualization manager
- Build the detector construction and retrieve the geometry volume map
- If --gui is enabled, create a Qt main window and embed GTree as the central widget
- Exit after a configurable timeout
How to run (conceptual)
- GUI mode: pass --gui to create the Qt event loop and show the widget.
- Timeout: the example reads a scalar double option named tt and uses it as the delay (in milliseconds) before quitting the Qt event loop.
The option names (gui, tt) are expected to be defined by the composed option set returned by gtree::defineOptions().
Definition in file gtree_example.cc.
◆ main()
| int main |
( |
int | argc, |
|
|
char * | argv[] ) |
- Parameters
-
| argc | Standard command line argument count. |
| argv | Standard command line argument vector. |
- Returns
- Process exit code. In GUI mode this is the Qt application return code.
Execution outline:
- Parse options and configure logging.
- Create Geant4 run manager, physics list, and visualization manager.
- Create the detector and initialize the run manager.
- Retrieve the geometry volume map from the detector construction.
- If --gui is enabled:
- Create the Qt application and main window.
- Create a GTree widget using the volume map.
- Quit the Qt event loop after the configured timeout.
- Otherwise (CLI mode), exit after initialization.
Definition at line 61 of file gtree_example.cc.