LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
STCyclotron.cc File Reference
#include "G4MTRunManager.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "STCyclotronAnalysis.hh"
#include "STCyclotronActionInitialization.hh"
#include "STCyclotronDetectorConstruction.hh"
#include "STCyclotronPhysicsList.hh"
#include "STCyclotronPrimaryGeneratorAction.hh"
#include "STCyclotronRunAction.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 50 of file STCyclotron.cc.

51 {
52 #ifdef G4MULTITHREADED
53  G4MTRunManager* runManager = new G4MTRunManager;
54  runManager->SetNumberOfThreads(4); // Is equal to 2 by default
55 #else
56  G4RunManager* runManager = new G4RunManager;
57 #endif
58 
59  //Set mandatory initialization classes
60  STCyclotronDetectorConstruction* det = new STCyclotronDetectorConstruction();
61  runManager->SetUserInitialization(det);
62 
63  STCyclotronPhysicsList* physList = new STCyclotronPhysicsList(det);
64  runManager->SetUserInitialization(physList);
65 
66  // User action initialization
67  STCyclotronActionInitialization* actions = new STCyclotronActionInitialization(det);
68  runManager->SetUserInitialization(actions);
69 
70  //Set the random number seed
71 /*
72  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
73  G4long seed=time(0);
74  CLHEP::HepRandom::setTheSeed(seed);
75  G4cout << "***********************" << G4endl;
76  G4cout << "*** Seed: " << CLHEP::HepRandom::getTheSeed() << " ***" << G4endl;
77  G4cout << "***********************" << G4endl;
78  //getchar();
79  */
80 
81  G4VisManager* visManager = new G4VisExecutive("Quiet");
82  visManager->Initialize();
83 
84  // Get the pointer to the User Interface manager
85  G4UImanager* UImanager = G4UImanager::GetUIpointer();
86  //initialize : beam parameters + simulation parameters (geometry)
87  UImanager->ApplyCommand("/control/execute Macro/init_parameters.mac");
88 
89  if (argc!=1) {
90  // batch mode
91  //to apply the command : sahmri_simulation run.mac
92  G4String command = "/control/execute ";
93  G4String fileName = argv[1];
94  UImanager->ApplyCommand(command+fileName);
95  }
96 
97  else {
98  // interactive mode : define UI session
99 
100  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
101 
102  UImanager->ApplyCommand("/control/execute Macro/Vis/init_vis.mac");
103  //UImanager->ApplyCommand("/control/execute Macro/init.mac");
104 
105  if (ui->IsGUI())
106  UImanager->ApplyCommand("/control/execute Macro/GUI/gui.mac");
107  ui->SessionStart();
108  delete ui;
109  }
110 
111  delete visManager;
112  delete runManager;
113 
114  return 0;
115 
116 }