// // ******************************************************************** // * 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: G4DNADingfelderChargeChangeTotalCrossSectionPolicy.icc,v 1.3 2006/06/29 19:33:52 gunter Exp $ // GEANT4 tag $Name: geant4-08-01 $ // #ifdef G4DNADINGFELDERCHARGECHANGETOTALCROSSSECTIONPOLICY_HH #include "Randomize.hh" template G4double G4DNADingfelderChargeChangeTotalCrossSectionPolicy :: TotalCrossSection(G4double k, G4int z) { if (k < EnergyLimitsPolicy::lowEnergyLimit) { if (EnergyLimitsPolicy::zeroBelowLowEnergyLimit) return 0; k=EnergyLimitsPolicy::lowEnergyLimit; } else if (k > EnergyLimitsPolicy::highEnergyLimit) { if (EnergyLimitsPolicy::zeroAboveHighEnergyLimit) return 0; k=EnergyLimitsPolicy::highEnergyLimit; } G4int i(IncomingParticlePolicy::NumberOfPartialCrossSections()); G4double totalCrossSection(0.); while (i>0) { i--; totalCrossSection+=PartialCrossSection(k, z, i); } return totalCrossSection; } template G4int G4DNADingfelderChargeChangeTotalCrossSectionPolicy :: RandomizePartialCrossSection(G4double k, G4int z) { const G4int n(IncomingParticlePolicy::NumberOfPartialCrossSections()); G4double * values(new G4double[n]); G4double value(0); G4int i(n); while (i>0) { i--; values[i]=PartialCrossSection(k, z, i); value+=values[i]; } value*=G4UniformRand(); i=n; while (i>0) { i--; if (values[i]>value) break; value-=values[i]; } delete[] values; return i; } template G4double G4DNADingfelderChargeChangeTotalCrossSectionPolicy :: PartialCrossSection(G4double k, G4int /* z */, G4int index) { // // sigma(T) = f0 10 ^ y(std::log10(T/eV)) // // / a0 x + b0 x < x0 // | // y(x) = < a0 x + b0 - c0 (x - x0)^d0 x0 <= x < x1 // | // \ a1 x + b1 x >= x1 // // // f0, a0, a1, b0, b1, c0, d0, x0, x1 are parameters that change for protons and helium (0, +, ++) // // f0 has been added to the code in order to manage partial (shell-dependent) cross sections (if no shell dependence is present. f0=1. Sum of f0 over the considered shells should give 1) // // From Rad. Phys. and Chem. 59 (2000) 255-275, M. Dingfelder et al. // Inelastic-collision cross sections of liquid water for interactions of energetic proton // if (IncomingParticlePolicy::x1[index]