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

icsd example More...

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.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

icsd example

Definition in file icsd.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file icsd.cc.

60 {
61  G4String macroName ("");
62 
63  // Detect if the user gave an argument (or not)
64  if(argc == 1) // Only the name of the program was used (no argument)
65  {
66  // We set the name of the macro to be used by default
67  macroName = "icsd.mac";
68  }
69  else if(argc == 2) // One argument was supplied
70  {
71  // The first argument is the name if the macro file to be used
72  macroName = argv[1];
73  }
74  else // More than one argument was supplied
75  {
76  G4Exception("main", "WRONG ARGUMENT NUMBER", FatalException,
77  "To many argument were provided.");
78  return 0;
79  }
80 
81  // Construct the default run manager
82 
83 #ifdef G4MULTITHREADED
84  G4MTRunManager* runManager = new G4MTRunManager;
85  runManager->SetNumberOfThreads(2); // Is equal to 2 by default
86 #else
87  G4RunManager* runManager = new G4RunManager;
88 #endif
89 
90  // Set mandatory user initialization classes
92  runManager->SetUserInitialization(detector);
93  runManager->SetUserInitialization(new PhysicsList);
94 
95  // User action initialization
96  runManager->SetUserInitialization(new ActionInitialization());
97 
98  // Initialize G4 kernel
99  runManager->Initialize();
100 
101  // Get the pointer to the User Interface manager
102  G4UImanager* UImanager = G4UImanager::GetUIpointer();
103  G4String command = "/control/execute ";
104  UImanager->ApplyCommand(command+macroName);
105 
106  delete runManager;
107 
108  return 0;
109 }