Back to home page

EIC code displayed by LXR

 
 

    


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

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