60 #ifdef G4MULTITHREADED 61 #include "G4MTRunManager.hh" 63 #include "G4RunManager.hh" 66 #include "G4VPhysicalVolume.hh" 67 #include "G4UImanager.hh" 68 #include "G4SystemOfUnits.hh" 70 #include "B03DetectorConstruction.hh" 71 #include "B03PhysicsList.hh" 73 #include "B03ActionInitialization.hh" 78 #include "B03ImportanceDetectorConstruction.hh" 83 #include "G4IStore.hh" 89 G4int numberOfEvents = 100;
91 G4long myseed = 345354;
93 #ifdef G4MULTITHREADED 94 G4MTRunManager * runManager =
new G4MTRunManager;
95 G4cout <<
" Number of cores: " << G4Threading::G4GetNumberOfCores() << G4endl;
96 G4cout <<
" but using only two! " << G4endl;
97 runManager->SetNumberOfThreads(2);
100 G4RunManager * runManager =
new G4RunManager;
103 G4Random::setTheSeed(myseed);
106 B03DetectorConstruction *detector =
new B03DetectorConstruction();
107 runManager->SetUserInitialization(detector);
111 G4String parallelName(
"ParallelBiasingWorld");
112 B03ImportanceDetectorConstruction *pdet =
113 new B03ImportanceDetectorConstruction(parallelName);
114 detector->RegisterParallelWorld(pdet);
119 B03PhysicsList* physlist =
new B03PhysicsList(parallelName);
121 physlist->AddParallelWorldName(parallelName);
126 runManager->SetUserInitialization(physlist);
130 B03ActionInitialization* actions =
new B03ActionInitialization;
131 runManager->SetUserInitialization(actions);
137 runManager->Initialize();
139 G4VPhysicalVolume& aghostWorld = pdet->GetWorldVolumeAddress();
140 G4cout <<
" ghost world: " << pdet->GetName() << G4endl;
143 G4IStore *aIstore = G4IStore::GetInstance(pdet->GetName());
146 G4GeometryCell gWorldVolumeCell(aghostWorld, 0);
148 aIstore->AddImportanceGeometryCell(1, gWorldVolumeCell);
152 for (cell=1; cell<=18; cell++) {
153 G4GeometryCell gCell = pdet->GetGeometryCell(cell);
154 G4cout <<
" adding cell: " << cell
155 <<
" replica: " << gCell.GetReplicaNumber()
156 <<
" name: " << gCell.GetPhysicalVolume().GetName() << G4endl;
157 G4double imp = std::pow(2.0,cell-1);
159 aIstore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), cell);
167 G4GeometryCell gCell = pdet->GetGeometryCell(19);
169 G4double imp = std::pow(2.0,17);
170 aIstore->AddImportanceGeometryCell(imp, gCell.GetPhysicalVolume(), 19);
173 G4UImanager* UImanager = G4UImanager::GetUIpointer();
174 G4String command1 =
"/control/cout/setCoutFile fileName";
175 UImanager->ApplyCommand(command1);
178 + G4UIcommand::ConvertToString(numberOfEvents);;
179 UImanager->ApplyCommand(command2);