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

Main program of the biasing/B02 example. More...

#include <iostream>
#include <stdlib.h>
#include "G4RunManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4UImanager.hh"
#include "G4GeometryManager.hh"
#include "B02DetectorConstruction.hh"
#include "B02ImportanceDetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ImportanceBiasing.hh"
#include "G4ParallelWorldPhysics.hh"
#include "B02ActionInitialization.hh"
#include "G4GeometrySampler.hh"
#include "G4IStore.hh"
#include "G4VWeightWindowStore.hh"
#include "G4WeightWindowAlgorithm.hh"
Include dependency graph for exampleB02.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the biasing/B02 example.

Definition in file exampleB02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 84 of file exampleB02.cc.

85 {
86  G4int mode = 0;
87  if (argc>1) mode = atoi(argv[1]);
88  if(mode != 0) {
89  G4cout << " mode not used yet, refer to B01 to see WeightWindow technique "
90  << mode << G4endl;
91  }
92 
93  G4int numberOfEvents = 100;
94  G4long myseed = 345354;
95 
96 #ifdef G4MULTITHREADED
97  G4MTRunManager * runManager = new G4MTRunManager;
98  G4cout << " Number of cores: " << G4Threading::G4GetNumberOfCores() << G4endl;
99  G4cout << " but using two! " << G4endl;
100  runManager->SetNumberOfThreads(2);
101  // runManager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores());
102 #else
103  G4RunManager * runManager = new G4RunManager;
104 #endif
105 
106  G4Random::setTheSeed(myseed);
107 
108  // create the detector ---------------------------
110  runManager->SetUserInitialization(detector);
111 
112  G4String parallelName("ParallelBiasingWorld");
114  new B02ImportanceDetectorConstruction(parallelName);
115  detector->RegisterParallelWorld(pdet);
116 
117  G4GeometrySampler pgs(pdet->GetWorldVolume(),"neutron");
118 
119  pgs.SetParallel(true);
120 
121  G4VModularPhysicsList* physicsList = new FTFP_BERT;
122  physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs,parallelName));
123  physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName));
124 
125  runManager->SetUserInitialization(physicsList);
126 
127  // Set user action classes through Worker Initialization
128  //
130  runManager->SetUserInitialization(actions);
131 
132  runManager->Initialize();
133 
134  pdet->CreateImportanceStore();
135 
136  //temporary fix before runManager->BeamOn works...
137  G4UImanager* UImanager = G4UImanager::GetUIpointer();
138  G4String command1 = "/control/cout/setCoutFile threadOut";
139  UImanager->ApplyCommand(command1);
140  G4String command2 = "/run/beamOn " +
141  G4UIcommand::ConvertToString(numberOfEvents);
142  UImanager->ApplyCommand(command2);
143 
144  // open geometry for clean biasing stores clean-up
145  //
147 
148  // pgs.ClearSampling();
149 
150  delete runManager;
151 
152  return 0;
153 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
void SetNumberOfThreads(G4int n)
long G4long
Definition: G4Types.hh:80
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
void SetParallel(G4bool paraflag)
int G4int
Definition: G4Types.hh:78
void RegisterParallelWorld(G4VUserParallelWorld *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
G4int G4GetNumberOfCores()
Definition: G4Threading.cc:143
static G4GeometryManager * GetInstance()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
void OpenGeometry(G4VPhysicalVolume *vol=0)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: