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

Main program of the GB04 example. More...

Include dependency graph for exampleGB04.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the GB04 example.

Definition in file exampleGB04.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 69 of file exampleGB04.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 ************ "
101  << G4endl;
102  // -- Choose 4 threads:
103  runManager->SetNumberOfThreads(4);
104 #else
105  G4RunManager * runManager = new G4RunManager;
106  G4cout << " ********** Run Manager constructed in sequential mode ************ "
107  << G4endl;
108 #endif
109 
110 
111  // -- Set mandatory initialization classes
113  runManager->SetUserInitialization(detector);
114  // -- Select a physics list
115  FTFP_BERT* physicsList = new FTFP_BERT;
116  // -- And augment it with biasing facilities:
117  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
118  if ( onOffBiasing == "on" )
119  {
120  // -- Create list of physics processes to be biased: only brem. in this case:
121  std::vector< G4String > processToBias;
122  processToBias.push_back("eBrem");
123  // -- Pass the list to the G4GenericBiasingPhysics, which will wrap the eBrem
124  // -- process of e- and e+ to activate the biasing of it:
125  biasingPhysics->PhysicsBias("e-", processToBias);
126  biasingPhysics->PhysicsBias("e+", processToBias);
127  physicsList->RegisterPhysics(biasingPhysics);
128  G4cout << " ********************************************************* "
129  << G4endl;
130  G4cout << " ********** processes are wrapped for biasing ************ "
131  << G4endl;
132  G4cout << " ********************************************************* "
133  << G4endl;
134  }
135  else
136  {
137  G4cout << " ************************************************* " << G4endl;
138  G4cout << " ********** processes are not wrapped ************ " << G4endl;
139  G4cout << " ************************************************* " << G4endl;
140  }
141  runManager->SetUserInitialization(physicsList);
142  // -- Action initialization:
144 
145  // Initialize G4 kernel
146  runManager->Initialize();
147 
148 
149 #ifdef G4VIS_USE
150  // Initialize visualization
151  G4VisManager* visManager = new G4VisExecutive;
152  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
153  visManager->Initialize();
154 #endif
155 
156  // Get the pointer to the User Interface manager
157  G4UImanager* UImanager = G4UImanager::GetUIpointer();
158 
159  if ( macro != "" ) // batch mode
160  {
161  G4String command = "/control/execute ";
162  UImanager->ApplyCommand(command+macro);
163  }
164  else
165  { // interactive mode : define UI session
166 #ifdef G4UI_USE
167  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
168 #ifdef G4VIS_USE
169  // UImanager->ApplyCommand("/control/execute vis.mac");
170 #endif
171  // if (ui->IsGUI())
172  // UImanager->ApplyCommand("/control/execute gui.mac");
173  ui->SessionStart();
174  delete ui;
175 #endif
176  }
177 
178 #ifdef G4VIS_USE
179  delete visManager;
180 #endif
181  delete runManager;
182 
183 
184  return 0;
185 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
void PhysicsBias(const G4String &particleName)
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

Here is the call graph for this function: