ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dmparticle.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file dmparticle.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "G4Types.hh"
34 
35 #include "G4RunManager.hh"
36 #include "G4MTRunManager.hh"
37 #include "G4UImanager.hh"
38 #include "G4UIcommand.hh"
39 #include "Randomize.hh"
40 
41 #include "DetectorConstruction.hh"
42 #include "PhysicsList.hh"
43 #include "ActionInitialization.hh"
44 
45 #include "G4VisExecutive.hh"
46 #include "G4UIExecutive.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
50 int main(int argc,char** argv)
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
60 
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;
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 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
116