66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
// clang-format off
|
|
#include "TROOT.h"
|
|
#include "time.h"
|
|
|
|
#include "G4RunManager.hh"
|
|
#include "G4SystemOfUnits.hh"
|
|
#include "G4UIExecutive.hh"
|
|
#include "G4UImanager.hh"
|
|
#include "G4UItcsh.hh"
|
|
#include "G4UIterminal.hh"
|
|
#include "G4UnitsTable.hh"
|
|
#include "G4VisExecutive.hh"
|
|
#include "G4OpticalPhysics.hh"
|
|
#include "QGSP_BERT_HP.hh"
|
|
|
|
#include "GeneDetectorConstruction.hh"
|
|
#include "GeneEventAction.hh"
|
|
#include "GenePrimaryGeneratorAction.hh"
|
|
#include "GeneRunAction.hh"
|
|
// clang-format on
|
|
|
|
int main(int argc, char **argv) {
|
|
// random engine
|
|
// CLHEP::HepJamesRandom randomEngine;
|
|
G4long seeds;
|
|
seeds = time(NULL);
|
|
CLHEP::Ranlux64Engine randomEngine;
|
|
CLHEP::HepRandom::setTheEngine(&randomEngine);
|
|
CLHEP::HepRandom::setTheSeed(seeds);
|
|
CLHEP::HepRandom::showEngineStatus();
|
|
|
|
G4UIExecutive *ui = nullptr;
|
|
if (argc == 1) ui = new G4UIExecutive(argc, argv);
|
|
|
|
// run manager
|
|
G4RunManager *runManager = new G4RunManager;
|
|
|
|
runManager->SetUserInitialization(new GeneDetectorConstruction);
|
|
G4VModularPhysicsList *physics = new QGSP_BERT_HP;
|
|
physics->RegisterPhysics(new G4OpticalPhysics);
|
|
runManager->SetUserInitialization(physics);
|
|
|
|
runManager->SetUserAction(new GenePrimaryGeneratorAction);
|
|
runManager->SetUserAction(new GeneRunAction);
|
|
runManager->SetUserAction(new GeneEventAction);
|
|
runManager->Initialize();
|
|
|
|
G4VisManager *visManager = new G4VisExecutive;
|
|
G4UImanager *UIManager = G4UImanager::GetUIpointer();
|
|
visManager->Initialize();
|
|
|
|
if (!ui) {
|
|
G4String command = "/control/execute ";
|
|
G4String fileName = argv[1];
|
|
UIManager->ApplyCommand(command + fileName);
|
|
} else {
|
|
UIManager->ApplyCommand("/control/execute init_vis.mac");
|
|
ui->SessionStart();
|
|
delete ui;
|
|
}
|
|
|
|
delete visManager;
|
|
delete runManager;
|
|
return 0;
|
|
}
|