39 #define CHAMPION_VERBOSE
58 #ifdef CHAMPION_VERBOSE
61 G4cout <<
"Champion Elastic model is constructed "
71 fpMolWaterDensity = 0;
80 if(fpData)
delete fpData;
91 #ifdef CHAMPION_VERBOSE
94 G4cout <<
"Calling G4DNAChampionElasticModel::Initialise()" <<
G4endl;
100 G4Exception(
"G4DNAChampionElasticModel::Initialise",
103 "Model not applicable to particle type.");
110 G4cout <<
"G4DNAChampionElasticModel: low energy limit increased from "
118 G4cout <<
"G4DNAChampionElasticModel: high energy limit decreased from "
124 if (isInitialised) {
return; }
132 G4String fileElectron(
"dna/sigma_elastic_e_champion");
141 char *path = getenv(
"G4LEDATA");
148 "G4LEDATA environment variable not set.");
152 std::ostringstream eFullFileName;
153 eFullFileName << path <<
"/dna/sigmadiff_cumulated_elastic_e_champion_hp.dat";
154 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
156 if (!eDiffCrossSection)
159 errMsg <<
"Missing data file:/dna/sigmadiff_cumulated_elastic_e_champion_hp.dat; "
160 <<
"please use G4EMLOW6.36 and above.";
162 G4Exception(
"G4DNAChampionElasticModel::Initialise",
173 eDiffCrossSectionData.clear();
177 eTdummyVec.push_back(0.);
179 while(!eDiffCrossSection.eof())
183 eDiffCrossSection >> tDummy >> eDummy;
187 if (tDummy != eTdummyVec.back())
189 eTdummyVec.push_back(tDummy);
190 eVecm[tDummy].push_back(0.);
193 eDiffCrossSection >> eDiffCrossSectionData[tDummy][eDummy];
195 if (eDummy != eVecm[tDummy].back()) eVecm[tDummy].push_back(eDummy);
199 #ifdef CHAMPION_VERBOSE
202 if (verboseLevel > 2)
204 G4cout <<
"Loaded cross section files for Champion Elastic model" <<
G4endl;
207 G4cout <<
"Champion Elastic model is initialized " <<
G4endl
222 isInitialised =
true;
240 #ifdef CHAMPION_VERBOSE
241 if (verboseLevel > 3)
243 G4cout <<
"Calling CrossSectionPerVolume() of G4DNAChampionElasticModel"
253 if(waterDensity!= 0.0)
262 #ifdef CHAMPION_VERBOSE
263 if (verboseLevel > 2)
265 G4cout <<
"__________________________________" <<
G4endl;
266 G4cout <<
"=== G4DNAChampionElasticModel - XS INFO START" <<
G4endl;
267 G4cout <<
"=== Kinetic energy(eV)=" << ekin/
eV <<
" particle : " << p->GetParticleName() <<
G4endl;
268 G4cout <<
"=== Cross section per water molecule (cm^2)=" << sigma/
cm/
cm <<
G4endl;
269 G4cout <<
"=== Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./
cm) << G4endl;
270 G4cout <<
"=== G4DNAChampionElasticModel - XS INFO END" <<
G4endl;
275 return sigma*waterDensity;
287 #ifdef CHAMPION_VERBOSE
288 if (verboseLevel > 3)
290 G4cout <<
"Calling SampleSecondaries() of G4DNAChampionElasticModel" <<
G4endl;
298 G4double cosTheta = RandomizeCosTheta(electronEnergy0);
306 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
308 xDir *= std::cos(phi);
309 yDir *= std::sin(phi);
311 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
322 G4double G4DNAChampionElasticModel::Theta(
340 std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
341 eTdummyVec.end(), k);
342 std::vector<double>::iterator t1 = t2 - 1;
344 std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),
347 std::vector<double>::iterator e11 = e12 - 1;
349 std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),
352 std::vector<double>::iterator e21 = e22 - 1;
361 xs11 = eDiffCrossSectionData[valueT1][valueE11];
362 xs12 = eDiffCrossSectionData[valueT1][valueE12];
363 xs21 = eDiffCrossSectionData[valueT2][valueE21];
364 xs22 = eDiffCrossSectionData[valueT2][valueE22];
367 if (xs11 == 0 && xs12 == 0 && xs21 == 0 && xs22 == 0)
return (0.);
369 theta = QuadInterpolator(valueE11, valueE12, valueE21, valueE22, xs11, xs12,
370 xs21, xs22, valueT1, valueT2, k, integrDiff);
399 G4double value = (d1 + (d2 -
d1) * (e - e1) / (e2 - e1));
411 G4double a = (std::log10(xs2) - std::log10(xs1))
412 / (std::log10(e2) - std::log10(e1));
413 G4double b = std::log10(xs2) - a * std::log10(e2);
414 G4double sigma = a * std::log10(e) + b;
415 G4double value = (std::pow(10., sigma));
448 G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
449 G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
450 G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1,
463 integrdiff = uniformRand;
470 cosTheta = std::cos(theta *
pi / 180);
480 errMsg <<
"The method G4DNAChampionElasticModel::SetKillBelowThreshold is deprecated";
482 G4Exception(
"G4DNAChampionElasticModel::SetKillBelowThreshold",
G4double LowEnergyLimit() const
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
G4double HighEnergyLimit() const
G4DNAChampionElasticModel(const G4ParticleDefinition *p=0, const G4String &nam="DNAChampionElasticModel")
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
void SetKillBelowThreshold(G4double threshold)
virtual G4bool LoadData(const G4String &argFileName)
virtual ~G4DNAChampionElasticModel()
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4String & GetParticleName() const
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax)
void SetHighEnergyLimit(G4double)
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value
const G4ThreeVector & GetMomentumDirection() const
static constexpr double cm
static constexpr double eV
virtual G4double FindValue(G4double e, G4int componentId=0) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static G4DNAMolecularMaterial * Instance()
Hep3Vector orthogonal() const
G4ParticleChangeForGamma * fParticleChangeForGamma
void SetProposedKineticEnergy(G4double proposedKinEnergy)
static constexpr double MeV
static constexpr double pi
Hep3Vector cross(const Hep3Vector &) const
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
void SetLowEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()