54 :
G4VEmModel(nam),fParticleChange(0),logAtomicCrossSection(0),
55 fEffectiveCharge(0),fMaterialInvScreeningRadius(0),
56 fScreeningFunction(0),isInitialised(false)
59 fIntrinsicHighEnergyLimit = 100.0*
GeV;
60 fSmallEnergy = 1.1*
MeV;
61 InitializeScreeningRadii();
79 std::map <G4int,G4PhysicsFreeVector*>::iterator i;
80 if (logAtomicCrossSection)
82 for (i=logAtomicCrossSection->begin();i != logAtomicCrossSection->end();i++)
83 if (i->second)
delete i->second;
84 delete logAtomicCrossSection;
87 delete fEffectiveCharge;
88 if (fMaterialInvScreeningRadius)
89 delete fMaterialInvScreeningRadius;
90 if (fScreeningFunction)
91 delete fScreeningFunction;
100 if (verboseLevel > 3)
101 G4cout <<
"Calling G4PenelopeGammaConversionModel::Initialise()" <<
G4endl;
104 if (!logAtomicCrossSection)
105 logAtomicCrossSection =
new std::map<G4int,G4PhysicsFreeVector*>;
108 if (fEffectiveCharge)
110 delete fEffectiveCharge;
111 fEffectiveCharge = 0;
113 if (fMaterialInvScreeningRadius)
115 delete fMaterialInvScreeningRadius;
116 fMaterialInvScreeningRadius = 0;
118 if (fScreeningFunction)
120 delete fScreeningFunction;
121 fScreeningFunction = 0;
124 fEffectiveCharge =
new std::map<const G4Material*,G4double>;
125 fMaterialInvScreeningRadius =
new std::map<const G4Material*,G4double>;
126 fScreeningFunction =
new std::map<const G4Material*,std::pair<G4double,G4double> >;
128 if (verboseLevel > 0) {
129 G4cout <<
"Penelope Gamma Conversion model v2008 is initialized " << G4endl
136 if(isInitialised)
return;
138 isInitialised =
true;
156 if (energy < fIntrinsicLowEnergyLimit)
162 if (!logAtomicCrossSection->count(iZ))
165 if (!logAtomicCrossSection->count(iZ))
168 ed <<
"Unable to retrieve cross section table for Z=" << iZ <<
G4endl;
169 G4Exception(
"G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom()",
178 cs = std::exp(logXS);
180 if (verboseLevel > 2)
181 G4cout <<
"Gamma conversion cross section at " << energy/
MeV <<
" MeV for Z=" << Z <<
207 if (verboseLevel > 3)
208 G4cout <<
"Calling SamplingSecondaries() of G4PenelopeGammaConversionModel" <<
G4endl;
216 if (photonEnergy <= fIntrinsicLowEnergyLimit)
226 if (!fEffectiveCharge->count(mat))
227 InitializeScreeningFunctions(mat);
228 if (!fEffectiveCharge->count(mat))
231 ed <<
"Unable to allocate the EffectiveCharge data for " <<
233 G4Exception(
"G4PenelopeGammaConversion::SampleSecondaries()",
242 if (photonEnergy < fSmallEnergy)
247 G4double effC = fEffectiveCharge->find(mat)->second;
250 G4double F00=(-1.774-1.210e1*alz+1.118e1*alz*alz)*T
251 +(8.523+7.326e1*alz-4.441e1*alz*alz)*T*T
252 -(1.352e1+1.211e2*alz-9.641e1*alz*alz)*T*T*T
253 +(8.946+6.205e1*alz-6.341e1*alz*alz)*T*T*T*T;
255 G4double F0b = fScreeningFunction->find(mat)->second.second;
257 G4double invRad = fMaterialInvScreeningRadius->find(mat)->second;
259 std::pair<G4double,G4double> scree = GetScreeningFunctions(bmin);
276 eps = 0.5-xr*std::pow(std::abs(ru2m1),1./3.);
278 eps = 0.5+xr*std::pow(ru2m1,1./3.);
279 G4double B = eki/(invRad*eps*(1.0-eps));
280 scree = GetScreeningFunctions(B);
282 g1 = std::max(g1+g0,0.);
289 G4double B = eki/(invRad*eps*(1.0-eps));
290 scree = GetScreeningFunctions(B);
292 g2 = std::max(g2+g0,0.);
299 if (verboseLevel > 4)
302 G4double electronTotEnergy = eps*photonEnergy;
303 G4double positronTotEnergy = (1.0-eps)*photonEnergy;
311 costheta_el = (costheta_el*electronTotEnergy+kk)/(electronTotEnergy+costheta_el*kk);
313 G4double dirX_el = std::sqrt(1.-costheta_el*costheta_el) * std::cos(phi_el);
314 G4double dirY_el = std::sqrt(1.-costheta_el*costheta_el) * std::sin(phi_el);
320 kk = std::sqrt(positronKineEnergy*(positronKineEnergy+2.*
electron_mass_c2));
321 costheta_po = (costheta_po*positronTotEnergy+kk)/(positronTotEnergy+costheta_po*kk);
323 G4double dirX_po = std::sqrt(1.-costheta_po*costheta_po) * std::cos(phi_po);
324 G4double dirY_po = std::sqrt(1.-costheta_po*costheta_po) * std::sin(phi_po);
332 if (electronKineEnergy > 0.0)
334 G4ThreeVector electronDirection ( dirX_el, dirY_el, dirZ_el);
335 electronDirection.
rotateUz(photonDirection);
339 fvect->push_back(electron);
343 localEnergyDeposit += electronKineEnergy;
344 electronKineEnergy = 0;
349 if (positronKineEnergy < 0.0)
351 localEnergyDeposit += positronKineEnergy;
352 positronKineEnergy = 0;
355 positronDirection.
rotateUz(photonDirection);
357 positronDirection, positronKineEnergy);
358 fvect->push_back(positron);
363 if (verboseLevel > 1)
365 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
366 G4cout <<
"Energy balance from G4PenelopeGammaConversion" <<
G4endl;
367 G4cout <<
"Incoming photon energy: " << photonEnergy/
keV <<
" keV" <<
G4endl;
368 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
369 if (electronKineEnergy)
370 G4cout <<
"Electron (explicitely produced) " << electronKineEnergy/
keV <<
" keV"
372 if (positronKineEnergy)
373 G4cout <<
"Positron (not at rest) " << positronKineEnergy/
keV <<
" keV" <<
G4endl;
375 if (localEnergyDeposit)
376 G4cout <<
"Local energy deposit " << localEnergyDeposit/
keV <<
" keV" <<
G4endl;
377 G4cout <<
"Total final state: " << (electronKineEnergy+positronKineEnergy+
380 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
382 if (verboseLevel > 0)
384 G4double energyDiff = std::fabs(electronKineEnergy+positronKineEnergy+
386 if (energyDiff > 0.05*
keV)
387 G4cout <<
"Warning from G4PenelopeGammaConversion: problem with energy conservation: "
388 << (electronKineEnergy+positronKineEnergy+
390 <<
" keV (final) vs. " << photonEnergy/
keV <<
" keV (initial)" << G4endl;
396 void G4PenelopeGammaConversionModel::ReadDataFile(
const G4int Z)
398 if (verboseLevel > 2)
400 G4cout <<
"G4PenelopeGammaConversionModel::ReadDataFile()" <<
G4endl;
401 G4cout <<
"Going to read Gamma Conversion data files for Z=" << Z <<
G4endl;
404 char* path = getenv(
"G4LEDATA");
408 "G4PenelopeGammaConversionModel - G4LEDATA environment variable not set!";
409 G4Exception(
"G4PenelopeGammaConversionModel::ReadDataFile()",
417 std::ostringstream ost;
419 ost << path <<
"/penelope/pairproduction/pdgpp" << Z <<
".p08";
421 ost << path <<
"/penelope/pairproduction/pdgpp0" << Z <<
".p08";
422 std::ifstream
file(ost.str().c_str());
425 G4String excep =
"G4PenelopeGammaConversionModel - data file " +
426 G4String(ost.str()) +
" not found!";
427 G4Exception(
"G4PenelopeGammaConversionModel::ReadDataFile()",
435 while( getline(
file, line) )
442 file.open(ost.str().c_str());
446 if (verboseLevel > 3)
453 ed <<
"Corrupted data file for Z=" << Z <<
G4endl;
454 G4Exception(
"G4PenelopeGammaConversionModel::ReadDataFile()",
460 for (
size_t i=0;i<ndata;i++)
468 theVec->
PutValue(i,std::log(ene),std::log(xs));
472 if (!logAtomicCrossSection)
475 ed <<
"Problem with allocation of logAtomicCrossSection data table " <<
G4endl;
476 G4Exception(
"G4PenelopeGammaConversionModel::ReadDataFile()",
481 logAtomicCrossSection->insert(std::make_pair(Z,theVec));
489 void G4PenelopeGammaConversionModel::InitializeScreeningRadii()
491 G4double temp[99] = {1.2281e+02,7.3167e+01,6.9228e+01,6.7301e+01,6.4696e+01,
492 6.1228e+01,5.7524e+01,5.4033e+01,5.0787e+01,4.7851e+01,4.6373e+01,
493 4.5401e+01,4.4503e+01,4.3815e+01,4.3074e+01,4.2321e+01,4.1586e+01,
494 4.0953e+01,4.0524e+01,4.0256e+01,3.9756e+01,3.9144e+01,3.8462e+01,
495 3.7778e+01,3.7174e+01,3.6663e+01,3.5986e+01,3.5317e+01,3.4688e+01,
496 3.4197e+01,3.3786e+01,3.3422e+01,3.3068e+01,3.2740e+01,3.2438e+01,
497 3.2143e+01,3.1884e+01,3.1622e+01,3.1438e+01,3.1142e+01,3.0950e+01,
498 3.0758e+01,3.0561e+01,3.0285e+01,3.0097e+01,2.9832e+01,2.9581e+01,
499 2.9411e+01,2.9247e+01,2.9085e+01,2.8930e+01,2.8721e+01,2.8580e+01,
500 2.8442e+01,2.8312e+01,2.8139e+01,2.7973e+01,2.7819e+01,2.7675e+01,
501 2.7496e+01,2.7285e+01,2.7093e+01,2.6911e+01,2.6705e+01,2.6516e+01,
502 2.6304e+01,2.6108e+01,2.5929e+01,2.5730e+01,2.5577e+01,2.5403e+01,
503 2.5245e+01,2.5100e+01,2.4941e+01,2.4790e+01,2.4655e+01,2.4506e+01,
504 2.4391e+01,2.4262e+01,2.4145e+01,2.4039e+01,2.3922e+01,2.3813e+01,
505 2.3712e+01,2.3621e+01,2.3523e+01,2.3430e+01,2.3331e+01,2.3238e+01,
506 2.3139e+01,2.3048e+01,2.2967e+01,2.2833e+01,2.2694e+01,2.2624e+01,
507 2.2545e+01,2.2446e+01,2.2358e+01,2.2264e+01};
510 for (
G4int i=0;i<99;i++)
511 fAtomicScreeningRadius[i] = temp[i];
516 void G4PenelopeGammaConversionModel::InitializeScreeningFunctions(
const G4Material*
material)
530 zeff = (*elementVector)[0]->GetZ();
538 for (
G4int i=0;i<nElements;i++)
540 G4double Zelement = (*elementVector)[i]->GetZ();
541 G4double Aelement = (*elementVector)[i]->GetAtomicMassAmu();
542 atot += Aelement*fractionVector[i];
543 zeff += Zelement*Aelement*fractionVector[i];
548 intZ = (
G4int) (zeff+0.25);
555 if (fEffectiveCharge)
556 fEffectiveCharge->insert(std::make_pair(material,zeff));
563 G4double fc = alzSquared*(0.202059-alzSquared*
565 (0.00835-alzSquared*(0.00201-alzSquared*
567 (0.00012-alzSquared*0.00003)))))
568 +1.0/(alzSquared+1.0));
572 G4double matRadius = 2.0/ fAtomicScreeningRadius[intZ-1];
573 if (fMaterialInvScreeningRadius)
574 fMaterialInvScreeningRadius->insert(std::make_pair(material,matRadius));
576 std::pair<G4double,G4double> myPair(0,0);
577 G4double f0a = 4.0*std::log(fAtomicScreeningRadius[intZ-1]);
582 if (fScreeningFunction)
583 fScreeningFunction->insert(std::make_pair(material,myPair));
585 if (verboseLevel > 2)
587 G4cout <<
"Average Z for material " << material->
GetName() <<
" = " <<
589 G4cout <<
"Effective radius for material " << material->
GetName() <<
" = " <<
590 fAtomicScreeningRadius[intZ-1] <<
" m_e*c/hbar --> BCB = " <<
592 G4cout <<
"Screening parameters F0 for material " << material->
GetName() <<
" = " <<
593 f0a <<
"," << f0b <<
G4endl;
600 std::pair<G4double,G4double>
601 G4PenelopeGammaConversionModel::GetScreeningFunctions(
G4double B)
608 std::pair<G4double,G4double> result(0.,0.);
616 G4double a0 = 4.0*B*std::atan(1./B);
618 f2 += 2.0*BSquared*(4.0-a0-3.0*std::log((1.0+BSquared)/BSquared));