Warning, file /geant4/examples/extended/medical/fanoCavity2/fanoCavity2.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #include "ActionInitialization.hh"
0030 #include "DetectorConstruction.hh"
0031 #include "EventAction.hh"
0032 #include "PhysicsList.hh"
0033 #include "PrimaryGeneratorAction.hh"
0034 #include "RunAction.hh"
0035 #include "SteppingAction.hh"
0036 #include "TrackingAction.hh"
0037
0038 #include "G4RunManagerFactory.hh"
0039 #include "G4SteppingVerbose.hh"
0040 #include "G4Types.hh"
0041 #include "G4UIExecutive.hh"
0042 #include "G4UImanager.hh"
0043 #include "G4VisExecutive.hh"
0044 #include "Randomize.hh"
0045
0046
0047
0048 int main(int argc, char** argv)
0049 {
0050
0051 G4UIExecutive* ui = nullptr;
0052 if (argc == 1) ui = new G4UIExecutive(argc, argv);
0053
0054
0055 G4int precision = 4;
0056 G4SteppingVerbose::UseBestUnit(precision);
0057
0058
0059 auto runManager = G4RunManagerFactory::CreateRunManager();
0060
0061 if (argc == 3) {
0062 G4int nThreads = G4UIcommand::ConvertToInt(argv[2]);
0063 runManager->SetNumberOfThreads(nThreads);
0064 }
0065
0066
0067 DetectorConstruction* det;
0068 PhysicsList* phys;
0069
0070 runManager->SetUserInitialization(det = new DetectorConstruction);
0071 runManager->SetUserInitialization(phys = new PhysicsList());
0072
0073
0074 runManager->SetUserInitialization(new ActionInitialization(det));
0075
0076
0077 G4VisManager* visManager = nullptr;
0078
0079
0080 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0081
0082 if (ui) {
0083
0084 visManager = new G4VisExecutive;
0085 visManager->Initialize();
0086 UImanager->ApplyCommand("/control/execute vis.mac");
0087 ui->SessionStart();
0088 delete ui;
0089 }
0090 else {
0091
0092 G4String command = "/control/execute ";
0093 G4String fileName = argv[1];
0094 UImanager->ApplyCommand(command + fileName);
0095 }
0096
0097
0098 delete visManager;
0099 delete runManager;
0100 }
0101
0102