Back to home page

EIC code displayed by LXR

 
 

    


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

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