// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // $Id: G4EnergyLossForExtrapolator.cc,v 1.19 2009/07/09 17:04:55 vnivanch Exp $ // GEANT4 tag $Name: geant4-09-04-beta-01 $ // //--------------------------------------------------------------------------- // // ClassName: G4EnergyLossForExtrapolator // // Description: This class provide calculation of energy loss, fluctuation, // and msc angle // // Author: 09.12.04 V.Ivanchenko // // Modification: // 08-04-05 Rename Propogator -> Extrapolator (V.Ivanchenko) // 16-03-06 Add muon tables and fix bug in units (V.Ivanchenko) // 21-03-06 Add verbosity defined in the constructor and Initialisation // start only when first public method is called (V.Ivanchenko) // 03-05-06 Remove unused pointer G4Material* from number of methods (VI) // 12-05-06 SEt linLossLimit=0.001 (VI) // //---------------------------------------------------------------------------- // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... #include "G4EnergyLossForExtrapolator.hh" #include "G4PhysicsLogVector.hh" #include "G4ParticleDefinition.hh" #include "G4Material.hh" #include "G4MaterialCutsCouple.hh" #include "G4Electron.hh" #include "G4Positron.hh" #include "G4Proton.hh" #include "G4MuonPlus.hh" #include "G4MuonMinus.hh" #include "G4ParticleTable.hh" #include "G4LossTableBuilder.hh" #include "G4MollerBhabhaModel.hh" #include "G4BetheBlochModel.hh" #include "G4eBremsstrahlungModel.hh" #include "G4MuPairProductionModel.hh" #include "G4MuBremsstrahlungModel.hh" #include "G4ProductionCuts.hh" #include "G4LossTableManager.hh" #include "G4WentzelVIModel.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator(G4int verb) :maxEnergyTransfer(DBL_MAX),verbose(verb),isInitialised(false) {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4EnergyLossForExtrapolator:: ~G4EnergyLossForExtrapolator() { for(G4int i=0; iGetPDGMass(); G4double q = part->GetPDGCharge()/eplus; charge2 = q*q; } if(mat != currentMaterial) { G4int i = mat->GetIndex(); if(i >= nmat) { G4cout << "### G4EnergyLossForExtrapolator WARNING:index i= " << i << " is out of table - NO extrapolation" << G4endl; } else { flag = true; currentMaterial = mat; electronDensity = mat->GetElectronDensity(); radLength = mat->GetRadlen(); index = i; } } if(flag || kinEnergy != kineticEnergy) { kineticEnergy = kinEnergy; G4double tau = kinEnergy/mass; gam = tau + 1.0; bg2 = tau * (tau + 2.0); beta2 = bg2/(gam*gam); tmax = kinEnergy; if(part == electron) tmax *= 0.5; else if(part != positron) { G4double r = electron_mass_c2/mass; tmax = 2.0*bg2*electron_mass_c2/(1.0 + 2.0*gam*r + r*r); } if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer; } return true; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void G4EnergyLossForExtrapolator::Initialisation() { isInitialised = true; if(verbose>1) G4cout << "### G4EnergyLossForExtrapolator::Initialisation" << G4endl; currentParticle = 0; currentMaterial = 0; kineticEnergy = 0.0; electron = G4Electron::Electron(); positron = G4Positron::Positron(); proton = G4Proton::Proton(); muonPlus = G4MuonPlus::MuonPlus(); muonMinus= G4MuonMinus::MuonMinus(); currentParticleName = ""; linLossLimit = 0.01; emin = 1.*MeV; emax = 10.*TeV; nbins = 70; nmat = G4Material::GetNumberOfMaterials(); const G4MaterialTable* mtable = G4Material::GetMaterialTable(); cuts = new G4ProductionCuts(); const G4MaterialCutsCouple* couple; for(G4int i=0; i1) G4cout << "### G4EnergyLossForExtrapolator Builds electron tables" << G4endl; ComputeElectronDEDX(electron, dedxElectron); builder.BuildRangeTable(dedxElectron,rangeElectron); builder.BuildInverseRangeTable(rangeElectron, invRangeElectron); if(verbose>1) G4cout << "### G4EnergyLossForExtrapolator Builds positron tables" << G4endl; ComputeElectronDEDX(positron, dedxPositron); builder.BuildRangeTable(dedxPositron, rangePositron); builder.BuildInverseRangeTable(rangePositron, invRangePositron); if(verbose>1) G4cout << "### G4EnergyLossForExtrapolator Builds muon tables" << G4endl; ComputeMuonDEDX(muonPlus, dedxMuon); builder.BuildRangeTable(dedxMuon, rangeMuon); builder.BuildInverseRangeTable(rangeMuon, invRangeMuon); if(verbose>1) G4cout << "### G4EnergyLossForExtrapolator Builds proton tables" << G4endl; ComputeProtonDEDX(proton, dedxProton); builder.BuildRangeTable(dedxProton, rangeProton); builder.BuildInverseRangeTable(rangeProton, invRangeProton); ComputeTrasportXS(electron, mscElectron); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4PhysicsTable* G4EnergyLossForExtrapolator::PrepareTable() { G4PhysicsTable* table = new G4PhysicsTable(); for(G4int i=0; iSetSpline(G4LossTableManager::Instance()->SplineFlag()); table->push_back(v); } return table; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... const G4ParticleDefinition* G4EnergyLossForExtrapolator::FindParticle(const G4String& name) { const G4ParticleDefinition* p = 0; if(name != currentParticleName) { p = G4ParticleTable::GetParticleTable()->FindParticle(name); if(!p) { G4cout << "### G4EnergyLossForExtrapolator WARNING:FindParticle fails to find " << name << G4endl; } } else { p = currentParticle; } return p; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4double G4EnergyLossForExtrapolator::ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition* part) { G4double x = 0.0; if(part == electron) x = ComputeValue(kinEnergy, dedxElectron); else if(part == positron) x = ComputeValue(kinEnergy, dedxPositron); else if(part == muonPlus || part == muonMinus) { x = ComputeValue(kinEnergy, dedxMuon); } else { G4double e = kinEnergy*proton_mass_c2/mass; x = ComputeValue(e, dedxProton)*charge2; } return x; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4double G4EnergyLossForExtrapolator::ComputeRange(G4double kinEnergy, const G4ParticleDefinition* part) { G4double x = 0.0; if(part == electron) x = ComputeValue(kinEnergy, rangeElectron); else if(part == positron) x = ComputeValue(kinEnergy, rangePositron); else if(part == muonPlus || part == muonMinus) x = ComputeValue(kinEnergy, rangeMuon); else { G4double massratio = proton_mass_c2/mass; G4double e = kinEnergy*massratio; x = ComputeValue(e, rangeProton)/(charge2*massratio); } return x; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4double G4EnergyLossForExtrapolator::ComputeEnergy(G4double range, const G4ParticleDefinition* part) { G4double x = 0.0; if(part == electron) x = ComputeValue(range, invRangeElectron); else if(part == positron) x = ComputeValue(range, invRangePositron); else if(part == muonPlus || part == muonMinus) x = ComputeValue(range, invRangeMuon); else { G4double massratio = proton_mass_c2/mass; G4double r = range*massratio*charge2; x = ComputeValue(r, invRangeProton)/massratio; } return x; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void G4EnergyLossForExtrapolator::ComputeElectronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table) { G4DataVector v; G4MollerBhabhaModel* ioni = new G4MollerBhabhaModel(); G4eBremsstrahlungModel* brem = new G4eBremsstrahlungModel(); ioni->Initialise(part, v); brem->Initialise(part, v); mass = electron_mass_c2; charge2 = 1.0; currentParticle = part; const G4MaterialTable* mtable = G4Material::GetMaterialTable(); if(0GetParticleName() << G4endl; } for(G4int i=0; iGetParticleName() << G4endl; } for(G4int i=0; iGetParticleName() << G4endl; } for(G4int i=0; iGetParticleName() << G4endl; } for(G4int i=0; i