gtree
Loading...
Searching...
No Matches
G4Ttree_item Class Reference

Lightweight per-volume record used by GTree to populate the UI. More...

#include <gtree.h>

Public Member Functions

 G4Ttree_item (G4Volume *g4volume)
 Construct a cached record for a single geometry volume.
 
std::string get_mother () const
 Return the cached mother name.
 
QColor get_color () const
 Return the cached RGB color.
 
bool get_visibility () const
 Return the cached visibility state.
 
int get_representation () const
 Return the cached representation mode.
 
double get_opacity () const
 Return the cached opacity (alpha) in [0,1].
 
double get_mass () const
 Return the cached mass.
 
double get_volume () const
 Return the cached volume.
 
double get_density () const
 Return the cached density.
 
std::string get_material () const
 Return the cached material name.
 
bool get_recursive () const
 Return the cached recursive flag.
 
void set_recursive (bool recursive)
 Set the recursive flag.
 
void set_color (QColor &c)
 Update the cached color.
 
void set_opacity (double opacity)
 Update the cached opacity.
 

Static Public Member Functions

static std::string vname_from_v4name (std::string v4name)
 Extract the "leaf" volume name from a full volume name.
 
static std::string system_from_v4name (std::string v4name)
 Extract the system name from a full volume name.
 

Detailed Description

This class extracts and caches a subset of geometry and visualization information from a G4Volume wrapper:

  • hierarchy (mother logical volume name)
  • material name
  • computed mass/volume/density (scaled to common units)
  • visualization attributes (visibility, color, opacity)

It is intentionally small and UI-oriented: it acts as the "model" part of the widget, decoupled from Qt item instances.

Definition at line 36 of file gtree.h.

Constructor & Destructor Documentation

◆ G4Ttree_item()

G4Ttree_item::G4Ttree_item ( G4Volume * g4volume)
explicit
Parameters
g4volumePointer to the volume wrapper providing access to the physical/logical/solid volume objects and their attributes.

The constructor reads:

  • The mother logical volume name (or a sentinel value for the world/root).
  • The material name.
  • Mass, volume, and density derived from the underlying geometry.
  • Visualization color and alpha (opacity), and the visibility flag.

The stored "mother" name is used by GTree to reconstruct parent-child relationships when building the Qt tree.

Definition at line 27 of file gtree.cc.

Member Function Documentation

◆ get_color()

QColor G4Ttree_item::get_color ( ) const
inline

Definition at line 133 of file gtree.h.

◆ get_density()

double G4Ttree_item::get_density ( ) const
inline

Definition at line 151 of file gtree.h.

◆ get_mass()

double G4Ttree_item::get_mass ( ) const
inline

Definition at line 145 of file gtree.h.

◆ get_material()

std::string G4Ttree_item::get_material ( ) const
inline

Definition at line 154 of file gtree.h.

◆ get_mother()

std::string G4Ttree_item::get_mother ( ) const
inline

Definition at line 130 of file gtree.h.

◆ get_opacity()

double G4Ttree_item::get_opacity ( ) const
inline

Definition at line 142 of file gtree.h.

◆ get_recursive()

bool G4Ttree_item::get_recursive ( ) const
inline

Definition at line 157 of file gtree.h.

◆ get_representation()

int G4Ttree_item::get_representation ( ) const
inline

Definition at line 139 of file gtree.h.

◆ get_visibility()

bool G4Ttree_item::get_visibility ( ) const
inline

Definition at line 136 of file gtree.h.

◆ get_volume()

double G4Ttree_item::get_volume ( ) const
inline

Definition at line 148 of file gtree.h.

◆ set_color()

void G4Ttree_item::set_color ( QColor & c)
inline
Parameters
cNew RGB color.

This is used after a color or opacity change so that subsequent opacity changes can preserve RGB and update only alpha.

Definition at line 173 of file gtree.h.

◆ set_opacity()

void G4Ttree_item::set_opacity ( double opacity)
inline
Parameters
opacityNew opacity (alpha) in [0,1].

Definition at line 179 of file gtree.h.

◆ set_recursive()

void G4Ttree_item::set_recursive ( bool recursive)
inline
Parameters
recursiveNew recursive state.

Definition at line 163 of file gtree.h.

◆ system_from_v4name()

std::string G4Ttree_item::system_from_v4name ( std::string v4name)
static
Parameters
v4nameFull volume name including a system prefix separated by /.
Returns
The substring before the last /.

The returned system name is used as the top-level grouping node in the tree widget.

Definition at line 72 of file gtree.cc.

◆ vname_from_v4name()

std::string G4Ttree_item::vname_from_v4name ( std::string v4name)
static
Parameters
v4nameFull volume name including a system prefix separated by /.
Returns
The substring after the last /.

This helper is used for display in the Qt tree so the user sees a compact name, while the full name remains stored as item metadata.

Definition at line 66 of file gtree.cc.


The documentation for this class was generated from the following files: