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

Main of the ThreadsafeScorers example. More...

#include "G4RunManager.hh"
#include "Randomize.hh"
#include "TSDetectorConstruction.hh"
#include "TSPhysicsList.hh"
#include "TSActionInitialization.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
Include dependency graph for ts_scorers.cc:

Go to the source code of this file.

Typedefs

typedef G4RunManager RunManager
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Main of the ThreadsafeScorers example.

Definition in file ts_scorers.cc.

Typedef Documentation

ts_scorers example shows how to use global scorers. The benefit of using global scorers in memory-savings for problems with very large amounts of scoring volumes. Additionally, the global scorers are more precise w.r.t. the serial solution because of the lack of compounding round-off error from multiple threads

In this example, the global scorers are implemented as static member variables in TSRun because TSRun is thread-local. The G4atomic class is the core of the thread-safe scorers and can be uses

Definition at line 54 of file ts_scorers.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 68 of file ts_scorers.cc.

69 {
70 
71  // Detect interactive mode (if no arguments) and define UI session
72  //
73  G4UIExecutive* ui = 0;
74  if(argc == 1)
75  ui = new G4UIExecutive(argc, argv);
76 
77  // Choose the Random engine
78  //G4Random::setTheEngine(new CLHEP::RanecuEngine);
79 
81 
82  RunManager* runmanager = new RunManager();
83 
85 
86  runmanager->SetUserInitialization(new TSPhysicsList);
87 
89 
90  runmanager->Initialize();
91 
92 
93  // Initialize visualization
94  //
95  G4VisManager* visManager = new G4VisExecutive;
96  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
97  // G4VisManager* visManager = new G4VisExecutive("Quiet");
98  visManager->Initialize();
99 
100  // Get the pointer to the User Interface manager
101  G4UImanager* UImanager = G4UImanager::GetUIpointer();
102 
103  // Process macro or start UI session
104  //
105  if (!ui)
106  {
107  // batch mode
108  G4String command = "/control/execute ";
109  G4String fileName = argv[1];
110  UImanager->ApplyCommand(command+fileName);
111  } else
112  {
113  // interactive mode
114  UImanager->ApplyCommand("/control/execute vis.mac");
115  ui->SessionStart();
116  delete ui;
117  }
118 
119  // Job termination
120  // Free the store: user actions, physics_list and detector_description are
121  // owned and deleted by the run manager, so they should not be deleted
122  // in the main() program !
123 
124  delete visManager;
125  delete runmanager;
126 
127  return 0;
128 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
G4RunManager RunManager
Definition: ts_scorers.cc:54
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:231
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: