59 #ifdef G4MULTITHREADED 60 #include "G4MTRunManager.hh" 62 #include "G4RunManager.hh" 65 #include "G4VPhysicalVolume.hh" 66 #include "G4UImanager.hh" 67 #include "G4SystemOfUnits.hh" 69 #include "B03DetectorConstruction.hh" 70 #include "B03PhysicsList.hh" 72 #include "B03ActionInitialization.hh" 77 #include "B03ImportanceDetectorConstruction.hh" 81 #include "G4GeometrySampler.hh" 82 #include "G4IStore.hh" 88 G4int numberOfEvents = 100;
90 G4long myseed = 345354;
92 #ifdef G4MULTITHREADED 93 G4MTRunManager * runManager =
new G4MTRunManager;
94 G4cout <<
" Number of cores: " << G4Threading::G4GetNumberOfCores() << G4endl;
95 G4cout <<
" but using only two! " << G4endl;
96 runManager->SetNumberOfThreads(2);
99 G4RunManager * runManager =
new G4RunManager;
102 G4Random::setTheSeed(myseed);
105 B03DetectorConstruction *detector =
new B03DetectorConstruction();
106 runManager->SetUserInitialization(detector);
110 G4String parallelName(
"ParallelBiasingWorld");
111 B03ImportanceDetectorConstruction *pdet =
112 new B03ImportanceDetectorConstruction(parallelName);
113 detector->RegisterParallelWorld(pdet);
115 G4GeometrySampler pgs(pdet->GetWorldVolume(),
"neutron");
116 B03PhysicsList* physlist =
new B03PhysicsList;
117 physlist->AddParallelWorldName(parallelName);
119 physlist->AddBiasing(&pgs,parallelName);
121 runManager->SetUserInitialization(physlist);
125 B03ActionInitialization* actions =
new B03ActionInitialization;
126 runManager->SetUserInitialization(actions);
132 runManager->Initialize();
134 G4VPhysicalVolume& aghostWorld = pdet->GetWorldVolumeAddress();
135 G4cout <<
" ghost world: " << pdet->GetName() << G4endl;
138 G4IStore *aIstore = G4IStore::GetInstance(pdet->GetName());
141 G4GeometryCell gWorldVolumeCell(aghostWorld, 0);
143 aIstore->AddImportanceGeometryCell(1, gWorldVolumeCell);
147 for (cell=1; cell<=18; cell++) {
148 G4GeometryCell gCell = pdet->GetGeometryCell(cell);
149 G4cout <<
" adding cell: " << cell
150 <<
" replica: " << gCell.GetReplicaNumber()
151 <<
" name: " << gCell.GetPhysicalVolume().GetName() << G4endl;
152 G4double imp = std::pow(2.0,cell-1);
154 aIstore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), cell);
162 G4GeometryCell gCell = pdet->GetGeometryCell(19);
164 G4double imp = std::pow(2.0,17);
165 aIstore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), 19);
168 G4UImanager* UImanager = G4UImanager::GetUIpointer();
169 G4String command1 =
"/control/cout/setCoutFile fileName";
170 UImanager->ApplyCommand(command1);
173 + G4UIcommand::ConvertToString(numberOfEvents);;
174 UImanager->ApplyCommand(command2);