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