G4-DESCSS/main.cpp

41 lines
1.1 KiB
C++

#include "ActionInitialization.h"
#include "DetectorConstruction.h"
#include "PrimaryGeneratorAction.h"
#include "G4MTRunManager.hh"
#include "G4ScoringManager.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "QBBC.hh"
int main(int argc, char** argv) {
G4UIExecutive* ui = nullptr;
if (argc == 1) ui = new G4UIExecutive(argc, argv);
G4MTRunManager* runManager = new G4MTRunManager;
G4VisExecutive* visManager = new G4VisExecutive;
G4UImanager* UIManager = G4UImanager::GetUIpointer();
G4ScoringManager::GetScoringManager();
runManager->SetUserInitialization(new DetectorConstruction());
runManager->SetUserInitialization(new QBBC);
runManager->SetUserInitialization(new ActionInitialization());
visManager->Initialize();
if (!ui) {
G4String command = "/control/execute ";
G4String fileName = argv[1];
UIManager->ApplyCommand(command + fileName);
} else {
UIManager->ApplyCommand("/control/execute vis.mac");
ui->SessionStart();
delete ui;
}
delete runManager;
delete visManager;
return 0;
}