Skip to content
Snippets Groups Projects
Commit e310f219 authored by adrien-matta's avatar adrien-matta
Browse files

* Smarter Generation of the EDE tables

parent a0f17b90
No related branches found
No related tags found
No related merge requests found
...@@ -618,9 +618,19 @@ void Target::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4doub ...@@ -618,9 +618,19 @@ void Target::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4doub
<< "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_TargetMaterial->GetName() << endl ; << "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_TargetMaterial->GetName() << endl ;
G4EmCalculator emCalculator; G4EmCalculator emCalculator;
// Tipical Range needed, if Emax is larger, then adapted
if(Emax < 25000) Emax = 25000;
for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/1000.){ double step = 1*keV;
double before = 0 ;
for (G4double E=Emin; E < Emax; E+=step){
G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_TargetMaterial); G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_TargetMaterial);
if(before){
if(abs(before-dedx)/abs(before)<0.01) step*=10;
}
before = dedx;
File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ;
} }
...@@ -632,12 +642,19 @@ void Target::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4doub ...@@ -632,12 +642,19 @@ void Target::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4doub
File << "Table from Geant4 generate using NPSimulation \t " File << "Table from Geant4 generate using NPSimulation \t "
<< "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_WindowsMaterial->GetName() << endl ; << "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_WindowsMaterial->GetName() << endl ;
for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/10.){ step = 1*keV;
// G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_WindowsMaterial); before = 0 ;
G4double dedx = emCalculator.ComputeDEDX( E, Particle , for (G4double E=Emin; E < Emax; E+=step){
"ionIoni", m_WindowsMaterial); G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle,m_WindowsMaterial);
if(before){
if(abs(before-dedx)/abs(before)<0.01) step*=10;
}
before = dedx;
File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ;
} }
} }
File.close(); File.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment