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

Main program of the GB02 example. More...

Include dependency graph for exampleGB02.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the GB02 example.

Definition in file exampleGB02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 69 of file exampleGB02.cc.

70 {
71  // Evaluate arguments
72  //
73  if ( argc > 5 ) {
74  PrintUsage();
75  return 1;
76  }
77 
78  G4String macro("");
79  G4String onOffBiasing("");
80  if ( argc == 2 ) macro = argv[1];
81  else
82  {
83  for ( G4int i=1; i<argc; i=i+2 )
84  {
85  if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
86  else if ( G4String(argv[i]) == "-b" ) onOffBiasing = argv[i+1];
87  else
88  {
89  PrintUsage();
90  return 1;
91  }
92  }
93  }
94 
95  if ( onOffBiasing == "" ) onOffBiasing = "on";
96 
97  // -- Construct the run manager : MT or sequential one
98 #ifdef G4MULTITHREADED
99  G4MTRunManager * runManager = new G4MTRunManager;
100  G4cout << " ********** Run Manager constructed in MT mode ************ " << G4endl;
101  // -- Choose 4 threads:
102  runManager->SetNumberOfThreads(4);
103 #else
104  G4RunManager * runManager = new G4RunManager;
105  G4cout << " ********** Run Manager constructed in sequential mode ************ " << G4endl;
106 #endif
107 
108  // -- Set mandatory initialization classes
110  runManager->SetUserInitialization(detector);
111  // -- Select a physics list
112  FTFP_BERT* physicsList = new FTFP_BERT;
113  // -- And augment it with biasing facilities:
114  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
115  if ( onOffBiasing == "on" )
116  {
117  biasingPhysics->Bias("gamma");
118  biasingPhysics->Bias("neutron");
119  physicsList->RegisterPhysics(biasingPhysics);
120  G4cout << " ********************************************************* " << G4endl;
121  G4cout << " ********** processes are wrapped for biasing ************ " << G4endl;
122  G4cout << " ********************************************************* " << G4endl;
123  }
124  else
125  {
126  G4cout << " ************************************************* " << G4endl;
127  G4cout << " ********** processes are not wrapped ************ " << G4endl;
128  G4cout << " ************************************************* " << G4endl;
129  }
130  runManager->SetUserInitialization(physicsList);
131  // -- Action initialization:
133 
134  // Initialize G4 kernel
135  runManager->Initialize();
136 
137 
138 #ifdef G4VIS_USE
139  // Initialize visualization
140  G4VisManager* visManager = new G4VisExecutive;
141  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
142  visManager->Initialize();
143 #endif
144 
145  // Get the pointer to the User Interface manager
146  G4UImanager* UImanager = G4UImanager::GetUIpointer();
147 
148  if ( macro != "" ) // batch mode
149  {
150  G4String command = "/control/execute ";
151  UImanager->ApplyCommand(command+macro);
152  }
153  else
154  { // interactive mode : define UI session
155 #ifdef G4UI_USE
156  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
157 #ifdef G4VIS_USE
158  // UImanager->ApplyCommand("/control/execute vis.mac");
159 #endif
160  // if (ui->IsGUI())
161  // UImanager->ApplyCommand("/control/execute gui.mac");
162  ui->SessionStart();
163  delete ui;
164 #endif
165  }
166 
167 #ifdef G4VIS_USE
168  delete visManager;
169 #endif
170  delete runManager;
171 
172 
173  return 0;
174 }
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
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
void Bias(const G4String &particleName)

Here is the call graph for this function: