gtree
Loading...
Searching...
No Matches
gtree_example.cc File Reference

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>
Include dependency graph for gtree_example.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 Example program entry point that launches the geometry tree browser.
 

Detailed Description

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.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )
Parameters
argcStandard command line argument count.
argvStandard command line argument vector.
Returns
Process exit code. In GUI mode this is the Qt application return code.

Execution outline:

  1. Parse options and configure logging.
  2. Create Geant4 run manager, physics list, and visualization manager.
  3. Create the detector and initialize the run manager.
  4. Retrieve the geometry volume map from the detector construction.
  5. 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.
  6. Otherwise (CLI mode), exit after initialization.

Definition at line 61 of file gtree_example.cc.