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