YiHui Liu
f09c1d4407
change: model format; add: template class for PrimaryGeneratorAction; add: random algorithm in PrimaryGeneratorAction;
46 lines
1.2 KiB
C++
46 lines
1.2 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"
|
|
|
|
extern G4String particleType;
|
|
|
|
int main(int argc, char** argv) {
|
|
G4UIExecutive* ui = nullptr;
|
|
if (argc == 1) ui = new G4UIExecutive(argc, argv);
|
|
if (argc >= 3)
|
|
particleType = argv[2];
|
|
else
|
|
particleType = "TE";
|
|
|
|
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;
|
|
}
|