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/muons/src/G4EnergyLossForExtrapolator.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EnergyLossForExtrapolator.cc,v 1.13 2007/07/28 13:44:25 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4EnergyLossForExtrapolator.cc,v 1.18 2008/11/13 14:14:07 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//---------------------------------------------------------------------------
     
    6767#include "G4MuBremsstrahlungModel.hh"
    6868#include "G4ProductionCuts.hh"
     69#include "G4LossTableManager.hh"
     70#include "G4WentzelVIModel.hh"
    6971
    7072//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    8890  delete invRangePositron;
    8991  delete invRangeProton;
     92  delete mscElectron;
    9093  delete cuts;
    9194}
     
    100103  if(!isInitialised) Initialisation();
    101104  G4double kinEnergyFinal = kinEnergy;
    102   if(mat && part) {
    103     G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
     105  if(SetupKinematics(part, mat, kinEnergy)) {
     106    G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
    104107    G4double r  = ComputeRange(kinEnergy,part);
    105108    if(r <= step) {
     
    125128  G4double kinEnergyFinal = kinEnergy;
    126129
    127   if(mat && part) {
    128     G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
     130  if(SetupKinematics(part, mat, kinEnergy)) {
     131    G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
    129132    G4double r  = ComputeRange(kinEnergy,part);
    130133
     
    141144//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    142145
    143 G4double G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
    144                                                       const G4ParticleDefinition* part,
    145                                                       G4double kinEnergy, G4double stepLength)
    146 {
     146G4double G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy,
     147                                                     G4double stepLength,
     148                                                     const G4Material* mat,
     149                                                     const G4ParticleDefinition* part)
     150{
     151  G4double res = stepLength;
     152  if(!isInitialised) Initialisation();
     153  if(SetupKinematics(part, mat, kinEnergy)) {
     154    if(part == electron || part == positron) {
     155      G4double x = stepLength*ComputeValue(kinEnergy, mscElectron);
     156      if(x < 0.2) res *= (1.0 + 0.5*x + x*x/3.0);
     157      else if(x < 0.9999) res = -std::log(1.0 - x)*stepLength/x;
     158      else res = ComputeRange(kinEnergy,part);
     159   
     160    } else {
     161      res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
     162    }
     163  }
     164  return res;
     165}
     166
     167//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     168
     169G4bool G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
     170                                                    const G4Material* mat,
     171                                                    G4double kinEnergy)
     172{
     173  if(!part || !mat || kinEnergy < keV) return false;
    147174  if(!isInitialised) Initialisation();
    148175  G4bool flag = false;
     
    182209    if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer;
    183210  }
    184   G4double theta = ComputeScatteringAngle(stepLength);
    185   return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
     211  return true;
    186212}
    187213
     
    231257  invRangeMuon     = PrepareTable();
    232258  invRangeProton   = PrepareTable();
     259  mscElectron      = PrepareTable();
    233260
    234261  G4LossTableBuilder builder;
     
    262289  builder.BuildInverseRangeTable(rangeProton, invRangeProton); 
    263290
     291  ComputeTrasportXS(electron, mscElectron);
    264292}
    265293
     
    273301
    274302    G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
     303    v->SetSpline(G4LossTableManager::Instance()->SplineFlag());
    275304    table->push_back(v);
    276305  }
     
    488517//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    489518
     519void G4EnergyLossForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
     520                                                    G4PhysicsTable* table)
     521{
     522  G4DataVector v;
     523  G4WentzelVIModel* msc = new G4WentzelVIModel();
     524  msc->SetPolarAngleLimit(CLHEP::pi);
     525  msc->Initialise(part, v);
     526
     527  mass    = part->GetPDGMass();
     528  charge2 = 1.0;
     529  currentParticle = part;
     530
     531  const G4MaterialTable* mtable = G4Material::GetMaterialTable();
     532
     533  if(0<verbose) {
     534    G4cout << "G4EnergyLossForExtrapolator::ComputeProtonDEDX for " << part->GetParticleName()
     535           << G4endl;
     536  }
     537 
     538  for(G4int i=0; i<nmat; i++) { 
     539
     540    const G4Material* mat = (*mtable)[i];
     541    if(1<verbose)
     542      G4cout << "i= " << i << "  mat= " << mat->GetName() << G4endl;
     543    G4PhysicsVector* aVector = (*table)[i];
     544    for(G4int j=0; j<nbins; j++) {
     545       
     546       G4double e = aVector->GetLowEdgeEnergy(j);
     547       G4double xs = msc->CrossSectionPerVolume(mat,part,e);
     548       aVector->PutValue(j,xs);
     549       if(1<verbose) {
     550         G4cout << "j= " << j << "  e(MeV)= " << e/MeV 
     551                << " xs(1/mm)= " << xs*mm << G4endl;
     552       }
     553    }
     554  }
     555  delete msc;
     556}
     557
     558//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     559
Note: See TracChangeset for help on using the changeset viewer.