LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
channeling.cc File Reference

Main program of the channeling example. More...

#include "G4RunManager.hh"
#include "G4ScoringManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "ExExChDetectorConstruction.hh"
#include "ExExChPrimaryGeneratorAction.hh"
#include "ExExChTrackingAction.hh"
#include "ExExChStackingAction.hh"
#include "ExExChEventAction.hh"
#include "ExExChRunAction.hh"
#include "ExExChPhysicsList.hh"
#include "QGSP_BERT.hh"

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
84  G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
85  scManager->SetVerboseLevel(0);
86 
87  // Choose the Random engine
88 #ifndef G4MULTITHREADED
89  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
90 #endif
91 
92  // Set mandatory initialization classes
93  G4VUserDetectorConstruction* detector =
94  new ExExChDetectorConstruction;
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
111  G4UImanager* UI = G4UImanager::GetUIpointer();
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 }