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

Main program of the GB06 example. More...

Include dependency graph for exampleGB06.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the GB06 example.

Definition in file exampleGB06.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 72 of file exampleGB06.cc.

73 {
74  // Evaluate arguments
75  //
76  if ( argc > 5 ) {
77  PrintUsage();
78  return 1;
79  }
80 
81  G4String macro("");
82  G4String onOffBiasing("");
83  if ( argc == 2 ) macro = argv[1];
84  else
85  {
86  for ( G4int i=1; i<argc; i=i+2 )
87  {
88  if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
89  else if ( G4String(argv[i]) == "-b" ) onOffBiasing = argv[i+1];
90  else
91  {
92  PrintUsage();
93  return 1;
94  }
95  }
96  }
97 
98  if ( onOffBiasing == "" ) onOffBiasing = "on";
99 
100  // -- Construct the run manager : MT or sequential one
101 #ifdef G4MULTITHREADED
102  G4MTRunManager * runManager = new G4MTRunManager;
103  G4cout << " ********** Run Manager constructed in MT mode ************ "
104  << G4endl;
105  // -- Choose 4 threads:
106  runManager->SetNumberOfThreads(4);
107 #else
108  G4RunManager * runManager = new G4RunManager;
109  G4cout << " ********** Run Manager constructed in sequential mode ************ "
110  << G4endl;
111 #endif
112 
113 
114  // -- Set mandatory initialization classes
115 
116  // -- Create geometry:
118  // -- Create parallel world:
119  GB06ParallelWorldForSlices* parallelWorld =
120  new GB06ParallelWorldForSlices("parallelWorldForSlices");
121  // -- and "augment" detector geometry with the parallelWorld one:
122  detector->RegisterParallelWorld( parallelWorld );
123  runManager->SetUserInitialization(detector);
124 
125  // -- Select a physics list:
126  FTFP_BERT* physicsList = new FTFP_BERT;
127  // -- and augment it with biasing facilities:
128  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
129  biasingPhysics->BeVerbose();
130  if ( onOffBiasing == "on" )
131  {
132  // -- We use only the "non physics biasing" functionnality (ie, the ones which don't
133  // -- alter physics processes behavior), and hence we equipe the physics list
134  // -- accordingly:
135  biasingPhysics->NonPhysicsBias("neutron");
136  // -- we activate and configure the parallel geometry facility:
137  biasingPhysics->AddParallelGeometry("neutron","parallelWorldForSlices");
138  physicsList->RegisterPhysics(biasingPhysics);
139  G4cout << " ********************************************************* "
140  << G4endl;
141  G4cout << " ********** processes are wrapped for biasing ************ "
142  << G4endl;
143  G4cout << " ********************************************************* "
144  << G4endl;
145  }
146  else
147  {
148  G4cout << " ************************************************* " << G4endl;
149  G4cout << " ********** processes are not wrapped ************ " << G4endl;
150  G4cout << " ************************************************* " << G4endl;
151  }
152  runManager->SetUserInitialization(physicsList);
153 
154  // -- Action initialization:
156 
157  // Initialize G4 kernel
158  runManager->Initialize();
159 
160 
161 #ifdef G4VIS_USE
162  // Initialize visualization
163  G4VisManager* visManager = new G4VisExecutive;
164  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
165  visManager->Initialize();
166 #endif
167 
168  // Get the pointer to the User Interface manager
169  G4UImanager* UImanager = G4UImanager::GetUIpointer();
170 
171  if ( macro != "" ) // batch mode
172  {
173  G4String command = "/control/execute ";
174  UImanager->ApplyCommand(command+macro);
175  }
176  else
177  { // interactive mode : define UI session
178 #ifdef G4UI_USE
179  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
180 #ifdef G4VIS_USE
181  UImanager->ApplyCommand("/control/execute vis.mac");
182 #endif
183  // if (ui->IsGUI())
184  // UImanager->ApplyCommand("/control/execute gui.mac");
185  ui->SessionStart();
186  delete ui;
187 #endif
188  }
189 
190 
191 #ifdef G4VIS_USE
192  delete visManager;
193 #endif
194  delete runManager;
195 
196 
197  return 0;
198 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
void AddParallelGeometry(const G4String &particleName, const G4String &parallelGeometryName)
int G4int
Definition: G4Types.hh:78
void RegisterParallelWorld(G4VUserParallelWorld *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
void NonPhysicsBias(const G4String &particleName)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: