G4NuclearStopping.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // -----------------------------------------------------------------------------
00029 //
00030 // GEANT4 Class file
00031 //
00032 // File name:     G4NuclearStopping
00033 //
00034 // Author:        Vladimir Ivanchenko
00035 //
00036 // Creation date: 20 July 2009
00037 // 
00038 // Modified:
00039 //
00040 // -----------------------------------------------------------------------------
00041 //
00042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00044 
00045 #include "G4NuclearStopping.hh"
00046 #include "G4ICRU49NuclearStoppingModel.hh"
00047 #include "G4SystemOfUnits.hh"
00048 #include "G4PhysicalConstants.hh"
00049 
00050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00051 
00052 using namespace std;
00053 
00054 G4NuclearStopping::G4NuclearStopping(const G4String& processName)
00055   : G4VEmProcess(processName)
00056 {
00057   isInitialized = false;  
00058   SetProcessSubType(fNuclearStopping);
00059   SetBuildTableFlag(false);
00060   enableAlongStepDoIt = true; 
00061   enablePostStepDoIt = false; 
00062   modelICRU49 = 0;
00063 }
00064 
00065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00066 
00067 G4NuclearStopping::~G4NuclearStopping()
00068 {}
00069 
00070 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00071 
00072 G4bool G4NuclearStopping::IsApplicable (const G4ParticleDefinition& p)
00073 {
00074   return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
00075 }
00076 
00077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00078 
00079 void G4NuclearStopping::InitialiseProcess(const G4ParticleDefinition*)
00080 {
00081   if(!isInitialized) {
00082     isInitialized = true;
00083 
00084     if(!EmModel(1)) {
00085       modelICRU49 = new G4ICRU49NuclearStoppingModel();
00086       SetEmModel(modelICRU49);
00087     }
00088     AddEmModel(1, EmModel());
00089     EmModel()->SetParticleChange(&nParticleChange);
00090   }
00091 }
00092 
00093 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00094 
00095 G4double 
00096 G4NuclearStopping::AlongStepGetPhysicalInteractionLength(
00097      const G4Track&, G4double, G4double, G4double&, G4GPILSelection* selection)
00098 {
00099   *selection = NotCandidateForSelection;
00100   return DBL_MAX;
00101 }
00102 
00103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00104 
00105 G4VParticleChange* G4NuclearStopping::AlongStepDoIt(const G4Track& track,
00106                                                     const G4Step&  step)
00107 {
00108   nParticleChange.InitializeForAlongStep(track);
00109   G4double T2 = step.GetPostStepPoint()->GetKineticEnergy();
00110 
00111   const G4ParticleDefinition* part = track.GetParticleDefinition();
00112   G4double Z = std::fabs(part->GetPDGCharge()/eplus);
00113 
00114   if(T2 > 0.0 && T2*proton_mass_c2 < Z*Z*MeV*part->GetPDGMass()) {
00115 
00116     G4double length = step.GetStepLength(); 
00117     if(length > 0.0) {
00118 
00119       // primary
00120       G4double T1= step.GetPreStepPoint()->GetKineticEnergy();
00121       G4double T = 0.5*(T1 + T2);
00122       const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple(); 
00123       G4VEmModel* mod = SelectModel(T, couple->GetIndex());
00124 
00125       // sample stopping
00126       if(modelICRU49) { modelICRU49->SetFluctuationFlag(true); }
00127       G4double nloss = 
00128         length*mod->ComputeDEDXPerVolume(couple->GetMaterial(), part, T);
00129       if(nloss > T1) { nloss = T1; }
00130       nParticleChange.SetProposedKineticEnergy(T1 - nloss);
00131       nParticleChange.ProposeLocalEnergyDeposit(nloss);
00132       nParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
00133       if(modelICRU49) { modelICRU49->SetFluctuationFlag(false); }
00134     }
00135   }
00136   return &nParticleChange;
00137 }
00138 
00139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00140 
00141 void G4NuclearStopping::PrintInfo()
00142 {}
00143 
00144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00145 

Generated on Mon May 27 17:49:06 2013 for Geant4 by  doxygen 1.4.7