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 rightContent->addWidget(geometryTree);
52
53 // g4dialog
54 rightContent->addWidget(new G4Dialog(gopts, gb));
55
56 // generator / particle maker — share the exact same GparticlePtr objects as the generator
57 std::shared_ptr<std::vector<GparticlePtr>> sharedParticles;
58 if (auto* rm = G4RunManager::GetRunManager()) {
59 if (auto* ga = dynamic_cast<GAction*>(
60 const_cast<G4VUserActionInitialization*>(rm->GetUserActionInitialization())))
61 sharedParticles = ga->getSharedParticles();
62 }
63 rightContent->addWidget(new PmakerView(sharedParticles, gopts));
64
65 // Analyzer variables are populated from runtime records after the first GUI beamOn.
66 analysisView = new GAnalysisView(analysisAccumulator, ganalysis::getOptions(gopts));
67 rightContent->addWidget(analysisView);
68
69 // Default to the first page and update the left bar visual highlight accordingly.
70 rightContent->setCurrentIndex(0);
71 leftButtons->press_button(0);
72}
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
bool has_built_geometry() const