Ignore:
Timestamp:
Nov 25, 2009, 5:13:58 PM (15 years ago)
Author:
garnier
Message:

update CVS release candidate geant4.9.3.01

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/highenergy/src/G4AnnihiToMuPair.cc

    r1007 r1196  
    2525//
    2626//
    27 // $Id: G4AnnihiToMuPair.cc,v 1.5 2008/10/16 14:29:48 vnivanch Exp $
    28 // GEANT4 tag $Name: geant4-09-02 $
     27// $Id: G4AnnihiToMuPair.cc,v 1.6 2009/11/09 18:24:07 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//         ------------ G4AnnihiToMuPair physics process ------
     
    6565 HighestEnergyLimit = 1000*TeV;
    6666 
     67 CurrentSigma = 0.0;
    6768 CrossSecFactor = 1.;
    6869 SetProcessSubType(6);
     
    8889//here no tables, just calling PrintInfoDefinition
    8990{
    90    PrintInfoDefinition();
     91  CurrentSigma = 0.0;
     92  PrintInfoDefinition();
    9193}
    9294
     
    117119  G4double SigmaEl = Sig0*xi*(1.+xi/2.)*sqrt(1.-xi); // per electron
    118120  CrossSection = SigmaEl*Z;         // number of electrons per atom
    119   CrossSection *= CrossSecFactor;   //increase the CrossSection by  (default 1)
    120121  return CrossSection;
    121122}
     
    123124//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    124125
    125 G4double G4AnnihiToMuPair::GetMeanFreePath(const G4Track& aTrack,
    126                                            G4double, G4ForceCondition*)
    127 
    128 // returns the positron mean free path in GEANT4 internal units
    129 
    130 {
    131   const G4DynamicParticle* aDynamicPositron = aTrack.GetDynamicParticle();
    132   G4double PositronEnergy = aDynamicPositron->GetKineticEnergy()
    133                                               +electron_mass_c2;
    134   G4Material* aMaterial = aTrack.GetMaterial();
     126G4double G4AnnihiToMuPair::CrossSectionPerVolume(G4double PositronEnergy,
     127                                                 const G4Material* aMaterial)
     128{
    135129  const G4ElementVector* theElementVector = aMaterial->GetElementVector();
    136130  const G4double* NbOfAtomsPerVolume = aMaterial->GetVecNbOfAtomsPerVolume();
    137131
    138   G4double SIGMA = 0 ;
    139 
    140   for ( size_t i=0 ; i < aMaterial->GetNumberOfElements() ; i++ )
     132  G4double SIGMA = 0.0;
     133
     134  for ( size_t i=0 ; i < aMaterial->GetNumberOfElements() ; ++i )
    141135  {
    142136    G4double AtomicZ = (*theElementVector)[i]->GetZ();
     
    144138      ComputeCrossSectionPerAtom(PositronEnergy,AtomicZ);
    145139  }
    146   return SIGMA > DBL_MIN ? 1./SIGMA : DBL_MAX;
     140  return SIGMA;
     141}
     142
     143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     144
     145G4double G4AnnihiToMuPair::GetMeanFreePath(const G4Track& aTrack,
     146                                           G4double, G4ForceCondition*)
     147
     148// returns the positron mean free path in GEANT4 internal units
     149
     150{
     151  const G4DynamicParticle* aDynamicPositron = aTrack.GetDynamicParticle();
     152  G4double PositronEnergy = aDynamicPositron->GetKineticEnergy()
     153                                              +electron_mass_c2;
     154  G4Material* aMaterial = aTrack.GetMaterial();
     155  CurrentSigma = CrossSectionPerVolume(PositronEnergy, aMaterial);
     156
     157  // increase the CrossSection by CrossSecFactor (default 1)
     158  G4double mfp = DBL_MAX;
     159  if(CurrentSigma > DBL_MIN) mfp = 1.0/(CurrentSigma*CrossSecFactor);
     160
     161  return mfp;
    147162}
    148163
     
    162177  // current Positron energy and direction, return if energy too low
    163178  const G4DynamicParticle *aDynamicPositron = aTrack.GetDynamicParticle();
    164   G4double Epos = aDynamicPositron->GetKineticEnergy()+Mele;
    165 
    166  if (Epos < LowestEnergyLimit)
    167   { G4cout
    168         << "error in G4AnnihiToMuPair::PostStepDoIt called with energy below"
    169            " threshold Epos= "
    170         << Epos << G4endl;       // shoud never happen
    171         G4Exception(10);
     179  G4double Epos = aDynamicPositron->GetKineticEnergy() + Mele;
     180
     181  // test of cross section
     182  if(CurrentSigma*G4UniformRand() >
     183     CrossSectionPerVolume(Epos, aTrack.GetMaterial()))
     184    {
     185      return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
     186    }
     187
     188  if (Epos < LowestEnergyLimit) {
     189     return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
    172190  }
    173 
    174   if (Epos < LowestEnergyLimit)
    175      return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
    176191
    177192  G4ParticleMomentum PositronDirection =
Note: See TracChangeset for help on using the changeset viewer.