#include "DetectorConstruction.hh" #include "ActionInitialization.hh" #include "PhysicsList.hh" #include "PhysicsListMessenger.hh" #include "G4ScoringManager.hh" #include "G4VScoringMesh.hh" #include "G4VScoreWriter.hh" #include "globals.hh" #include "StackingAction.hh" #include "PrimaryGeneratorAction.hh" #include "SteppingAction.hh" #include "RunAction.hh" #include "EventAction.hh" #include "G4RunManagerFactory.hh" #include "G4UImanager.hh" #include "G4VisExecutive.hh" #include "G4UIExecutive.hh" #include "Randomize.hh" #include "g4analysis.hh" int main(int argc,char** argv) { G4UIExecutive* ui = 0; if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); } auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default); G4ScoringManager * scManager = G4ScoringManager::GetScoringManager(); scManager->SetVerboseLevel(1); runManager->SetUserInitialization(new DetectorConstruction()); runManager->SetUserInitialization(new PhysicsList); PrimaryGeneratorAction *thePrimaryGeneratorAction = new PrimaryGeneratorAction(); RunAction *theRunAction = new RunAction(); runManager->SetUserAction(thePrimaryGeneratorAction); runManager->SetUserAction(theRunAction); runManager->SetUserAction(new StackingAction(theRunAction)); G4VisManager* visManager = new G4VisExecutive; visManager->Initialize(); G4UImanager* UImanager = G4UImanager::GetUIpointer(); if ( ! ui ) { // batch mode G4String command = "/control/execute "; G4String fileName = argv[1]; UImanager->ApplyCommand(command+fileName); } else { // interactive mode UImanager->ApplyCommand("/control/execute init_vis.mac"); ui->SessionStart(); delete ui; } delete visManager; delete runManager; }