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

Implementation of the slowing example. More...

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Implementation of the slowing example.

Definition in file slowing.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 53 of file slowing.cc.

54 {
55  // Detect interactive mode (if no arguments) and define UI session
56  G4UIExecutive* ui = 0;
57  if ( argc == 1 ) {
58  ui = new G4UIExecutive(argc, argv);
59  }
60 
61  // Construct the default run manager
62 #ifdef G4MULTITHREADED
63  G4MTRunManager* runManager = new G4MTRunManager;
64  G4int nThreads = std::min(G4Threading::G4GetNumberOfCores(),4);
65  if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
66  runManager->SetNumberOfThreads(nThreads);
67  G4cout << "===== slowing is started with "
68  << runManager->GetNumberOfThreads() << " threads =====" << G4endl;
69 #else
70  G4RunManager* runManager = new G4RunManager;
71 #endif
72 
73  // Set mandatory user initialization classes
74  runManager->SetUserInitialization(new DetectorConstruction);
75  runManager->SetUserInitialization(new PhysicsList);
76 
77  // User action initialization
78 
79  runManager->SetUserInitialization(new ActionInitialization());
80 
81  // Visualization
82  G4VisManager* visManager = new G4VisExecutive;
83  visManager->Initialize();
84 
85  // Get the pointer to the User Interface manager
86  G4UImanager* UI = G4UImanager::GetUIpointer();
87 
88  if (argc>1) // batch mode
89  {
90  G4String command = "/control/execute ";
91  G4String fileName = argv[1];
92  UI->ApplyCommand(command+fileName);
93  }
94 
95  else //define visualization and UI terminal for interactive mode
96  {
97  ui->SessionStart();
98  delete ui;
99  }
100 
101  // Job termination
102  delete visManager;
103  delete runManager;
104 }