Loading...
Searching...
No Matches
Functions
exampleB02.cc File Reference

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

#include <iostream>
#include <stdlib.h>
#include "G4Types.hh"
#include "G4RunManagerFactory.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"

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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 81 of file exampleB02.cc.

82{
83 G4int mode = 0;
84 if (argc>1) mode = atoi(argv[1]);
85 if(mode != 0) {
86 G4cout << " mode not used yet, refer to B01 to see WeightWindow technique "
87 << mode << G4endl;
88 }
89
90 G4int numberOfEvents = 100;
91 G4long myseed = 345354;
92
93 auto* runManager = G4RunManagerFactory::CreateRunManager();
94 runManager->SetNumberOfThreads(2);
95
96 G4Random::setTheSeed(myseed);
97
98 // create the detector ---------------------------
100 runManager->SetUserInitialization(detector);
101
102 G4String parallelName("ParallelBiasingWorld");
104 new B02ImportanceDetectorConstruction(parallelName);
105 detector->RegisterParallelWorld(pdet);
106
107 G4GeometrySampler pgs(pdet->GetWorldVolume(),"neutron");
108
109 pgs.SetParallel(true);
110
111 G4VModularPhysicsList* physicsList = new FTFP_BERT;
112 physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs,parallelName));
113 physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName));
114
115 runManager->SetUserInitialization(physicsList);
116
117 // Set user action classes through Worker Initialization
118 //
120 runManager->SetUserInitialization(actions);
121
122 runManager->Initialize();
123
124 pdet->CreateImportanceStore();
125
126 //temporary fix before runManager->BeamOn works...
127 G4UImanager* UImanager = G4UImanager::GetUIpointer();
128 G4String command1 = "/control/cout/setCoutFile threadOut";
129 UImanager->ApplyCommand(command1);
130 G4String command2 = "/run/beamOn " +
131 G4UIcommand::ConvertToString(numberOfEvents);
132 UImanager->ApplyCommand(command2);
133
134 // open geometry for clean biasing stores clean-up
135 //
136 G4GeometryManager::GetInstance()->OpenGeometry();
137
138 // pgs.ClearSampling();
139
140 delete runManager;
141
142 return 0;
143}

Applications | User Support | Publications | Collaboration