gui
Loading...
Searching...
No Matches
rightContent.cc
Go to the documentation of this file.
1// gui
2#include "gui.h"
3
4// gemc
5#include "g4display.h"
7#include "g4dialog.h"
8#include "dbselectView.h"
9#include "gtree.h"
10#include "pmakerView.h"
11#include "gAnalysisView.h"
12#include "gemc/actions/gaction.h"
13
14// geant4
15#include "G4RunManager.hh"
16
17void GemcGUI::createRightContent(std::shared_ptr<GOptions> gopts,
19 GBoard* gb) {
20 // The stacked widget hosts all right-side pages. The left button bar selects the current index.
21 rightContent = new QStackedWidget;
22
23
24
25 // Page order must match the left button bar order so indexes remain consistent.
26 auto* setupView = new DBSelectView(gopts, dc);
27
28 // display controls
29 auto* g4display = new G4Display(gopts);
30 rightContent->addWidget(g4display);
31 auto* displayUtilities = g4display->findChild<G4DisplayUtilities*>();
32 if (displayUtilities) {
33 connect(displayUtilities, &G4DisplayUtilities::sceneOptionsChanged,
34 this, &GemcGUI::refreshVisualizationFromOptions);
35 }
36
37 // setup/systems controls
38 rightContent->addWidget(setupView);
39 connect(setupView, &DBSelectView::geometryAboutToReload,
40 this, &GemcGUI::resetVisualizationBeforeGeometryReload);
41 connect(setupView, &DBSelectView::geometryReloaded, this, &GemcGUI::refreshGeometryTree);
42
43 // gvolume controls
44 geometryTree = new GTree(gopts,
45 dc && dc->has_built_geometry()
46 ? dc->get_g4volumes_map()
47 : std::unordered_map<std::string, G4Volume*>{},
48 dc && dc->has_built_geometry()
50 : std::unordered_map<std::string, const GVolume*>{},
51 nullptr,
52 dc && dc->has_built_geometry()
54 : std::unordered_map<std::string, const GMirror*>{});
55 rightContent->addWidget(geometryTree);
56
57 // g4dialog
58 rightContent->addWidget(new G4Dialog(gopts, gb));
59
60 // generator / particle maker — share the exact same GparticlePtr objects as the generator
61 std::shared_ptr<std::vector<GparticlePtr>> sharedParticles;
62 if (auto* rm = G4RunManager::GetRunManager()) {
63 if (auto* ga = dynamic_cast<GAction*>(
64 const_cast<G4VUserActionInitialization*>(rm->GetUserActionInitialization())))
65 sharedParticles = ga->getSharedParticles();
66 }
67 rightContent->addWidget(new PmakerView(sharedParticles, gopts));
68
69 // Analyzer variables are populated from runtime records after the first GUI beamOn.
70 analysisView = new GAnalysisView(analysisAccumulator, ganalysis::getOptions(gopts));
71 rightContent->addWidget(analysisView);
72
73 // Default to the first page and update the left bar visual highlight accordingly.
74 rightContent->setCurrentIndex(0);
75 leftButtons->press_button(0);
76}
void geometryReloaded()
void geometryAboutToReload()
void sceneOptionsChanged()
std::unordered_map< std::string, const GVolume * > get_gvolumes_flat_map() const
std::unordered_map< std::string, G4Volume * > get_g4volumes_map() const
std::unordered_map< std::string, const GMirror * > get_gmirrors_flat_map() const
bool has_built_geometry() const