File indexing completed on 2025-01-30 09:19:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "G4RunManager.hh"
0031 #include "DetectorConstruction.hh"
0032 #include "PhysicsList.hh"
0033 #include "G4UImanager.hh"
0034 #include "G4VisExecutive.hh"
0035 #include "G4RunManagerFactory.hh"
0036 #include "AnalysisManager.hh"
0037 #include "ActionInitialization.hh"
0038 #include "AnalysisManager.hh"
0039 #include "G4UIExecutive.hh"
0040
0041 #include "DetectorMessenger.hh"
0042 #include "AnalysisMessenger.hh"
0043
0044 int main(int argc, char** argv)
0045 {
0046
0047 auto* pRunManager = G4RunManagerFactory::CreateRunManager();
0048 G4int nThreads = 4;
0049 pRunManager->SetNumberOfThreads(nThreads);
0050
0051 AnalysisMessenger* anMess = new AnalysisMessenger();
0052 AnalysisManager* analysis = new AnalysisManager(anMess);
0053
0054
0055
0056 DetectorMessenger* detMess = new DetectorMessenger(analysis);
0057 DetectorConstruction* detector = new DetectorConstruction(analysis, detMess);
0058
0059 pRunManager -> SetUserInitialization(detector);
0060
0061 G4VUserPhysicsList* physics = new PhysicsList();
0062
0063 pRunManager -> SetUserInitialization(physics);
0064
0065
0066
0067 ActionInitialization* actions = new ActionInitialization(analysis, detMess);
0068 pRunManager->SetUserInitialization(actions);
0069
0070 G4VisManager* visManager = new G4VisExecutive();
0071 visManager->Initialize();
0072
0073
0074
0075 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0076
0077 if(argc == 1){
0078
0079
0080 G4UIExecutive* ui = new G4UIExecutive(argc, argv);
0081 G4cout << " UI session starts ..." << G4endl;
0082 UImanager -> ApplyCommand("/control/execute vis.mac");
0083
0084
0085 ui -> SessionStart();
0086 delete ui;
0087
0088 } else {
0089
0090 G4String command = "/control/execute ";
0091 G4String fileName = argv[1];
0092 UImanager->ApplyCommand(command+fileName);
0093 }
0094
0095 delete visManager;
0096 delete analysis;
0097 delete pRunManager;
0098 delete detMess;
0099 delete anMess;
0100
0101 return 0;
0102 }