Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/lowenergy/src/G4Generator2BS.cc

    r819 r1340  
    2424// ********************************************************************
    2525//
     26// $Id: G4Generator2BS.cc,v 1.10 2010/10/14 14:01:02 vnivanch Exp $
     27// GEANT4 tag $Name: emlowen-V09-03-54 $
    2628//
    2729// -------------------------------------------------------------------
     
    3941//
    4042// Modifications:
    41 // 02 Jun 2003                    First implementation acording with new design
    42 // 05 Nov 2003  MGP               Fixed std namespace
    43 // 17 Nov 2003  MGP               Fixed compilation problem on Windows                 
     43// 02 Jun 2003               First implementation acording with new design
     44// 05 Nov 2003  MGP          Fixed std namespace
     45// 17 Nov 2003  MGP          Fixed compilation problem on Windows                 
     46// 12 Oct 2010  V.Ivanchenko Moved RejectionFunction inline, use G4Pow to speadup
    4447//
    4548// Class Description:
    4649//
    47 // Concrete base class for Bremsstrahlung Angular Distribution Generation - 2BS Distribution
     50// Concrete base class for Bremsstrahlung Angular Distribution Generation
     51// 2BS Distribution
    4852//
    4953// Class Description: End
     
    5155// -------------------------------------------------------------------
    5256//
    53 //   
    5457
    5558#include "G4Generator2BS.hh"
    56 #include "Randomize.hh"
    57 //    
     59#include "Randomize.hh"   
     60#include "G4Pow.hh"   
    5861
    59 G4Generator2BS::G4Generator2BS(const G4String& name):G4VBremAngularDistribution(name)
    60 {;}
     62//
     63
     64G4Generator2BS::G4Generator2BS(const G4String&)
     65  : G4VBremAngularDistribution("AngularGen2BS")
     66{
     67  g4pow = G4Pow::GetInstance();
     68}
    6169
    6270//   
    6371
    6472G4Generator2BS::~G4Generator2BS()
    65 {;}
     73{}
    6674
    6775//
     
    7987  // Departement of Medical Physics, Memorial Sloan-Kettering Cancer Center, New York
    8088
    81 
    8289  G4double theta = 0;
    8390
     
    8794  G4double gMaxEnergy = (pi*initialTotalEnergy)*(pi*initialTotalEnergy);
    8895
    89   G4double Zeff = std::sqrt(static_cast<G4double>(Z) * (static_cast<G4double>(Z) + 1.0));
    90   z = (0.00008116224*(std::pow(Zeff,0.3333333)));
     96  //G4double Zeff = std::sqrt(static_cast<G4double>(Z) * (static_cast<G4double>(Z) + 1.0));
     97  //z = (0.00008116224*(std::pow(Zeff,0.3333333)));
     98
     99  // VI speadup
     100  z = 0.00008116224*(g4pow->Z13(Z) + g4pow->Z13(Z+1));
    91101
    92102  // Rejection arguments
     
    97107
    98108  // Calculate rejection function at 0, 1 and Emax
    99   G4double gfunction0 = RejectionFunction(0);
    100   G4double gfunction1 = RejectionFunction(1);
     109  G4double gfunction0 = RejectionFunction(0.0);
     110  G4double gfunction1 = RejectionFunction(1.0);
    101111  G4double gfunctionEmax = RejectionFunction(gMaxEnergy);
    102 
    103112
    104113  // Calculate Maximum value
     
    110119  do{
    111120    rand = G4UniformRand();
    112     rand = rand/(1-rand+1.0/gMaxEnergy);
     121    rand /= (1 - rand + 1.0/gMaxEnergy);
    113122    gfunctionTest = RejectionFunction(rand);
    114123    randTest = G4UniformRand();
    115124
    116   }while(randTest > (gfunctionTest/gMaximum));
     125  } while(randTest*gMaximum > gfunctionTest);
    117126
    118127  theta = std::sqrt(rand)/initialTotalEnergy;
    119128
    120 
    121129  return theta;
    122130}
     131
    123132//
    124 
    125 G4double G4Generator2BS::RejectionFunction(G4double value) const
    126 {
    127 
    128   G4double argument = (1+value)*(1+value);
    129 
    130   G4double gfunction = (4+std::log(rejection_argument3+(z/argument)))*
    131     ((4*EnergyRatio*value/argument)-rejection_argument1)+rejection_argument2;
    132 
    133   return gfunction;
    134 
    135 }
    136133
    137134void G4Generator2BS::PrintGeneratorInformation() const
    138135{
    139136  G4cout << "\n" << G4endl;
    140   G4cout << "Bremsstrahlung Angular Generator is 2BS Generator from 2BS Koch & Motz distribution (Rev Mod Phys 31(4), 920 (1959))" << G4endl;
     137  G4cout << "Bremsstrahlung Angular Generator is 2BS Generator "
     138         << "from 2BS Koch & Motz distribution (Rev Mod Phys 31(4), 920 (1959))" << G4endl;
    141139  G4cout << "Sampling algorithm adapted from PIRS-0203" << G4endl;
    142140  G4cout << "\n" << G4endl;
Note: See TracChangeset for help on using the changeset viewer.