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

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

#include <iostream>
#include <stdlib.h>
#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "G4VPhysicalVolume.hh"
#include "G4UImanager.hh"
#include "G4GeometryManager.hh"
#include "B01DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ImportanceBiasing.hh"
#include "G4WeightWindowBiasing.hh"
#include "B01ActionInitialization.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/B01 example.

Definition in file exampleB01.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 88 of file exampleB01.cc.

89{
90 G4int mode = 0;
91 if (argc>1) mode = atoi(argv[1]);
92
93 G4int numberOfEvents = 100;
94 G4long myseed = 345354;
95
96 auto* runManager = G4RunManagerFactory::CreateRunManager();
97 runManager->SetNumberOfThreads(2);
98
99 G4Random::setTheSeed(myseed);
100
101 G4VWeightWindowAlgorithm *wwAlg = 0; // pointer for WeightWindow (mode>0)
102
103 // create the detector ---------------------------
105 runManager->SetUserInitialization(detector);
106 G4GeometrySampler mgs(detector->GetWorldVolume(),"neutron");
107
108 G4VModularPhysicsList* physicsList = new FTFP_BERT;
109 if(mode == 0)
110 {
111 physicsList->RegisterPhysics(new G4ImportanceBiasing(&mgs));
112 }
113 else
114 {
115 wwAlg = new G4WeightWindowAlgorithm(1, // upper limit factor
116 1, // survival factor
117 100); // max. number of splitting
118
119 physicsList->RegisterPhysics(new G4WeightWindowBiasing
120 (&mgs, wwAlg, onBoundary));
121 // place of action
122 }
123 runManager->SetUserInitialization(physicsList);
124
125 // Set user action classes through Worker Initialization
126 //
128 runManager->SetUserInitialization(actions);
129
130 runManager->Initialize();
131
132 if (mode == 0)
133 {
134 detector->CreateImportanceStore();
135 }
136 else
137 {
138 detector->CreateWeightWindowStore();
139 }
140
141 // runManager->BeamOn(numberOfEvents);
142
143 //temporary fix before runManager->BeamOn works...
144 G4UImanager* UImanager = G4UImanager::GetUIpointer();
145 G4String command1 = "/control/cout/setCoutFile threadOut";
146 UImanager->ApplyCommand(command1);
147 G4String command2 = "/run/beamOn " +
148 G4UIcommand::ConvertToString(numberOfEvents);;
149 UImanager->ApplyCommand(command2);
150
151 // open geometry for clean biasing stores clean-up
152 //
153 G4GeometryManager::GetInstance()->OpenGeometry();
154
155 if (wwAlg) {
156 delete wwAlg;
157 }
158
159 // mgs.ClearSampling();
160
161 delete runManager;
162
163 return 0;
164}
G4VPhysicalVolume * GetWorldVolume()
G4VWeightWindowStore * CreateWeightWindowStore()

Applications | User Support | Publications | Collaboration