File indexing completed on 2025-02-23 09:22:32
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 "G4PhysListFactory.hh"
0034 #include "G4RunManagerFactory.hh"
0035 #include "G4Timer.hh"
0036 #include "G4Types.hh"
0037 #include "G4UImanager.hh"
0038 #include "G4ios.hh"
0039
0040
0041 #include "ExGflashActionInitialization.hh"
0042 #include "ExGflashDetectorConstruction.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
0070
0071 auto detector = new ExGflashDetectorConstruction;
0072 runManager->SetUserInitialization(detector);
0073
0074
0075 G4PhysListFactory listFactory;
0076 G4String name;
0077 auto list_name = std::getenv("PHYSLIST");
0078 if (list_name == nullptr || std::strlen(list_name) == 0) {
0079 name = "FTFP_BERT";
0080 }
0081 else {
0082 name = list_name;
0083 }
0084 G4VModularPhysicsList* physicsList = listFactory.GetReferencePhysList(name);
0085
0086
0087
0088 auto fastSimulationPhysics = new G4FastSimulationPhysics();
0089
0090
0091
0092
0093
0094
0095
0096 fastSimulationPhysics->ActivateFastSimulation("e-");
0097 fastSimulationPhysics->ActivateFastSimulation("e+");
0098
0099
0100
0101
0102
0103 physicsList->RegisterPhysics(fastSimulationPhysics);
0104 runManager->SetUserInitialization(physicsList);
0105
0106
0107 runManager->SetUserInitialization(new ExGflashActionInitialization(detector));
0108
0109 G4VisManager* visManager = new G4VisExecutive;
0110 visManager->Initialize();
0111
0112 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0113 UImanager->ApplyCommand("/run/verbose 0");
0114 runManager->Initialize();
0115 UImanager->ApplyCommand("/Step/Verbose 0");
0116
0117 if (ui != nullptr)
0118 {
0119 UImanager->ApplyCommand("/control/execute vis.mac");
0120 ui->SessionStart();
0121 delete ui;
0122 }
0123 else
0124 {
0125 G4String s = *(argv + 1);
0126 UImanager->ApplyCommand("/control/execute " + s);
0127 }
0128
0129 delete visManager;
0130 delete runManager;
0131
0132 timer.Stop();
0133 G4cout << G4endl;
0134 G4cout << "******************************************";
0135 G4cout << G4endl;
0136 G4cout << "Total Real Elapsed Time is: " << timer.GetRealElapsed();
0137 G4cout << G4endl;
0138 G4cout << "Total System Elapsed Time: " << timer.GetSystemElapsed();
0139 G4cout << G4endl;
0140 G4cout << "Total GetUserElapsed Time: " << timer.GetUserElapsed();
0141 G4cout << G4endl;
0142 G4cout << "******************************************";
0143 G4cout << G4endl;
0144
0145 return 0;
0146 }
0147
0148