![]() |
|
|||
File indexing completed on 2025-02-23 09:20:44
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file biasing/B02/exampleB02.cc 0027 /// \brief Main program of the biasing/B02 example 0028 // 0029 // 0030 // 0031 // 0032 // -------------------------------------------------------------- 0033 // GEANT 4 - exampleB02 0034 // 0035 // -------------------------------------------------------------- 0036 // Comments 0037 // 0038 // This example intends to show how to use importance sampling and scoring 0039 // in the mass (tracking) geometry. 0040 // A simple geometry consisting of a 180 cm high concrete cylinder 0041 // divided into 18 slabs of 10cm each is created. 0042 // Importance values are assigned to the 18 concrete slabs in the 0043 // detector construction class for simplicity. 0044 // Pairs of G4GeometryCell and importance values are stored in 0045 // the importance store. 0046 // 0047 0048 // -------------------------------------------------------------- 0049 0050 #include "G4GeometryManager.hh" 0051 #include "G4RunManagerFactory.hh" 0052 #include "G4Types.hh" 0053 #include "G4UImanager.hh" 0054 #include "G4VPhysicalVolume.hh" 0055 0056 #include <iostream> 0057 #include <stdlib.h> 0058 0059 // user classes 0060 #include "B02ActionInitialization.hh" 0061 #include "B02DetectorConstruction.hh" 0062 #include "B02ImportanceDetectorConstruction.hh" 0063 #include "FTFP_BERT.hh" 0064 0065 #include "G4ImportanceBiasing.hh" 0066 #include "G4ParallelWorldPhysics.hh" 0067 // #include "B02PrimaryGeneratorAction.hh" 0068 // #include "B02RunAction.hh" 0069 0070 // Files specific for biasing and scoring 0071 #include "G4GeometrySampler.hh" 0072 #include "G4IStore.hh" 0073 #include "G4VWeightWindowStore.hh" 0074 #include "G4WeightWindowAlgorithm.hh" 0075 0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0077 0078 int main(int argc, char** argv) 0079 { 0080 G4int mode = 0; 0081 if (argc > 1) mode = atoi(argv[1]); 0082 if (mode != 0) { 0083 G4cout << " mode not used yet, refer to B01 to see WeightWindow technique " << mode << G4endl; 0084 } 0085 0086 G4int numberOfEvents = 100; 0087 G4long myseed = 345354; 0088 0089 auto* runManager = G4RunManagerFactory::CreateRunManager(); 0090 runManager->SetNumberOfThreads(2); 0091 0092 G4Random::setTheSeed(myseed); 0093 0094 // create the detector --------------------------- 0095 B02DetectorConstruction* detector = new B02DetectorConstruction(); 0096 runManager->SetUserInitialization(detector); 0097 0098 G4String parallelName("ParallelBiasingWorld"); 0099 B02ImportanceDetectorConstruction* pdet = new B02ImportanceDetectorConstruction(parallelName); 0100 detector->RegisterParallelWorld(pdet); 0101 0102 G4GeometrySampler pgs(pdet->GetWorldVolume(), "neutron"); 0103 0104 pgs.SetParallel(true); 0105 0106 G4VModularPhysicsList* physicsList = new FTFP_BERT; 0107 physicsList->RegisterPhysics(new G4ImportanceBiasing(&pgs, parallelName)); 0108 physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelName)); 0109 0110 runManager->SetUserInitialization(physicsList); 0111 0112 // Set user action classes through Worker Initialization 0113 // 0114 B02ActionInitialization* actions = new B02ActionInitialization; 0115 runManager->SetUserInitialization(actions); 0116 0117 runManager->Initialize(); 0118 0119 pdet->CreateImportanceStore(); 0120 0121 // temporary fix before runManager->BeamOn works... 0122 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 0123 G4String command1 = "/control/cout/setCoutFile threadOut"; 0124 UImanager->ApplyCommand(command1); 0125 G4String command2 = "/run/beamOn " + G4UIcommand::ConvertToString(numberOfEvents); 0126 UImanager->ApplyCommand(command2); 0127 0128 // open geometry for clean biasing stores clean-up 0129 // 0130 G4GeometryManager::GetInstance()->OpenGeometry(); 0131 0132 // pgs.ClearSampling(); 0133 0134 delete runManager; 0135 0136 return 0; 0137 } 0138 0139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |