Ignore:
Timestamp:
Apr 6, 2009, 12:21:12 PM (15 years ago)
Author:
garnier
Message:

update processes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BraggModel.cc,v 1.16 2007/07/28 13:30:53 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BraggModel.cc,v 1.21 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5050// 15-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
    5151// 25-04-06 Add stopping data from PSTAR (V.Ivanchenko)
     52// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     53//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
    5254
    5355// Class Description:
     
    6769#include "G4Electron.hh"
    6870#include "G4ParticleChangeForLoss.hh"
     71#include "G4LossTableManager.hh"
     72#include "G4EmCorrections.hh"
    6973
    7074//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7478G4BraggModel::G4BraggModel(const G4ParticleDefinition* p, const G4String& nam)
    7579  : G4VEmModel(nam),
    76   particle(0),
    77   protonMassAMU(1.007276),
    78   iMolecula(0),
    79   isIon(false)
     80    particle(0),
     81    protonMassAMU(1.007276),
     82    iMolecula(0),
     83    isIon(false),
     84    isInitialised(false)
    8085{
    8186  if(p) SetParticle(p);
     87  SetHighEnergyLimit(2.0*MeV);
     88
    8289  lowestKinEnergy  = 1.0*keV;
    8390  theZieglerFactor = eV*cm2*1.0e-15;
     
    104111{
    105112  if(p != particle) SetParticle(p);
    106   G4String pname = particle->GetParticleName();
    107   if(particle->GetParticleType() == "nucleus" &&
    108      pname != "deuteron" && pname != "triton") isIon = true;
    109 
    110   if(pParticleChange)
    111     fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
    112                                                               (pParticleChange);
    113   else
    114     fParticleChange = new G4ParticleChangeForLoss();
     113
     114  // always false before the run
     115  SetDeexcitationFlag(false);
     116
     117  if(!isInitialised) {
     118    isInitialised = true;
     119
     120    G4String pname = particle->GetParticleName();
     121    if(particle->GetParticleType() == "nucleus" &&
     122       pname != "deuteron" && pname != "triton") isIon = true;
     123
     124    corr = G4LossTableManager::Instance()->EmCorrections();
     125
     126    if(pParticleChange) {
     127      fParticleChange =
     128        reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
     129    } else {
     130      fParticleChange = new G4ParticleChangeForLoss();
     131    }
     132  }
     133}
     134
     135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     136
     137G4double G4BraggModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
     138                                            const G4Material* mat,
     139                                            G4double kineticEnergy)
     140{
     141  // this method is called only for ions
     142  G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,kineticEnergy);
     143  GetModelOfFluctuations()->SetParticleAndCharge(p, q2);
     144  return q2*corr->EffectiveChargeCorrection(p,mat,kineticEnergy);
     145}
     146
     147//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     148
     149G4double G4BraggModel::GetParticleCharge(const G4ParticleDefinition* p,
     150                                         const G4Material* mat,
     151                                         G4double kineticEnergy)
     152{
     153  // this method is called only for ions
     154  return corr->GetParticleCharge(p,mat,kineticEnergy);
    115155}
    116156
     
    123163                                                 G4double maxKinEnergy)
    124164{
    125 
    126165  G4double cross     = 0.0;
    127166  G4double tmax      = MaxSecondaryEnergy(p, kineticEnergy);
    128   G4double maxEnergy = min(tmax,maxKinEnergy);
     167  G4double maxEnergy = std::min(tmax,maxKinEnergy);
    129168  if(cutEnergy < tmax) {
    130169
     
    203242
    204243  return dedx;
     244}
     245
     246//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     247
     248void G4BraggModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
     249                                        const G4DynamicParticle* dp,
     250                                        G4double& eloss,
     251                                        G4double&,
     252                                        G4double length)
     253{
     254  if(nuclearStopping) {
     255
     256    G4double preKinEnergy = dp->GetKineticEnergy();
     257    G4double e = preKinEnergy - eloss*0.5;
     258    if(e < 0.0) e = preKinEnergy*0.5;
     259    G4double nloss = length*corr->NuclearDEDX(dp->GetDefinition(),
     260                                              couple->GetMaterial(),
     261                                              e,false);
     262
     263    // too big energy loss
     264    if(eloss + nloss > preKinEnergy) {
     265      nloss *= (preKinEnergy/(eloss + nloss));
     266      eloss = preKinEnergy;
     267    } else {
     268      eloss += nloss;
     269    }
     270    /*
     271    G4cout << "G4ionIonisation::CorrectionsAlongStep: e= " << preKinEnergy
     272           << " de= " << eloss << " NIEL= " << nloss
     273           << " dynQ= " << dp->GetCharge()/eplus << G4endl;
     274    */
     275    fParticleChange->ProposeNonIonizingEnergyDeposit(nloss);
     276  }
    205277}
    206278
     
    268340
    269341  vdp->push_back(delta);
     342}
     343
     344//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     345
     346G4double G4BraggModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
     347                                          G4double kinEnergy)
     348{
     349  if(pd != particle) SetParticle(pd);
     350  G4double tau  = kinEnergy/mass;
     351  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
     352                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
     353  return tmax;
    270354}
    271355
Note: See TracChangeset for help on using the changeset viewer.