68   :
G4VEmModel(nam),fParticleChange(0),fParticle(0),
    69    isInitialised(false),fAtomDeexcitation(0),logAtomicShellXS(0),fLocalTable(false)
   100       std::map <G4int,G4PhysicsTable*>::iterator i;
   120     G4cout << 
"Calling  G4PenelopePhotoElectricModel::Initialise()" << 
G4endl;
   127       G4cout << 
"WARNING from G4PenelopePhotoElectricModel " << 
G4endl;
   128       G4cout << 
"Atomic de-excitation module is not instantiated, so there will not be ";
   130       G4cout << 
"Please make sure this is intended" << 
G4endl;
   154           G4int iZ = (
G4int) theElementVector->at(j)->GetZ();
   165     G4cout << 
"Penelope Photo-Electric model v2008 is initialized " << G4endl
   182     G4cout << 
"Calling  G4PenelopePhotoElectricModel::InitialiseLocal()" << 
G4endl;
   218     G4cout << 
"Calling ComputeCrossSectionPerAtom() of G4PenelopePhotoElectricModel" << 
G4endl;
   241       ed << 
"Unable to retrieve the shell cross section table for Z=" << iZ << 
G4endl;
   242       ed << 
"This can happen only in Unit Tests or via G4EmCalculator" << 
G4endl;
   243       G4Exception(
"G4PenelopePhotoElectricModel::ComputeCrossSectionPerAtom()",
   247       G4AutoLock lock(&PenelopePhotoElectricModelMutex);
   260        G4Exception(
"G4PenelopePhotoElectricModel::ComputeCrossSectionPerAtom()",
   262            "Unable to retrieve the total cross section table");
   267    cross = 
G4Exp(logXS);
   270     G4cout << 
"Photoelectric cross section at " << energy/
MeV << 
" MeV for Z=" << Z <<
   298     G4cout << 
"Calling SamplingSecondaries() of G4PenelopePhotoElectricModel" << 
G4endl;
   334     G4cout << 
"Selected shell " << shellIndex << 
" of element " << anElement->
GetName() << 
G4endl;
   345   size_t numberOfShells = (size_t) transitionManager->
NumberOfShells(Z);
   346   if (shellIndex >= numberOfShells)
   347     shellIndex = numberOfShells-1;
   359     bindingEnergy = 0.*
eV;
   366   G4double eKineticEnergy = photonEnergy - bindingEnergy;
   370   if (eKineticEnergy > 0.)
   375       G4double sinTheta = std::sqrt(1-cosTheta*cosTheta);
   377       G4double dirx = sinTheta * std::cos(phi);
   378       G4double diry = sinTheta * std::sin(phi);
   381       electronDirection.
rotateUz(photonDirection);
   385       fvect->push_back(electron);
   388     bindingEnergy = photonEnergy;
   402       size_t nBefore = fvect->size();
   404       size_t nAfter = fvect->size();
   406       if (nAfter > nBefore) 
   408           for (
size_t j=nBefore;j<nAfter;j++) 
   410           G4double itsEnergy = ((*fvect)[j])->GetKineticEnergy();
   411           bindingEnergy -= itsEnergy;
   413             energyInFluorescence += itsEnergy;
   415             energyInAuger += itsEnergy;
   422   localEnergyDeposit += bindingEnergy;
   424   if (localEnergyDeposit < 0)
   427          << 
"G4PenelopePhotoElectricModel::SampleSecondaries() - Negative energy deposit"   429       localEnergyDeposit = 0;
   436       G4cout << 
"-----------------------------------------------------------" << 
G4endl;
   437       G4cout << 
"Energy balance from G4PenelopePhotoElectric" << 
G4endl;
   440       G4cout << 
"Incoming photon energy: " << photonEnergy/
keV << 
" keV" << 
G4endl;
   441       G4cout << 
"-----------------------------------------------------------" << 
G4endl;
   443     G4cout << 
"Outgoing electron " << eKineticEnergy/
keV << 
" keV" << 
G4endl;
   444       if (energyInFluorescence)
   445     G4cout << 
"Fluorescence x-rays: " << energyInFluorescence/
keV << 
" keV" << 
G4endl;
   447     G4cout << 
"Auger electrons: " << energyInAuger/
keV << 
" keV" << 
G4endl;
   448       G4cout << 
"Local energy deposit " << localEnergyDeposit/
keV << 
" keV" << 
G4endl;
   449       G4cout << 
"Total final state: " <<
   450     (eKineticEnergy+energyInFluorescence+localEnergyDeposit+energyInAuger)/
keV <<
   452       G4cout << 
"-----------------------------------------------------------" << 
G4endl;
   457     std::fabs(eKineticEnergy+energyInFluorescence+localEnergyDeposit+energyInAuger-photonEnergy);
   458       if (energyDiff > 0.05*
keV)
   460       G4cout << 
"Warning from G4PenelopePhotoElectric: problem with energy conservation: " <<
   461         (eKineticEnergy+energyInFluorescence+localEnergyDeposit+energyInAuger)/
keV   462          << 
" keV (final) vs. " <<
   463         photonEnergy/
keV << 
" keV (initial)" << G4endl;
   464       G4cout << 
"-----------------------------------------------------------" << 
G4endl;
   465       G4cout << 
"Energy balance from G4PenelopePhotoElectric" << 
G4endl;
   468       G4cout << 
"Incoming photon energy: " << photonEnergy/
keV << 
" keV" << 
G4endl;
   469       G4cout << 
"-----------------------------------------------------------" << 
G4endl;
   471         G4cout << 
"Outgoing electron " << eKineticEnergy/
keV << 
" keV" << 
G4endl;
   472       if (energyInFluorescence)
   473         G4cout << 
"Fluorescence x-rays: " << energyInFluorescence/
keV << 
" keV" << 
G4endl;
   475         G4cout << 
"Auger electrons: " << energyInAuger/
keV << 
" keV" << 
G4endl;
   476       G4cout << 
"Local energy deposit " << localEnergyDeposit/
keV << 
" keV" << 
G4endl;
   477       G4cout << 
"Total final state: " <<
   478         (eKineticEnergy+energyInFluorescence+localEnergyDeposit+energyInAuger)/
keV <<
   480       G4cout << 
"-----------------------------------------------------------" << 
G4endl;
   490   if (energy>1*
GeV) 
return costheta;
   497   G4double beta = std::sqrt((gamma2-1.0)/gamma2);
   502   G4double a1 = 0.5*beta*gamma*(gamma-1.0)*(gamma-2.0);
   514     tsam = 2.0*ac * (2.0*rand + a2*std::sqrt(rand)) / (a2*a2 - 4.0*rand);
   515     gtr = (2.0 - tsam) * (a1 + 1.0/(ac+tsam));
   529     G4Exception(
"G4PenelopePhotoElectricModel::ReadDataFile()",
   534       G4cout << 
"G4PenelopePhotoElectricModel::ReadDataFile()" << 
G4endl;
   535       G4cout << 
"Going to read PhotoElectric data files for Z=" << Z << 
G4endl;
   538   char* path = getenv(
"G4LEDATA");
   541       G4String excep = 
"G4PenelopePhotoElectricModel - G4LEDATA environment variable not set!";
   542       G4Exception(
"G4PenelopePhotoElectricModel::ReadDataFile()",
   550   std::ostringstream ost;
   552     ost << path << 
"/penelope/photoelectric/pdgph" << Z << 
".p08";
   554     ost << path << 
"/penelope/photoelectric/pdgph0" << Z << 
".p08";
   555   std::ifstream 
file(ost.str().c_str());
   558       G4String excep = 
"G4PenelopePhotoElectricModel - data file " + 
G4String(ost.str()) + 
" not found!";
   559       G4Exception(
"G4PenelopePhotoElectricModel::ReadDataFile()",
   566   while( getline(
file, line) )
   573   file.open(ost.str().c_str());
   577   file >> readZ >> nShells;
   580     G4cout << 
"Element Z=" << Z << 
" , nShells = " << nShells << 
G4endl;
   583   if (readZ != Z || nShells <= 0 || nShells > 50) 
   586       ed << 
"Corrupted data file for Z=" << Z << 
G4endl;
   587       G4Exception(
"G4PenelopePhotoElectricModel::ReadDataFile()",
   599   for (
size_t i=0;i<nShells+1;i++)
   603   for (k=0;k<ndata && !
file.eof();k++)
   611       for (
size_t i=0;i<nShells+1;i++)
   616       if (aValue < 1
e-40*
cm2) 
   618       theVec->
PutValue(k,logene,std::log(aValue));
   624       G4cout << 
"G4PenelopePhotoElectricModel: read " << k << 
" points for element Z = "   640     G4Exception(
"G4PenelopePhotoElectricModel::GetNumberOfShellXS()",
   650        ed << 
"Cannot find shell cross section data for Z=" << Z << 
G4endl;
   651        G4Exception(
"G4PenelopePhotoElectricModel::GetNumberOfShellXS()",
   666   if (shellID >= entries)
   668       G4cout << 
"Element Z=" << Z << 
" has data for " << entries << 
" shells only" << 
G4endl;
   669       G4cout << 
"so shellID should be from 0 to " << entries-1 << 
G4endl;
   679        G4Exception(
"G4PenelopePhotoElectricModel::GetShellCrossSection()",
   681            "Unable to retrieve the total cross section table");
   687    if (cross < 2
e-40*
cm2) cross = 0;
   698   else if (shellID == 1)
   700   else if (shellID == 2)
   702   else if (shellID == 3)
   704   else if (shellID == 4)
   706   else if (shellID == 5)
   708   else if (shellID == 6)
   710   else if (shellID == 7)
   712   else if (shellID == 8)
   731   G4double logEnergy = std::log(energy);
   737        ed << 
"Cannot find shell cross section data for Z=" << Z << 
G4endl;
   738        G4Exception(
"G4PenelopePhotoElectricModel::SelectRandomShell()",
   760   for (
size_t k=1;k<theTable->
entries();k++)
 
G4double LowEnergyLimit() const
 
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
 
static G4LossTableManager * Instance()
 
std::vector< G4Element * > G4ElementVector
 
void PutValue(size_t binNumber, G4double binValue, G4double dataValue)
 
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
 
std::ostringstream G4ExceptionDescription
 
const G4Material * GetMaterial() const
 
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
 
virtual void SampleSecondaries(std::vector< G4DynamicParticle *> *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
 
G4ParticleChangeForGamma * fParticleChange
 
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
 
G4double GetShellCrossSection(G4int Z, size_t shellID, G4double energy)
 
void push_back(G4PhysicsVector *)
 
static G4Electron * Definition()
 
void SetElementSelectors(std::vector< G4EmElementSelector *> *)
 
G4PenelopePhotoElectricModel(const G4ParticleDefinition *p=0, const G4String &processName="PenPhotoElec")
 
std::map< G4int, G4PhysicsTable * > * logAtomicShellXS
 
const G4AtomicTransitionManager * fTransitionManager
 
#define G4MUTEX_INITIALIZER
 
G4double fIntrinsicLowEnergyLimit
 
void SetHighEnergyLimit(G4double)
 
G4double GetKineticEnergy() const
 
G4GLOB_DLL std::ostream G4cout
 
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
 
G4double HighEnergyLimit() const
 
std::ostream & tab(std::ostream &)
 
Hep3Vector & rotateUz(const Hep3Vector &)
 
static const double twopi
 
void ReadDataFile(G4int Z)
 
G4double Value(G4double theEnergy, size_t &lastidx) const
 
std::vector< G4EmElementSelector * > * GetElementSelectors()
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
G4double G4Exp(G4double initial_x)
Exponential Function double precision. 
 
const G4String & GetName() const
 
static G4ProductionCutsTable * GetProductionCutsTable()
 
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
 
virtual ~G4PenelopePhotoElectricModel()
 
const G4ThreeVector & GetMomentumDirection() const
 
G4VAtomDeexcitation * fAtomDeexcitation
 
void GenerateParticles(std::vector< G4DynamicParticle *> *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
 
size_t GetNumberOfElements() const
 
void SetParticle(const G4ParticleDefinition *)
 
const G4ParticleDefinition * fParticle
 
size_t GetTableSize() const
 
size_t SelectRandomShell(G4int Z, G4double energy)
 
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
 
static G4Electron * Electron()
 
G4VAtomDeexcitation * AtomDeexcitation()
 
const G4ElementVector * GetElementVector() const
 
size_t GetNumberOfShellXS(G4int)
 
G4double BindingEnergy() const
 
void SetDeexcitationFlag(G4bool val)
 
G4double fIntrinsicHighEnergyLimit
 
const G4String & GetName() const
 
G4int NumberOfShells(G4int Z) const
 
static G4AtomicTransitionManager * Instance()
 
G4double SampleElectronDirection(G4double energy)
 
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4ParticleChangeForGamma * GetParticleChangeForGamma()
 
static G4Gamma * Definition()
 
static G4Gamma * GammaDefinition()
 
G4String WriteTargetShell(size_t shellID)