LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
dmparticle.cc File Reference

Main program of the exoticphysics/dmparticle example. More...

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4MTRunManager.hh"
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the exoticphysics/dmparticle example.

Definition in file dmparticle.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 50 of file dmparticle.cc.

51 {
52  // Instantiate G4UIExecutive if interactive mode
53  G4UIExecutive* ui = nullptr;
54  if ( argc == 1 ) {
55  ui = new G4UIExecutive(argc, argv);
56  }
57 
58  //choose the Random engine
59  CLHEP::HepRandom::setTheEngine(new CLHEP::Ranlux64Engine);
60 
61  G4UImanager* UI = G4UImanager::GetUIpointer();
62  PhysicsList* phys = new PhysicsList();
63 
64  // defined mass of LDM particles
65  if(argc > 2) {
66  G4String s = argv[2];
67  UI->ApplyCommand("/control/verbose 1");
68  UI->ApplyCommand("/testex/phys/setLDMPhotonMass " + s + " GeV");
69  }
70  if(argc > 3) {
71  G4String s = argv[3];
72  UI->ApplyCommand("/testex/phys/setLDMHiMass " + s + " GeV");
73  }
74 
75  // Construct the default run manager
76 #ifdef G4MULTITHREADED
77  G4MTRunManager* runManager = new G4MTRunManager;
78  G4int nThreads = std::min(G4Threading::G4GetNumberOfCores(),2);
79  runManager->SetNumberOfThreads(nThreads);
80  G4cout << "===== dmparticle is started with "
81  << runManager->GetNumberOfThreads() << " threads =====" << G4endl;
82 #else
83  G4RunManager* runManager = new G4RunManager();
84 #endif
85 
86  // set mandatory initialization classes
88  runManager->SetUserInitialization( phys );
89  runManager->SetUserInitialization( det);
90 
91  // set user action classes
92  runManager->SetUserInitialization( new ActionInitialization(det));
93 
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 
97  if (!ui) // batch mode
98  {
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UI->ApplyCommand(command+fileName);
102  }
103  else //define visualization and UI terminal for interactive mode
104  {
105  ui->SessionStart();
106  delete ui;
107  }
108  // job termination
109  delete visManager;
110  delete runManager;
111  return 0;
112 }
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:83