File indexing completed on 2026-09-21 08:29:13
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 #include "ActionInitialization.hh"
0030 #include "DetectorConstruction.hh"
0031 #include "PhysicsList.hh"
0032
0033 #include "G4RunManagerFactory.hh"
0034 #include "G4Types.hh"
0035 #include "G4UIExecutive.hh"
0036 #include "G4UIcommand.hh"
0037 #include "G4UImanager.hh"
0038 #include "G4VisExecutive.hh"
0039 #include "Randomize.hh"
0040
0041
0042
0043 int main(int argc, char** argv)
0044 {
0045
0046 G4UIExecutive* ui = nullptr;
0047 if (argc == 1) {
0048 ui = new G4UIExecutive(argc, argv);
0049 }
0050
0051
0052 CLHEP::HepRandom::setTheEngine(new CLHEP::Ranlux64Engine);
0053
0054 G4UImanager* UI = G4UImanager::GetUIpointer();
0055 PhysicsList* phys = new PhysicsList();
0056
0057
0058 if (argc > 2) {
0059 G4String s = argv[2];
0060 UI->ApplyCommand("/control/verbose 1");
0061 UI->ApplyCommand("/testex/phys/setLDMPhotonMass " + s + " GeV");
0062 }
0063 if (argc > 3) {
0064 G4String s = argv[3];
0065 UI->ApplyCommand("/testex/phys/setLDMHiMass " + s + " GeV");
0066 }
0067
0068
0069 auto* runManager = G4RunManagerFactory::CreateRunManager();
0070 G4int nThreads = std::min(G4Threading::G4GetNumberOfCores(), 2);
0071 runManager->SetNumberOfThreads(nThreads);
0072 G4cout << "===== dmparticle is started with " << runManager->GetNumberOfThreads()
0073 << " threads =====" << G4endl;
0074
0075
0076 DetectorConstruction* det = new DetectorConstruction();
0077 runManager->SetUserInitialization(phys);
0078 runManager->SetUserInitialization(det);
0079
0080
0081 runManager->SetUserInitialization(new ActionInitialization(det));
0082
0083 G4VisManager* visManager = new G4VisExecutive;
0084 visManager->Initialize();
0085
0086 if (!ui)
0087 {
0088 G4String command = "/control/execute ";
0089 G4String fileName = argv[1];
0090 UI->ApplyCommand(command + fileName);
0091 }
0092 else
0093 {
0094 ui->SessionStart();
0095 delete ui;
0096 }
0097
0098 delete visManager;
0099 delete runManager;
0100 return 0;
0101 }
0102
0103