towards vis

This commit is contained in:
Jan Kieseler
2023-09-11 08:33:19 +02:00
parent b456e07018
commit 37d5b1eb3e
7 changed files with 212 additions and 109 deletions
@@ -1,4 +1,7 @@
#ifndef G4SYSTEM_HH
#define G4SYSTEM_HH
#include "ConstructionWrapper.hh"
#include <stdexcept>
#include "G4RunManagerFactory.hh"
@@ -15,11 +18,11 @@
#include "FTFP_BERT.hh"
#include "Randomize.hh"
class SystemBuilder{
class G4System{
public:
SystemBuilder(){};
~SystemBuilder(){
G4System(){};
~G4System(){
if(visManager != nullptr){
delete visManager;
delete runManager;
@@ -29,32 +32,23 @@ SystemBuilder(){};
void init(ConstructionWrapper &cw, bool gui=false);
void visualize()const{} //TBI
//will use dawn for visualization, also wrap more in python
void run_visualize(const std::string& partSpecies, double minEnergy, double maxEnergy);
//runs the whole gui if available
void run_gui();
void run_batch(int nEvents, const std::string& partSpecies, double minEnergy, double maxEnergy);
void applyUICommand(const std::string& command){
check();
UImanager->ApplyCommand(command);
}
void displayEvent()const{}; //just a placeholder, this will be implemented in python
private:
inline void check(){
if(runManager == nullptr){
throw std::runtime_error("runManager not found");
}
if(detConstruction == nullptr){
throw std::runtime_error("DetectorConstruction not found");
}
if(actionInitialization == nullptr){
throw std::runtime_error("ActionInitialization not found");
}
if(visManager == nullptr){
throw std::runtime_error("VisManager not found");
}
if(UImanager == nullptr){
throw std::runtime_error("UImanager not found");
}
if(ui == nullptr){
throw std::runtime_error("UI not found");
}
}
void check()const;
G4RunManager * runManager=nullptr;
@@ -66,6 +60,8 @@ G4UIExecutive * ui=nullptr;
};
#endif
/*