Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file GB06/src/GB06BOptrSplitAndKillByImpo 26 /// \file GB06/src/GB06BOptrSplitAndKillByImportance.cc 27 /// \brief Implementation of the GB06BOptrSpli 27 /// \brief Implementation of the GB06BOptrSplitAndKillByImportance class 28 // 28 // 29 #include "GB06BOptrSplitAndKillByImportance.hh 29 #include "GB06BOptrSplitAndKillByImportance.hh" 30 << 31 #include "GB06BOptnSplitAndKillByImportance.hh 30 #include "GB06BOptnSplitAndKillByImportance.hh" 32 31 33 #include "G4BiasingProcessInterface.hh" 32 #include "G4BiasingProcessInterface.hh" 34 #include "G4BiasingProcessSharedData.hh" << 35 #include "G4ParallelGeometriesLimiterProcess.h 33 #include "G4ParallelGeometriesLimiterProcess.hh" >> 34 #include "G4BiasingProcessSharedData.hh" >> 35 >> 36 36 #include "G4ParticleDefinition.hh" 37 #include "G4ParticleDefinition.hh" 37 #include "G4ParticleTable.hh" 38 #include "G4ParticleTable.hh" 38 #include "G4TouchableHandle.hh" << 39 #include "G4TransportationManager.hh" << 40 #include "G4VProcess.hh" 39 #include "G4VProcess.hh" 41 40 >> 41 #include "G4TransportationManager.hh" >> 42 #include "G4TouchableHistoryHandle.hh" >> 43 42 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 45 44 GB06BOptrSplitAndKillByImportance::GB06BOptrSp << 46 GB06BOptrSplitAndKillByImportance:: 45 << 47 GB06BOptrSplitAndKillByImportance(G4String particleName, >> 48 G4String name) 46 : G4VBiasingOperator(name), 49 : G4VBiasingOperator(name), 47 fParallelWorld(nullptr), << 50 fParallelWorld ( nullptr ), 48 fParallelWorldIndex(-1), << 51 fParallelWorldIndex ( -1 ), 49 fBiasingLimiterProcess(nullptr) << 52 fBiasingLimiterProcess ( nullptr ) 50 { 53 { 51 fParticleToBias = G4ParticleTable::GetPartic 54 fParticleToBias = G4ParticleTable::GetParticleTable()->FindParticle(particleName); 52 55 53 if (fParticleToBias == 0) { << 56 if ( fParticleToBias == 0 ) 54 G4ExceptionDescription ed; << 57 { 55 ed << "Particle `" << particleName << "' n << 58 G4ExceptionDescription ed; 56 G4Exception("GB06BOptrSplitAndKillByImport << 59 ed << "Particle `" << particleName << "' not found !" << G4endl; 57 } << 60 G4Exception("GB06BOptrSplitAndKillByImportance(...)", >> 61 "exGB06.01", >> 62 JustWarning, >> 63 ed); >> 64 } >> 65 >> 66 fSplitAndKillByImportance = >> 67 new GB06BOptnSplitAndKillByImportance("splitterFor_"+particleName); 58 68 59 fSplitAndKillByImportance = new GB06BOptnSpl << 60 } 69 } 61 70 62 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 72 64 GB06BOptrSplitAndKillByImportance::~GB06BOptrS 73 GB06BOptrSplitAndKillByImportance::~GB06BOptrSplitAndKillByImportance() 65 { 74 { 66 delete fSplitAndKillByImportance; 75 delete fSplitAndKillByImportance; 67 } 76 } 68 77 69 //....oooOO0OOooo........oooOO0OOooo........oo 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 79 71 void GB06BOptrSplitAndKillByImportance::StartR 80 void GB06BOptrSplitAndKillByImportance::StartRun() 72 { 81 { 73 // --------------- 82 // --------------- 74 // -- Setup stage: 83 // -- Setup stage: 75 // --------------- 84 // --------------- 76 // -- get the particle process manager... 85 // -- get the particle process manager... 77 const G4ProcessManager* processManager = fPa 86 const G4ProcessManager* processManager = fParticleToBias->GetProcessManager(); 78 // -- ... to obtain the biasing information 87 // -- ... to obtain the biasing information shared among this particle processes: 79 fBiasingSharedData = G4BiasingProcessInterfa << 88 fBiasingSharedData = G4BiasingProcessInterface::GetSharedData( processManager ); 80 // -- Remember the index of the parallel wor 89 // -- Remember the index of the parallel world: 81 fBiasingLimiterProcess = fBiasingSharedData- 90 fBiasingLimiterProcess = fBiasingSharedData->GetParallelGeometriesLimiterProcess(); 82 fParallelWorldIndex = fBiasingLimiterProcess << 91 fParallelWorldIndex = fBiasingLimiterProcess->GetParallelWorldIndex(fParallelWorld); 83 92 84 // -- Setup the biasing operation: 93 // -- Setup the biasing operation: 85 fSplitAndKillByImportance->SetBiasingSharedD << 94 fSplitAndKillByImportance-> SetBiasingSharedData( fBiasingSharedData ); 86 fSplitAndKillByImportance->SetParallelWorldI << 95 fSplitAndKillByImportance->SetParallelWorldIndex( fParallelWorldIndex ); 87 fSplitAndKillByImportance->SetImportanceMap( << 96 fSplitAndKillByImportance-> SetImportanceMap( &fImportanceMap ); >> 97 88 } 98 } 89 99 90 //....oooOO0OOooo........oooOO0OOooo........oo 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 91 101 92 G4VBiasingOperation* GB06BOptrSplitAndKillByIm << 102 G4VBiasingOperation* 93 const G4Track* track, const G4BiasingProcess << 103 GB06BOptrSplitAndKillByImportance:: >> 104 ProposeNonPhysicsBiasingOperation(const G4Track* track, >> 105 const G4BiasingProcessInterface* /*callingProcess*/) 94 { 106 { 95 // -- Check if current particle type is the 107 // -- Check if current particle type is the one to bias: 96 if (track->GetDefinition() != fParticleToBia << 108 if ( track->GetDefinition() != fParticleToBias ) return 0; 97 109 98 // -- if so, request biasing: 110 // -- if so, request biasing: 99 return fSplitAndKillByImportance; 111 return fSplitAndKillByImportance; >> 112 100 } 113 } >> 114 101 115