Geant4 Example B0 for beginner
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

#include "ActionInitialization.h"
#include "DetectorConstruction.h"
#include "G4MTRunManager.hh"
#include "G4ScoringManager.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "PrimaryGeneratorAction.h"
#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();
runManager->SetUserInitialization(new DetectorConstruction());
runManager->SetUserInitialization(new QBBC);
runManager->SetUserInitialization(new ActionInitialization());
if (!ui) {
G4String command = "/control/execute ";
G4String fileName = argv[1];
UIManager->ApplyCommand(command + fileName);
} else {
UIManager->ApplyCommand("/control/execute vis.mac");
delete ui;
delete runManager;
delete visManager;
return 0;