Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file biasing/B03/exampleB03.cc 27 /// \brief Main program of the biasing/B03 exa 28 // 29 // 30 // 31 // 32 // ------------------------------------------- 33 // GEANT 4 - exampleB03 34 // 35 // ------------------------------------------- 36 // Comments 37 // 38 // This example intends to show how to use bot 39 // customized scoring making use of the scorin 40 // in a parallel geometry. 41 // 42 // A simple geometry consisting of a 180 cm hi 43 // is constructed in the mass geometry. 44 // A geometry is constructed in the parallel g 45 // in order to assign importance values to sla 46 // of width 10cm and for scoring. The parallel 47 // overlap the mass world volume and the radi 48 // than the radius of the concrete cylinder in 49 // Pairs of G4GeometryCell and importance valu 50 // the importance store. 51 // The scoring uses the primitive scorers via 52 // 53 // 54 //....oooOO0OOooo........oooOO0OOooo........oo 55 56 #include "B03ActionInitialization.hh" 57 #include "B03DetectorConstruction.hh" 58 #include "B03PhysicsList.hh" 59 60 #include "G4RunManagerFactory.hh" 61 #include "G4SystemOfUnits.hh" 62 #include "G4Types.hh" 63 #include "G4UImanager.hh" 64 #include "G4VPhysicalVolume.hh" 65 66 #include <iostream> 67 // #include "B03PrimaryGeneratorAction.hh" 68 // #include "B03RunAction.hh" 69 70 // construction for the parallel geometry 71 #include "B03ImportanceDetectorConstruction.hh 72 73 // Files specific for biasing and scoring 74 // #include "G4Scorer.hh" 75 // #include "G4GeometrySampler.hh" 76 #include "G4IStore.hh" 77 78 //....oooOO0OOooo........oooOO0OOooo........oo 79 80 int main(int, char**) 81 { 82 G4int numberOfEvents = 100; 83 84 G4long myseed = 345354; 85 86 auto* runManager = G4RunManagerFactory::Crea 87 runManager->SetNumberOfThreads(2); 88 89 G4Random::setTheSeed(myseed); 90 91 // create the detector ---------------- 92 B03DetectorConstruction* detector = new B03D 93 runManager->SetUserInitialization(detector); 94 // ---------------------------------------- 95 96 // create a parallel detector 97 G4String parallelName("ParallelBiasingWorld" 98 B03ImportanceDetectorConstruction* pdet = ne 99 detector->RegisterParallelWorld(pdet); 100 101 // G4GeometrySampler pgs(pdet->GetWorldVolum 102 // B03PhysicsList* physlist = new B03Physics 103 // name of first parallel world: 104 B03PhysicsList* physlist = new B03PhysicsLis 105 // push parallel world to store in case of m 106 physlist->AddParallelWorldName(parallelName) 107 // physlist->AddParallelWorldName(parallelNa 108 // physlist->AddParallelWorldName(sparallelN 109 // physlist->AddBiasing(&pgs,parallelName); 110 111 runManager->SetUserInitialization(physlist); 112 113 // Set user action classes through Worker In 114 // 115 B03ActionInitialization* actions = new B03Ac 116 runManager->SetUserInitialization(actions); 117 118 // runManager->SetUserAction(new B03Primar 119 // // runManager->SetUserAction(new B03Pr 120 // runManager->SetUserAction(new B03RunAct 121 122 runManager->Initialize(); 123 124 G4VPhysicalVolume& aghostWorld = pdet->GetWo 125 G4cout << " ghost world: " << pdet->GetName( 126 127 // create an importance 128 G4IStore* aIstore = G4IStore::GetInstance(pd 129 130 // create a geometry cell for the world volu 131 G4GeometryCell gWorldVolumeCell(aghostWorld, 132 // set world volume importance to 1 133 aIstore->AddImportanceGeometryCell(1, gWorld 134 135 // set importance values and create scorers 136 G4int cell(1); 137 for (cell = 1; cell <= 18; cell++) { 138 G4GeometryCell gCell = pdet->GetGeometryCe 139 G4cout << " adding cell: " << cell << " re 140 << " name: " << gCell.GetPhysicalVo 141 G4double imp = std::pow(2.0, cell - 1); 142 // x aIstore.AddImportanceGeometryCell( 143 aIstore->AddImportanceGeometryCell(imp, gC 144 } 145 146 // creating the geometry cell and add both t 147 // G4GeometryCell gCell = pdet->GetGeometry 148 149 // create importance geometry cell pair for 150 // with the same importance as the last conc 151 G4GeometryCell gCell = pdet->GetGeometryCell 152 // G4double imp = std::pow(2.0,18); 153 G4double imp = std::pow(2.0, 17); 154 aIstore->AddImportanceGeometryCell(imp, gCel 155 156 // temporary fix before runManager->BeamOn w 157 G4UImanager* UImanager = G4UImanager::GetUIp 158 G4String command1 = "/control/cout/setCoutFi 159 UImanager->ApplyCommand(command1); 160 161 G4String command2 = "/run/beamOn " + G4UIcom 162 ; 163 UImanager->ApplyCommand(command2); 164 165 // runManager->BeamOn(numberOfEvents); 166 167 // pgs.ClearSampling(); 168 169 delete runManager; 170 171 return 0; 172 } 173 174 //....oooOO0OOooo........oooOO0OOooo........oo 175