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/B01/exampleB01.cc 27 /// \brief Main program of the biasing/B01 exa 28 // 29 // 30 // 31 // 32 // ------------------------------------------- 33 // GEANT 4 - exampleB01 34 // 35 // ------------------------------------------- 36 // Comments 37 // 38 // This example intends to show how to use imp 39 // in the mass (tracking) geometry. 40 // A simple geometry consisting of a 180 cm hi 41 // divided into 18 slabs of 10cm each is creat 42 // Importance values are assigned to the 18 co 43 // detector construction class for simplicity. 44 // Pairs of G4GeometryCell and importance valu 45 // the importance store. 46 // Scoring is carried out by the multifunction 47 // sensitive detectors 48 // 49 // Alex Howard (alexander.howard@cern.ch): 50 // 22/11/13: Migrated to the new MT compliant 51 // biasing process to the physicslis 52 // via the modular physicslists 53 // 54 55 // ------------------------------------------- 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 58 #include "G4GeometryManager.hh" 59 #include "G4RunManagerFactory.hh" 60 #include "G4Types.hh" 61 #include "G4UImanager.hh" 62 #include "G4VPhysicalVolume.hh" 63 64 #include <iostream> 65 #include <stdlib.h> 66 67 // user classes 68 #include "B01ActionInitialization.hh" 69 #include "B01DetectorConstruction.hh" 70 #include "FTFP_BERT.hh" 71 72 #include "G4ImportanceBiasing.hh" 73 #include "G4WeightWindowBiasing.hh" 74 // #include "B01PrimaryGeneratorAction.hh" 75 // #include "B01RunAction.hh" 76 77 // Files specific for biasing and scoring 78 #include "G4GeometrySampler.hh" 79 #include "G4IStore.hh" 80 #include "G4VWeightWindowStore.hh" 81 #include "G4WeightWindowAlgorithm.hh" 82 83 //....oooOO0OOooo........oooOO0OOooo........oo 84 85 int main(int argc, char** argv) 86 { 87 G4int mode = 0; 88 if (argc > 1) mode = atoi(argv[1]); 89 90 G4int numberOfEvents = 100; 91 G4long myseed = 345354; 92 93 auto* runManager = G4RunManagerFactory::Crea 94 runManager->SetNumberOfThreads(2); 95 96 G4Random::setTheSeed(myseed); 97 98 G4VWeightWindowAlgorithm* wwAlg = 0; // poi 99 100 // create the detector ---------------- 101 B01DetectorConstruction* detector = new B01D 102 runManager->SetUserInitialization(detector); 103 G4GeometrySampler mgs(detector->GetWorldVolu 104 105 G4VModularPhysicsList* physicsList = new FTF 106 if (mode == 0) { 107 physicsList->RegisterPhysics(new G4Importa 108 } 109 else { 110 wwAlg = new G4WeightWindowAlgorithm(1, // 111 1, // 112 100); 113 114 physicsList->RegisterPhysics(new G4WeightW 115 // place of action 116 } 117 runManager->SetUserInitialization(physicsLis 118 119 // Set user action classes through Worker In 120 // 121 B01ActionInitialization* actions = new B01Ac 122 runManager->SetUserInitialization(actions); 123 124 runManager->Initialize(); 125 126 if (mode == 0) { 127 detector->CreateImportanceStore(); 128 } 129 else { 130 detector->CreateWeightWindowStore(); 131 } 132 133 // runManager->BeamOn(numberOfEvents); 134 135 // temporary fix before runManager->BeamOn w 136 G4UImanager* UImanager = G4UImanager::GetUIp 137 G4String command1 = "/control/cout/setCoutFi 138 UImanager->ApplyCommand(command1); 139 G4String command2 = "/run/beamOn " + G4UIcom 140 ; 141 UImanager->ApplyCommand(command2); 142 143 // open geometry for clean biasing stores cl 144 // 145 G4GeometryManager::GetInstance()->OpenGeomet 146 147 if (wwAlg) { 148 delete wwAlg; 149 } 150 151 // mgs.ClearSampling(); 152 153 delete runManager; 154 155 return 0; 156 } 157 158 //....oooOO0OOooo........oooOO0OOooo........oo 159