Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:08

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 // This example is provided by the Geant4-DNA collaboration
0027 // Any report or published results obtained using the Geant4-DNA software
0028 // shall cite the following Geant4-DNA collaboration publication:
0029 // Med. Phys. 37 (2010) 4692-4708
0030 // The Geant4-DNA web site is available at http://geant4-dna.org
0031 //
0032 //---------------------------------------------------------------------------
0033 //
0034 // ClassName:   G4ElectronCapture
0035 //
0036 // Description: The process to kill particles to save CPU
0037 //
0038 // Author:      V.Ivanchenko 31 August 2010
0039 //
0040 //----------------------------------------------------------------------------
0041 //
0042 /// \file G4ElectronCapture.cc
0043 /// \brief Implementation of the G4ElectronCapture class
0044 
0045 #include "G4ElectronCapture.hh"
0046 
0047 #include "G4Electron.hh"
0048 #include "G4ParticleDefinition.hh"
0049 #include "G4Region.hh"
0050 #include "G4RegionStore.hh"
0051 #include "G4Step.hh"
0052 #include "G4SystemOfUnits.hh"
0053 #include "G4Track.hh"
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 G4ElectronCapture::G4ElectronCapture(const G4String& regName, G4double ekinlim)
0058   : G4VDiscreteProcess("eCapture", fElectromagnetic),
0059     fKinEnergyThreshold(ekinlim),
0060     fRegionName(regName),
0061     fpRegion(0)
0062 {
0063   if (regName == "" || regName == "world") {
0064     fRegionName = "DefaultRegionForTheWorld";
0065   }
0066   pParticleChange = &fParticleChange;
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 G4ElectronCapture::~G4ElectronCapture() {}
0072 
0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0074 
0075 void G4ElectronCapture::SetKinEnergyLimit(G4double val)
0076 {
0077   fKinEnergyThreshold = val;
0078   if (verboseLevel > 0) {
0079     G4cout << "### G4ElectronCapture: Tracking cut E(MeV) = " << fKinEnergyThreshold / MeV
0080            << G4endl;
0081   }
0082 }
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 void G4ElectronCapture::BuildPhysicsTable(const G4ParticleDefinition&)
0087 {
0088   fpRegion = (G4RegionStore::GetInstance())->GetRegion(fRegionName);
0089   if (fpRegion && verboseLevel > 0) {
0090     G4cout << "### G4ElectronCapture: Tracking cut E(MeV) = " << fKinEnergyThreshold / MeV
0091            << " is assigned to " << fRegionName << G4endl;
0092   }
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0096 
0097 G4bool G4ElectronCapture::IsApplicable(const G4ParticleDefinition&)
0098 {
0099   return true;
0100 }
0101 
0102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0103 
0104 G4double G4ElectronCapture::PostStepGetPhysicalInteractionLength(const G4Track& aTrack, G4double,
0105                                                                  G4ForceCondition* condition)
0106 {
0107   // condition is set to "Not Forced"
0108   *condition = NotForced;
0109 
0110   G4double limit = DBL_MAX;
0111   if (fpRegion) {
0112     if (aTrack.GetVolume()->GetLogicalVolume()->GetRegion() == fpRegion
0113         && aTrack.GetKineticEnergy() < fKinEnergyThreshold)
0114     {
0115       limit = 0.0;
0116     }
0117   }
0118   return limit;
0119 }
0120 
0121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0122 
0123 G4VParticleChange* G4ElectronCapture::PostStepDoIt(const G4Track& aTrack, const G4Step&)
0124 {
0125   pParticleChange->Initialize(aTrack);
0126   pParticleChange->ProposeTrackStatus(fStopAndKill);
0127   pParticleChange->ProposeLocalEnergyDeposit(aTrack.GetKineticEnergy());
0128   fParticleChange.SetProposedKineticEnergy(0.0);
0129   return pParticleChange;
0130 }
0131 
0132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0133 
0134 G4double G4ElectronCapture::GetMeanFreePath(const G4Track&, G4double, G4ForceCondition*)
0135 {
0136   return DBL_MAX;
0137 }