62 :
G4VEmModel(nam),fAtomDeexcitation(0),isInitialised(false)
 
   76     G4cout << 
"MicroElec inelastic model is constructed " << 
G4endl;
 
   90   std::map< G4String,G4MicroElecCrossSectionDataSet*,std::less<G4String> >::iterator pos;
 
   91   for (pos = tableData.begin(); pos != tableData.end(); ++pos)
 
  110   if (verboseLevel > 3)
 
  111     G4cout << 
"Calling G4MicroElecInelasticModel::Initialise()" << 
G4endl;
 
  115   G4String fileElectron(
"microelec/sigma_inelastic_e_Si");
 
  116   G4String fileProton(
"microelec/sigma_inelastic_p_Si");
 
  126   char *path = getenv(
"G4LEDATA");
 
  145     std::ostringstream eFullFileName;
 
  146     eFullFileName << path << 
"/microelec/sigmadiff_inelastic_e_Si.dat";
 
  147     std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
 
  149     if (!eDiffCrossSection)
 
  151             G4Exception(
"G4MicroElecInelasticModel::Initialise",
"em0003",
FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
 
  154     eTdummyVec.push_back(0.);
 
  155     while(!eDiffCrossSection.eof())
 
  159       eDiffCrossSection>>tDummy>>eDummy;
 
  160       if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
 
  161       for (
int j=0; j<6; j++)
 
  163         eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy];
 
  166         if (!eDiffCrossSection.eof()) eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
 
  168         eVecm[tDummy].push_back(eDummy);
 
  178     tableFile[
proton] = fileProton;
 
  188     tableData[
proton] = tableP;
 
  192     std::ostringstream pFullFileName;
 
  193     pFullFileName << path << 
"/microelec/sigmadiff_inelastic_p_Si.dat";
 
  194     std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
 
  196     if (!pDiffCrossSection)
 
  198             G4Exception(
"G4MicroElecInelasticModel::Initialise",
"em0003",
FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
 
  201     pTdummyVec.push_back(0.);
 
  202     while(!pDiffCrossSection.eof())
 
  206       pDiffCrossSection>>tDummy>>eDummy;
 
  207       if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy);
 
  208       for (
int j=0; j<6; j++)
 
  210         pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy];
 
  213         if (!pDiffCrossSection.eof()) pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
 
  215         pVecm[tDummy].push_back(eDummy); 
 
  220   if (particle==electronDef) 
 
  226   if (particle==protonDef) 
 
  234     G4cout << 
"MicroElec Inelastic model is initialized " << G4endl
 
  248   if (isInitialised) { 
return; }
 
  250   isInitialised = 
true;
 
  262   if (verboseLevel > 3)
 
  263     G4cout << 
"Calling CrossSectionPerVolume() of G4MicroElecInelasticModel" << 
G4endl;
 
  295     if (verboseLevel > 3) 
 
  296     G4cout << 
"Before scaling : " << G4endl
 
  297     << 
"Particle : " << nameLocal << 
", mass : " << Mion_c2/
proton_mass_c2 << 
"*mp, charge " << Zeff 
 
  298     << 
", Ekin (eV) = " << ekin/
eV << 
G4endl ;
 
  301     nameLocal = 
"proton" ;
 
  303     if (verboseLevel > 3) 
 
  304     G4cout << 
"After scaling : " << G4endl
 
  305      << 
"Particle : " << nameLocal  << 
", Ekin (eV) = " << ekin/
eV << 
G4endl ;
 
  311     std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
 
  312     pos1 = lowEnergyLimit.find(nameLocal);
 
  313     if (pos1 != lowEnergyLimit.end())
 
  315       lowLim = pos1->second;
 
  318     std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
 
  319     pos2 = highEnergyLimit.find(nameLocal);
 
  320     if (pos2 != highEnergyLimit.end())
 
  322       highLim = pos2->second;
 
  325     if (ekin >= lowLim && ekin < highLim)
 
  327       std::map< G4String,G4MicroElecCrossSectionDataSet*,std::less<G4String> >::iterator pos;
 
  328       pos = tableData.find(nameLocal);
 
  330       if (pos != tableData.end())
 
  340     G4Exception(
"G4MicroElecInelasticModel::CrossSectionPerVolume",
"em0002",
FatalException,
"Model not applicable to particle type.");
 
  352     if (verboseLevel > 3)
 
  355       G4cout << 
" - Cross section per Si atom (cm^2)=" << sigma*Zeff2/
cm2 << 
G4endl;
 
  356       G4cout << 
" - Cross section per Si atom (cm^-1)=" << sigma*density*Zeff2/(1./
cm) << G4endl;
 
  360  return sigma*density*Zeff2;
 
  374   if (verboseLevel > 3)
 
  375     G4cout << 
"Calling SampleSecondaries() of G4MicroElecInelasticModel" << 
G4endl;
 
  385   G4String nameLocal2 = particleName ;
 
  392     nameLocal2 = 
"proton" ;
 
  395   std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
 
  396   pos1 = lowEnergyLimit.find(nameLocal2);
 
  398   if (pos1 != lowEnergyLimit.end())
 
  400     lowLim = pos1->second;
 
  403   std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
 
  404   pos2 = highEnergyLimit.find(nameLocal2);
 
  406   if (pos2 != highEnergyLimit.end())
 
  408     highLim = pos2->second;
 
  411   if (k >= lowLim && k < highLim)
 
  414     G4double totalEnergy = ekin + particleMass;
 
  415     G4double pSquare = ekin * (totalEnergy + particleMass);
 
  416     G4double totalMomentum = std::sqrt(pSquare);
 
  418     G4int Shell = RandomSelect(k,nameLocal2);
 
  420     if (verboseLevel > 3)
 
  423     G4cout << 
"Shell: " << Shell << 
", energy: " << bindingEnergy/
eV << 
G4endl;
 
  428     G4int secNumberInit = 0;  
 
  429     G4int secNumberFinal = 0; 
 
  431     if(fAtomDeexcitation && Shell > 2) {
 
  445       secNumberInit = fvect->size();
 
  447       secNumberFinal = fvect->size();
 
  450     G4double secondaryKinetic = RandomizeEjectedElectronEnergy(PartDef,k,Shell);
 
  452     if (verboseLevel > 3)
 
  455     G4cout << 
"Shell: " << Shell << 
" Kin. energy (eV)=" << k/
eV  
  456     << 
" Sec. energy (eV)=" << secondaryKinetic/
eV << 
G4endl;
 
  461     RandomizeEjectedElectronDirection(PartDef, k, secondaryKinetic, cosTheta, phi);
 
  463     G4double sinTheta = std::sqrt(1.-cosTheta*cosTheta);
 
  464     G4double dirX = sinTheta*std::cos(phi);
 
  465     G4double dirY = sinTheta*std::sin(phi);
 
  468     deltaDirection.
rotateUz(primaryDirection);
 
  474       G4double finalPx = totalMomentum*primaryDirection.
x() - deltaTotalMomentum*deltaDirection.
x();
 
  475       G4double finalPy = totalMomentum*primaryDirection.
y() - deltaTotalMomentum*deltaDirection.
y();
 
  476       G4double finalPz = totalMomentum*primaryDirection.
z() - deltaTotalMomentum*deltaDirection.
z();
 
  477       G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
 
  478       finalPx /= finalMomentum;
 
  479       finalPy /= finalMomentum;
 
  480       finalPz /= finalMomentum;
 
  483       direction.
set(finalPx,finalPy,finalPz);
 
  491     for (
G4int j=secNumberInit; j < secNumberFinal; j++) {
 
  492       deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();} 
 
  498     fvect->push_back(dp);
 
  512     if ((k+SiStructure.
Energy(shell))/2. > k) maximumEnergyTransfer=k;
 
  513     else maximumEnergyTransfer = (k+SiStructure.
Energy(shell))/2.;
 
  518     G4double maxEnergy = maximumEnergyTransfer;
 
  519     G4int nEnergySteps = 100;
 
  522     G4double stpEnergy(std::pow(maxEnergy/
value, 1./static_cast<G4double>(nEnergySteps-1)));
 
  523     G4int step(nEnergySteps);
 
  528       if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
 
  533     G4double secondaryElectronKineticEnergy=0.;
 
  536       secondaryElectronKineticEnergy = 
G4UniformRand() * (maximumEnergyTransfer-SiStructure.
Energy(shell));
 
  540     return secondaryElectronKineticEnergy;
 
  550     G4double maxEnergy = maximumEnergyTransfer; 
 
  551     G4int nEnergySteps = 100;
 
  554     G4double stpEnergy(std::pow(maxEnergy/
value, 1./static_cast<G4double>(nEnergySteps-1)));
 
  555     G4int step(nEnergySteps);
 
  560       if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
 
  563     G4double secondaryElectronKineticEnergy = 0.;
 
  566       secondaryElectronKineticEnergy = 
G4UniformRand() * (maximumEnergyTransfer-SiStructure.
Energy(shell));
 
  570     return secondaryElectronKineticEnergy;
 
  578 void G4MicroElecInelasticModel::RandomizeEjectedElectronDirection(
G4ParticleDefinition* particleDefinition, 
 
  588     cosTheta = std::sqrt(1.-sin2O);
 
  595     cosTheta = std::sqrt(secKinetic / maxSecKinetic);
 
  602     cosTheta = std::sqrt(secKinetic / maxSecKinetic);
 
  615   if (energyTransfer >= SiStructure.
Energy(LevelIndex))
 
  633       std::vector<double>::iterator 
t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
 
  634       std::vector<double>::iterator 
t1 = t2-1;
 
  636       if (energyTransfer <= eVecm[(*t1)].back() && energyTransfer <= eVecm[(*t2)].back() )
 
  638         std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer);
 
  639         std::vector<double>::iterator e11 = e12-1;
 
  641         std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer);
 
  642         std::vector<double>::iterator e21 = e22-1;
 
  651         xs11 = eDiffCrossSectionData[LevelIndex][valueT1][valueE11];
 
  652         xs12 = eDiffCrossSectionData[LevelIndex][valueT1][valueE12];
 
  653         xs21 = eDiffCrossSectionData[LevelIndex][valueT2][valueE21];
 
  654         xs22 = eDiffCrossSectionData[LevelIndex][valueT2][valueE22];
 
  662       std::vector<double>::iterator 
t2 = std::upper_bound(pTdummyVec.begin(),pTdummyVec.end(), k);
 
  663       std::vector<double>::iterator 
t1 = t2-1;
 
  664       if (energyTransfer <= pVecm[(*t1)].back() && energyTransfer <= pVecm[(*t2)].back() )
 
  666         std::vector<double>::iterator e12 = std::upper_bound(pVecm[(*t1)].begin(),pVecm[(*t1)].end(), energyTransfer);
 
  667         std::vector<double>::iterator e11 = e12-1;
 
  669         std::vector<double>::iterator e22 = std::upper_bound(pVecm[(*t2)].begin(),pVecm[(*t2)].end(), energyTransfer);
 
  670         std::vector<double>::iterator e21 = e22-1;
 
  679         xs11 = pDiffCrossSectionData[LevelIndex][valueT1][valueE11]; 
 
  680         xs12 = pDiffCrossSectionData[LevelIndex][valueT1][valueE12];
 
  681         xs21 = pDiffCrossSectionData[LevelIndex][valueT2][valueE21];
 
  682         xs22 = pDiffCrossSectionData[LevelIndex][valueT2][valueE22];
 
  686    G4double xsProduct = xs11 * xs12 * xs21 * xs22;
 
  689      sigma = QuadInterpolator(     valueE11, valueE12, 
 
  710   G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
 
  711   G4double b = std::log10(xs2) - a*std::log10(e2);
 
  726   G4double interpolatedvalue1 = LogLogInterpolate(e11, e12, e, xs11, xs12);
 
  727   G4double interpolatedvalue2 = LogLogInterpolate(e21, e22, e, xs21, xs22);
 
  728   G4double value = LogLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
 
  738   std::map< G4String,G4MicroElecCrossSectionDataSet*,std::less<G4String> >::iterator 
pos;
 
  739   pos = tableData.find(particle);
 
  741   if (pos != tableData.end())
 
  756     value += valuesBuffer[i];
 
  767     if (valuesBuffer[i] > value)
 
  769           delete[] valuesBuffer;
 
  772     value -= valuesBuffer[i];
 
  775       if (valuesBuffer) 
delete[] valuesBuffer;
 
void set(double x, double y, double z)
 
static G4Electron * ElectronDefinition()
 
G4double LowEnergyLimit() const 
 
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax)
 
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
 
virtual const G4VEMDataSet * GetComponent(G4int componentId) const 
 
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
 
static G4LossTableManager * Instance()
 
G4double GetKineticEnergy() const 
 
G4double HighEnergyLimit() const 
 
G4MicroElecInelasticModel(const G4ParticleDefinition *p=0, const G4String &nam="MicroElecInelasticModel")
 
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
 
static G4Proton * ProtonDefinition()
 
virtual ~G4MicroElecInelasticModel()
 
G4ParticleDefinition * GetDefinition() const 
 
double DifferentialCrossSection(G4ParticleDefinition *aParticleDefinition, G4double k, G4double energyTransfer, G4int shell)
 
static G4NistManager * Instance()
 
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
 
const G4String & GetParticleName() const 
 
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
 
G4double Energy(G4int level)
 
void SetHighEnergyLimit(G4double)
 
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
 
G4GLOB_DLL std::ostream G4cout
 
virtual size_t NumberOfComponents(void) const 
 
const G4ThreeVector & GetMomentumDirection() const 
 
Hep3Vector & rotateUz(const Hep3Vector &)
 
G4ParticleChangeForGamma * fParticleChangeForGamma
 
virtual G4double FindValue(G4double e, G4int componentId=0) const 
 
virtual G4bool LoadData(const G4String &argFileName)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
G4double EffectiveCharge(const G4ParticleDefinition *p, const G4Material *material, G4double kineticEnergy)
 
G4double GetTotNbOfAtomsPerVolume() const 
 
G4double GetPDGMass() const 
 
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
 
const G4Material * GetBaseMaterial() const 
 
const XML_Char int const XML_Char * value
 
static G4Electron * Electron()
 
void SetProposedKineticEnergy(G4double proposedKinEnergy)
 
G4VAtomDeexcitation * AtomDeexcitation()
 
void SetLowEnergyLimit(G4double)
 
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
 
void SetDeexcitationFlag(G4bool val)
 
G4double GetPDGCharge() const 
 
G4double bindingEnergy(G4int A, G4int Z)
 
G4ParticleChangeForGamma * GetParticleChangeForGamma()