File indexing completed on 2026-05-04 08:07:30
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
0031
0032 #include "G4RunManagerFactory.hh"
0033 #include "G4Timer.hh"
0034 #include "G4Types.hh"
0035 #include "G4UImanager.hh"
0036 #include "G4ios.hh"
0037
0038
0039 #include "ExGflash2DetectorConstruction.hh"
0040 #include "ExGflash2ParallelWorld.hh"
0041 #include "ExGflashActionInitialization.hh"
0042 #include "FTFP_BERT.hh"
0043
0044 #include "G4FastSimulationPhysics.hh"
0045 #include "G4UIExecutive.hh"
0046 #include "G4VisExecutive.hh"
0047
0048
0049
0050 int main(int argc, char** argv)
0051 {
0052
0053 G4UIExecutive* ui = nullptr;
0054 if (argc == 1) {
0055 ui = new G4UIExecutive(argc, argv);
0056 }
0057
0058
0059 G4Timer timer;
0060 timer.Start();
0061
0062 G4cout << "+-------------------------------------------------------+" << G4endl;
0063 G4cout << "| |" << G4endl;
0064 G4cout << "| This is an example of Shower |" << G4endl;
0065 G4cout << "| Parameterization with GFLASH |" << G4endl;
0066 G4cout << "+-------------------------------------------------------+" << G4endl;
0067
0068 auto* runManager = G4RunManagerFactory::CreateRunManager();
0069 runManager->SetNumberOfThreads(1);
0070
0071
0072 G4cout << "# GFlash Example: Detector Construction" << G4endl;
0073 auto detector = new ExGflash2DetectorConstruction();
0074 detector->RegisterParallelWorld(new ExGflash2ParallelWorld("parallelWorld"));
0075 runManager->SetUserInitialization(detector);
0076
0077
0078
0079 G4VModularPhysicsList* physicsList = new FTFP_BERT();
0080
0081
0082 auto fastSimulationPhysics = new G4FastSimulationPhysics();
0083
0084
0085
0086
0087
0088 fastSimulationPhysics->ActivateFastSimulation("e-", "parallelWorld");
0089 fastSimulationPhysics->ActivateFastSimulation("e+", "parallelWorld");
0090
0091
0092
0093
0094
0095 physicsList->RegisterPhysics(fastSimulationPhysics);
0096 runManager->SetUserInitialization(physicsList);
0097
0098
0099 runManager->SetUserInitialization(new ExGflashActionInitialization);
0100
0101 G4VisManager* visManager = new G4VisExecutive;
0102 visManager->Initialize();
0103
0104 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0105 UImanager->ApplyCommand("/run/verbose 0");
0106 runManager->Initialize();
0107 UImanager->ApplyCommand("/Step/Verbose 0");
0108
0109 if (ui)
0110 {
0111 UImanager->ApplyCommand("/control/execute vis.mac");
0112 ui->SessionStart();
0113 delete ui;
0114 }
0115 else
0116 {
0117 G4String s = *(argv + 1);
0118 UImanager->ApplyCommand("/control/execute " + s);
0119 }
0120
0121 delete visManager;
0122 delete runManager;
0123
0124 timer.Stop();
0125 G4cout << G4endl;
0126 G4cout << "******************************************";
0127 G4cout << G4endl;
0128 G4cout << "Total Real Elapsed Time is: " << timer.GetRealElapsed();
0129 G4cout << G4endl;
0130 G4cout << "Total System Elapsed Time: " << timer.GetSystemElapsed();
0131 G4cout << G4endl;
0132 G4cout << "Total GetUserElapsed Time: " << timer.GetUserElapsed();
0133 G4cout << G4endl;
0134 G4cout << "******************************************";
0135 G4cout << G4endl;
0136
0137 return 0;
0138 }
0139
0140