45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
|
#include "QGSP_BERT.hh"
|
||
|
#include "G4MTRunManager.hh"
|
||
|
#include "G4VUserActionInitialization.hh"
|
||
|
#include "G4UImanager.hh"
|
||
|
#include "G4UIExecutive.hh"
|
||
|
#include "G4VisExecutive.hh"
|
||
|
|
||
|
#include "Geometry.h"
|
||
|
#include "ParticleSource.h"
|
||
|
|
||
|
class ActionInitialzation : public G4VUserActionInitialization {
|
||
|
public:
|
||
|
virtual void Build() const{
|
||
|
SetUserAction(new GeneratorAction);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
int main(int argc, char** argv) {
|
||
|
G4UIExecutive* ui = nullptr;
|
||
|
if (argc == 1)
|
||
|
ui = new G4UIExecutive(argc, argv);
|
||
|
|
||
|
auto runManager = new G4MTRunManager;
|
||
|
auto visManager = new G4VisExecutive;
|
||
|
auto UIManager = G4UImanager::GetUIpointer();
|
||
|
|
||
|
runManager->SetUserInitialization(new DetectorConstruction());
|
||
|
runManager->SetUserInitialization(new QGSP_BERT());
|
||
|
runManager->SetUserInitialization(new ActionInitialzation());
|
||
|
|
||
|
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;
|
||
|
}
|