Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:46

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 GB06/src/GB06BOptrSplitAndKillByImportance.cc
0027 /// \brief Implementation of the GB06BOptrSplitAndKillByImportance class
0028 //
0029 #include "GB06BOptrSplitAndKillByImportance.hh"
0030 
0031 #include "GB06BOptnSplitAndKillByImportance.hh"
0032 
0033 #include "G4BiasingProcessInterface.hh"
0034 #include "G4BiasingProcessSharedData.hh"
0035 #include "G4ParallelGeometriesLimiterProcess.hh"
0036 #include "G4ParticleDefinition.hh"
0037 #include "G4ParticleTable.hh"
0038 #include "G4TouchableHandle.hh"
0039 #include "G4TransportationManager.hh"
0040 #include "G4VProcess.hh"
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 GB06BOptrSplitAndKillByImportance::GB06BOptrSplitAndKillByImportance(G4String particleName,
0045                                                                      G4String name)
0046   : G4VBiasingOperator(name),
0047     fParallelWorld(nullptr),
0048     fParallelWorldIndex(-1),
0049     fBiasingLimiterProcess(nullptr)
0050 {
0051   fParticleToBias = G4ParticleTable::GetParticleTable()->FindParticle(particleName);
0052 
0053   if (fParticleToBias == 0) {
0054     G4ExceptionDescription ed;
0055     ed << "Particle `" << particleName << "' not found !" << G4endl;
0056     G4Exception("GB06BOptrSplitAndKillByImportance(...)", "exGB06.01", JustWarning, ed);
0057   }
0058 
0059   fSplitAndKillByImportance = new GB06BOptnSplitAndKillByImportance("splitterFor_" + particleName);
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0063 
0064 GB06BOptrSplitAndKillByImportance::~GB06BOptrSplitAndKillByImportance()
0065 {
0066   delete fSplitAndKillByImportance;
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 void GB06BOptrSplitAndKillByImportance::StartRun()
0072 {
0073   // ---------------
0074   // -- Setup stage:
0075   // ---------------
0076   // -- get the particle process manager...
0077   const G4ProcessManager* processManager = fParticleToBias->GetProcessManager();
0078   // -- ... to obtain the biasing information shared among this particle processes:
0079   fBiasingSharedData = G4BiasingProcessInterface::GetSharedData(processManager);
0080   // -- Remember the index of the parallel world:
0081   fBiasingLimiterProcess = fBiasingSharedData->GetParallelGeometriesLimiterProcess();
0082   fParallelWorldIndex = fBiasingLimiterProcess->GetParallelWorldIndex(fParallelWorld);
0083 
0084   // -- Setup the biasing operation:
0085   fSplitAndKillByImportance->SetBiasingSharedData(fBiasingSharedData);
0086   fSplitAndKillByImportance->SetParallelWorldIndex(fParallelWorldIndex);
0087   fSplitAndKillByImportance->SetImportanceMap(&fImportanceMap);
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 
0092 G4VBiasingOperation* GB06BOptrSplitAndKillByImportance::ProposeNonPhysicsBiasingOperation(
0093   const G4Track* track, const G4BiasingProcessInterface* /*callingProcess*/)
0094 {
0095   // -- Check if current particle type is the one to bias:
0096   if (track->GetDefinition() != fParticleToBias) return 0;
0097 
0098   // -- if so, request biasing:
0099   return fSplitAndKillByImportance;
0100 }