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

Main program of the channeling example. More...

Include dependency graph for channeling.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the channeling example.

Definition in file channeling.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 67 of file channeling.cc.

68 {
69  // Construct the default run manager
70 #ifdef G4MULTITHREADED
71  G4MTRunManager* runManager = new G4MTRunManager;
72  if(argv[2]){
73  if(atoi(argv[2])>0){
74  runManager->SetNumberOfThreads(atoi(argv[2]));
75  }
76  }
77  G4cout << "MT MODE ON " << runManager->GetNumberOfThreads() << G4endl;
78 #else
79  G4RunManager* runManager = new G4RunManager;
80  G4cout << "MT MODE OFF" << G4endl;
81 #endif
82 
83  // Activate UI-command base scorer
85  scManager->SetVerboseLevel(0);
86 
87  // Choose the Random engine
88 #ifndef G4MULTITHREADED
90 #endif
91 
92  // Set mandatory initialization classes
93  G4VUserDetectorConstruction* detector =
95  runManager->SetUserInitialization(detector);
96  runManager->SetUserInitialization(new ExExChPhysicsList());
97 
98 #ifndef G4MULTITHREADED
99  // Set user action classes
100  runManager->SetUserAction(new ExExChPrimaryGeneratorAction());
101  runManager->SetUserAction(new ExExChEventAction());
102  runManager->SetUserAction(new ExExChStackingAction());
103  runManager->SetUserAction(new ExExChTrackingAction());
104  runManager->SetUserAction(new ExExChRunAction());
105 #else
106  runManager->SetUserInitialization(
107  new ExExChUserActionInitialization());
108 #endif
109 
110  // Get the pointer to the User Interface manager
112 
113  if(argc!=1) {
114  // Batch mode
115  G4String command = "/control/execute ";
116  G4String fileName = argv[1];
117  UI->ApplyCommand(command+fileName);
118  }
119 
120  else {
121  // Define visualization and UI terminal for interactive mode
122 #ifdef G4VIS_USE
123  G4VisManager* visManager = new G4VisExecutive;
124  visManager->Initialize();
125 #endif
126 
127 #ifdef G4UI_USE
128  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
129  ui->SessionStart();
130  delete ui;
131 #endif
132 
133 #ifdef G4VIS_USE
134  delete visManager;
135 #endif
136  }
137 
138  // Job termination
139  delete runManager;
140 
141  return 0;
142 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfThreads() const
void Initialize()
#define G4endl
Definition: G4ios.hh:61
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:270
static G4ScoringManager * GetScoringManager()
void SetVerboseLevel(G4int vl)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
virtual void SetUserAction(G4UserRunAction *userAction)

Here is the call graph for this function: