File indexing completed on 2026-09-13 08:28:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 #include "G4GeometryManager.hh"
0048 #include "G4RunManagerFactory.hh"
0049 #include "G4Types.hh"
0050 #include "G4UImanager.hh"
0051 #include "G4VPhysicalVolume.hh"
0052
0053 #include <iostream>
0054 #include <stdlib.h>
0055
0056
0057 #include "B02ActionInitialization.hh"
0058 #include "B02DetectorConstruction.hh"
0059 #include "B02ImportanceDetectorConstruction.hh"
0060 #include "FTFP_BERT.hh"
0061
0062 #include "G4ImportanceBiasing.hh"
0063 #include "G4ParallelWorldPhysics.hh"
0064
0065
0066
0067
0068 #include "G4GeometrySampler.hh"
0069 #include "G4IStore.hh"
0070 #include "G4VWeightWindowStore.hh"
0071 #include "G4WeightWindowAlgorithm.hh"
0072
0073
0074
0075 int main(int argc, char** argv)
0076 {
0077 G4int mode = 0;
0078 if (argc > 1) mode = atoi(argv[1]);
0079 if (mode != 0) {
0080 G4cout << " mode not used yet, refer to B01 to see WeightWindow technique " << mode << G4endl;
0081 }
0082
0083 G4int numberOfEvents = 100;
0084 G4long myseed = 345354;
0085
0086 auto* runManager = G4RunManagerFactory::CreateRunManager();
0087 runManager->SetNumberOfThreads(2);
0088
0089 G4Random::setTheSeed(myseed);
0090
0091
0092 B02DetectorConstruction* detector = new B02DetectorConstruction();
0093 runManager->SetUserInitialization(detector);
0094
0095 G4String parallelName("ParallelBiasingWorld");
0096 B02ImportanceDetectorConstruction* pdet = new B02ImportanceDetectorConstruction(parallelName);
0097 detector->RegisterParallelWorld(pdet);
0098
0099 G4GeometrySampler pgs(pdet->GetWorldVolume(), "neutron");
0100
0101 pgs.SetParallel(true);
0102
0103 G4VModularPhysicsList* physicsList = new FTFP_BERT;
0104 physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs, parallelName));
0105 physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName));
0106
0107 runManager->SetUserInitialization(physicsList);
0108
0109
0110
0111 B02ActionInitialization* actions = new B02ActionInitialization;
0112 runManager->SetUserInitialization(actions);
0113
0114 runManager->Initialize();
0115
0116 pdet->CreateImportanceStore();
0117
0118
0119 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0120 G4String command1 = "/control/cout/setCoutFile threadOut";
0121 UImanager->ApplyCommand(command1);
0122 G4String command2 = "/run/beamOn " + G4UIcommand::ConvertToString(numberOfEvents);
0123 UImanager->ApplyCommand(command2);
0124
0125
0126
0127 G4GeometryManager::GetInstance()->OpenGeometry();
0128
0129
0130
0131 delete runManager;
0132
0133 return 0;
0134 }
0135
0136