Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hadr05.cc File Reference

Main program of the hadronic/Hadr05 example. More...

#include "G4RunManager.hh"
#include "G4MTRunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "G4PhysListFactory.hh"
#include "G4VModularPhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "ActionInitialization.hh"
#include "G4GenericPhysicsList.hh"
Include dependency graph for Hadr05.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the hadronic/Hadr05 example.

Definition in file Hadr05.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file Hadr05.cc.

57  {
58 
59  //choose the Random engine
60  G4Random::setTheEngine(new CLHEP::RanecuEngine());
61 
62 #ifdef G4MULTITHREADED
63  G4MTRunManager * runManager = new G4MTRunManager();
64 
65  // Number of threads can be defined via 3rd argument
66  if (argc==4) {
67  G4int nThreads = G4UIcommand::ConvertToInt(argv[3]);
68  runManager->SetNumberOfThreads(nThreads);
69  }
70  G4cout << "##### Hadr05 started for " << runManager->GetNumberOfThreads()
71  << " threads" << " #####" << G4endl;
72 #else
73  G4RunManager * runManager = new G4RunManager();
74  G4cout << "##### Hadr05 started in sequential mode"
75  << " #####" << G4endl;
76 #endif
77 
78  //set mandatory initialization classes
80 
81  G4VModularPhysicsList* phys = 0;
83 
84  // Physics List name defined via 3nd argument
85  if (argc>=3)
86  {
87  phys = new G4GenericPhysicsList();
88  G4String physListMacro = argv[2];
89  UImanager->ApplyCommand("/control/execute "+physListMacro);
90  }
91  else
92  {
93 
94  std::vector<G4String>* MyConstr = new std::vector<G4String>;
95 
96  MyConstr->push_back("G4EmStandardPhysics");
97  MyConstr->push_back("G4EmExtraPhysics");
98  MyConstr->push_back("G4DecayPhysics");
99  MyConstr->push_back("G4HadronElasticPhysics");
100  MyConstr->push_back("G4HadronPhysicsFTFP_BERT");
101  MyConstr->push_back("G4StoppingPhysics");
102  MyConstr->push_back("G4IonPhysics");
103  MyConstr->push_back("G4NeutronTrackingCut");
104 
105  phys = new G4GenericPhysicsList(MyConstr);
106  }
107 
108  runManager->SetUserInitialization(phys);
109 
110  //set user action classes
111  runManager->SetUserInitialization(new ActionInitialization());
112 
113 #ifdef G4VIS_USE
114  G4VisManager* visManager = 0;
115 #endif
116 
117  if (argc==1) // Define UI terminal for interactive mode
118  {
119 #ifdef G4VIS_USE
120  //visualization manager
121  visManager = new G4VisExecutive;
122  visManager->Initialize();
123 #endif
124 #ifdef G4UI_USE
125  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
126  ui->SessionStart();
127  delete ui;
128 #endif
129  }
130  else // Batch mode
131  {
132  G4String command = "/control/execute ";
133  G4String fileName = argv[1];
134  UImanager->ApplyCommand(command+fileName);
135  }
136 
137  //job termination
138 #ifdef G4VIS_USE
139  delete visManager;
140 #endif
141  delete runManager;
142 
143  return 0;
144 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfThreads() const
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:447
void Initialize()
TG4GenericPhysicsList< G4VModularPhysicsList > G4GenericPhysicsList
Detector construction class to define materials and geometry.
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: