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