Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/cross_sections/src/G4GammaNuclearXS.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/cross_sections/src/G4GammaNuclearXS.cc (Version 11.3.0) and /processes/hadronic/cross_sections/src/G4GammaNuclearXS.cc (Version 11.2.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // -------------------------------------------     26 // -------------------------------------------------------------------
 27 //                                                 27 //
 28 // GEANT4 Class file                               28 // GEANT4 Class file
 29 //                                                 29 //
 30 //                                                 30 //
 31 // File name:    G4GammaNuclearXS                  31 // File name:    G4GammaNuclearXS
 32 //                                                 32 //
 33 // Authors  V.Ivantchenko, Geant4, 20 October      33 // Authors  V.Ivantchenko, Geant4, 20 October 2020
 34 //          B.Kutsenko, BINP/NSU, 10 August 20     34 //          B.Kutsenko, BINP/NSU, 10 August 2021
 35 //                                                 35 //
 36 // Modifications:                                  36 // Modifications:
 37 //                                                 37 //
 38                                                    38 
 39 #include "G4GammaNuclearXS.hh"                     39 #include "G4GammaNuclearXS.hh"
 40 #include "G4DynamicParticle.hh"                    40 #include "G4DynamicParticle.hh"
 41 #include "G4ThreeVector.hh"                        41 #include "G4ThreeVector.hh"
 42 #include "G4ElementTable.hh"                       42 #include "G4ElementTable.hh"
 43 #include "G4Material.hh"                           43 #include "G4Material.hh"
 44 #include "G4Element.hh"                            44 #include "G4Element.hh"
 45 #include "G4ElementData.hh"                        45 #include "G4ElementData.hh"
 46 #include "G4PhysicsVector.hh"                      46 #include "G4PhysicsVector.hh"
 47 #include "G4PhysicsLinearVector.hh"                47 #include "G4PhysicsLinearVector.hh"
 48 #include "G4PhysicsFreeVector.hh"                  48 #include "G4PhysicsFreeVector.hh"
 49 #include "G4CrossSectionDataSetRegistry.hh"        49 #include "G4CrossSectionDataSetRegistry.hh"
 50 #include "G4PhotoNuclearCrossSection.hh"           50 #include "G4PhotoNuclearCrossSection.hh"
 51 #include "G4HadronicParameters.hh"                 51 #include "G4HadronicParameters.hh"
 52 #include "Randomize.hh"                            52 #include "Randomize.hh"
 53 #include "G4SystemOfUnits.hh"                      53 #include "G4SystemOfUnits.hh"
 54 #include "G4Gamma.hh"                              54 #include "G4Gamma.hh"
 55 #include "G4IsotopeList.hh"                        55 #include "G4IsotopeList.hh"
 56 #include "G4AutoLock.hh"                           56 #include "G4AutoLock.hh"
 57                                                    57 
 58 #include <fstream>                                 58 #include <fstream>
 59 #include <sstream>                                 59 #include <sstream>
 60 #include <vector>                                  60 #include <vector>
 61                                                    61 
 62 G4ElementData* G4GammaNuclearXS::data = nullpt     62 G4ElementData* G4GammaNuclearXS::data = nullptr;
 63                                                    63 
 64 G4double G4GammaNuclearXS::coeff[3][3];            64 G4double G4GammaNuclearXS::coeff[3][3];
 65 G4double G4GammaNuclearXS::xs150[] = {0.0};        65 G4double G4GammaNuclearXS::xs150[] = {0.0};
                                                   >>  66 const G4double G4GammaNuclearXS::eTransitionBound = 150.*CLHEP::MeV; 
 66 const G4int G4GammaNuclearXS::freeVectorExcept     67 const G4int G4GammaNuclearXS::freeVectorException[] = {
 67 4, 6, 7, 8, 27, 39, 45, 65, 67, 69, 73};           68 4, 6, 7, 8, 27, 39, 45, 65, 67, 69, 73};
 68 G4String G4GammaNuclearXS::gDataDirectory = ""     69 G4String G4GammaNuclearXS::gDataDirectory = "";
 69                                                    70 
 70 namespace                                      << 
 71 {                                              << 
 72   // Upper limit of the linear transition betw << 
 73   const G4double eTransitionBound = 150.*CLHEP << 
 74   // A limit energy to correct CHIPS parameter << 
 75   const G4double ehigh = 10*CLHEP::GeV;        << 
 76 }                                              << 
 77                                                << 
 78 G4GammaNuclearXS::G4GammaNuclearXS()               71 G4GammaNuclearXS::G4GammaNuclearXS() 
 79   : G4VCrossSectionDataSet(Default_Name()), ga     72   : G4VCrossSectionDataSet(Default_Name()), gamma(G4Gamma::Gamma())
 80 {                                                  73 {
 81   verboseLevel = 0;                                74   verboseLevel = 0;
 82   if (verboseLevel > 0) {                          75   if (verboseLevel > 0) {
 83     G4cout << "G4GammaNuclearXS::G4GammaNuclea     76     G4cout << "G4GammaNuclearXS::G4GammaNuclearXS Initialise for Z < " 
 84      << MAXZGAMMAXS << G4endl;                     77      << MAXZGAMMAXS << G4endl;
 85   }                                                78   }
 86   ggXsection = dynamic_cast<G4PhotoNuclearCros <<  79   ggXsection =
 87     (G4CrossSectionDataSetRegistry::Instance() <<  80     G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet("PhotoNuclearXS");
 88   if (ggXsection == nullptr) {                 <<  81   if (ggXsection == nullptr)
 89     ggXsection = new G4PhotoNuclearCrossSectio     82     ggXsection = new G4PhotoNuclearCrossSection();
 90   }                                            << 
 91   SetForAllAtomsAndEnergies(true);                 83   SetForAllAtomsAndEnergies(true);
 92                                                    84 
 93   // full data set is uploaded once                85   // full data set is uploaded once
 94   if (nullptr == data) {                           86   if (nullptr == data) { 
 95     data = new G4ElementData(MAXZGAMMAXS);         87     data = new G4ElementData(MAXZGAMMAXS);
 96     data->SetName("gNuclear");                     88     data->SetName("gNuclear");
 97     for (G4int Z=1; Z<MAXZGAMMAXS; ++Z) {          89     for (G4int Z=1; Z<MAXZGAMMAXS; ++Z) {
 98       Initialise(Z);                               90       Initialise(Z);
 99     }                                              91     }
100   }                                                92   }
101 }                                                  93 }
102                                                    94 
103 void G4GammaNuclearXS::CrossSectionDescription     95 void G4GammaNuclearXS::CrossSectionDescription(std::ostream& outFile) const
104 {                                                  96 {
105   outFile << "G4GammaNuclearXS calculates the      97   outFile << "G4GammaNuclearXS calculates the gamma nuclear\n"
106           << "cross-section for GDR energy reg     98           << "cross-section for GDR energy region on nuclei using "
107     << "data from the high precision\n"            99     << "data from the high precision\n"
108           << "IAEA photonuclear database (2019    100           << "IAEA photonuclear database (2019). Then liniear connection\n"
109     << "implemented with previous CHIPS photon    101     << "implemented with previous CHIPS photonuclear model." << G4endl;
110 }                                                 102 }
111                                                   103 
112 G4bool                                            104 G4bool 
113 G4GammaNuclearXS::IsElementApplicable(const G4    105 G4GammaNuclearXS::IsElementApplicable(const G4DynamicParticle*, 
114                                       G4int, c    106                                       G4int, const G4Material*)
115 {                                                 107 {
116   return true;                                    108   return true;
117 }                                                 109 }
118                                                   110 
119 G4bool G4GammaNuclearXS::IsIsoApplicable(const    111 G4bool G4GammaNuclearXS::IsIsoApplicable(const G4DynamicParticle*,
120                                          G4int    112                                          G4int, G4int,
121                                          const    113                                          const G4Element*, const G4Material*)
122 {                                                 114 {
123   return true;                                    115   return true;
124 }                                                 116 }
125                                                   117 
126 G4double                                          118 G4double 
127 G4GammaNuclearXS::GetElementCrossSection(const    119 G4GammaNuclearXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
128                                          G4int << 120                                          G4int ZZ, const G4Material* mat)
129 {                                              << 
130   return ElementCrossSection(aParticle->GetKin << 
131 }                                              << 
132                                                << 
133 G4double                                       << 
134 G4GammaNuclearXS::ElementCrossSection(const G4 << 
135 {                                                 121 {
136   // check cache                                  122   // check cache
137   const G4int Z = (ZZ < MAXZGAMMAXS) ? ZZ : MA    123   const G4int Z = (ZZ < MAXZGAMMAXS) ? ZZ : MAXZGAMMAXS - 1;
                                                   >> 124   const G4double ekin = aParticle->GetKineticEnergy();
138   if(Z == fZ && ekin == fEkin) { return fXS; }    125   if(Z == fZ && ekin == fEkin) { return fXS; }
139   fZ = Z;                                         126   fZ = Z;
140   fEkin = ekin;                                   127   fEkin = ekin;
141                                                   128 
142   auto pv = data->GetElementData(Z);              129   auto pv = data->GetElementData(Z);
143   const G4double limCHIPS1 = 25*CLHEP::MeV;    << 130   if(pv == nullptr || 1 == Z) {
144   const G4double limCHIPS2 = 16*CLHEP::MeV;    << 131     fXS = ggXsection->GetElementCrossSection(aParticle, Z, mat);
145   if (pv == nullptr || 1 == Z || Z == 40 || Z  << 
146      (Z == 24 && ekin >= limCHIPS1) ||         << 
147      (Z == 39 && ekin >= limCHIPS1) ||         << 
148      (Z == 50 && ekin >= limCHIPS2) ||         << 
149      (Z == 64 && ekin >= limCHIPS2)            << 
150      ) {                                       << 
151     fXS = ggXsection->ComputeElementXSection(e << 
152     return fXS;                                   132     return fXS;
153   }                                               133   }
154   const G4double emax = pv->GetMaxEnergy();       134   const G4double emax = pv->GetMaxEnergy();
155                                                   135 
156   // low energy based on data                     136   // low energy based on data
157   if(ekin <= emax) {                              137   if(ekin <= emax) {
158     fXS = pv->Value(ekin);                        138     fXS = pv->Value(ekin);
159     // high energy CHIPS parameterisation         139     // high energy CHIPS parameterisation
160   } else if(ekin >= eTransitionBound) {           140   } else if(ekin >= eTransitionBound) {
161     fXS = ggXsection->ComputeElementXSection(e << 141     fXS = ggXsection->GetElementCrossSection(aParticle, Z, mat);
162     // linear interpolation                       142     // linear interpolation
163   } else {                                        143   } else {
164     const G4double rxs = xs150[Z];                144     const G4double rxs = xs150[Z];
165     const G4double lxs = pv->Value(emax);         145     const G4double lxs = pv->Value(emax);
166     fXS = lxs + (ekin - emax)*(rxs - lxs)/(eTr    146     fXS = lxs + (ekin - emax)*(rxs - lxs)/(eTransitionBound - emax);
167   }                                               147   }
168                                                   148 
169 #ifdef G4VERBOSE                                  149 #ifdef G4VERBOSE
170   if(verboseLevel > 1) {                          150   if(verboseLevel > 1) {
171     G4cout  << "Z= " << Z << " Ekin(MeV)= " <<    151     G4cout  << "Z= " << Z << " Ekin(MeV)= " << ekin/CLHEP::MeV 
172       << ",  nElmXS(b)= " << fXS/CLHEP::barn      152       << ",  nElmXS(b)= " << fXS/CLHEP::barn 
173       << G4endl;                                  153       << G4endl;
174   }                                               154   }
175 #endif                                            155 #endif
176   return fXS;                                     156   return fXS;
177 }                                                 157 }
178                                                   158 
                                                   >> 159 G4double G4GammaNuclearXS::ElementCrossSection(G4double ekin, G4int ZZ)
                                                   >> 160 {    
                                                   >> 161   G4DynamicParticle theGamma(gamma, G4ThreeVector(1,0,0), ekin);
                                                   >> 162   return GetElementCrossSection(&theGamma, ZZ);
                                                   >> 163 }
                                                   >> 164 
179 G4double G4GammaNuclearXS::LowEnergyCrossSecti    165 G4double G4GammaNuclearXS::LowEnergyCrossSection(G4double ekin, G4int ZZ)
180 {                                                 166 {    
181   const G4int Z = (ZZ < MAXZGAMMAXS) ? ZZ : MA    167   const G4int Z = (ZZ < MAXZGAMMAXS) ? ZZ : MAXZGAMMAXS - 1;
182   auto pv = data->GetElementData(Z);              168   auto pv = data->GetElementData(Z);
183   return pv->Value(ekin);                         169   return pv->Value(ekin);
184 }                                                 170 }
185                                                   171 
186 G4double G4GammaNuclearXS::GetIsoCrossSection( << 172 G4double 
187          const G4DynamicParticle* aParticle,   << 173 G4GammaNuclearXS::IsoCrossSection(G4double ekin, G4int Z, G4int A)
188    G4int Z, G4int A,                           << 
189    const G4Isotope*, const G4Element*, const G << 
190 {                                                 174 {
191   return IsoCrossSection(aParticle->GetKinetic << 175   G4DynamicParticle theGamma(gamma, G4ThreeVector(1,0,0), ekin);
                                                   >> 176   return GetIsoCrossSection(&theGamma, Z, A);
192 }                                                 177 }
193                                                   178 
194 G4double                                       << 179 G4double G4GammaNuclearXS::GetIsoCrossSection(
195 G4GammaNuclearXS::IsoCrossSection(const G4doub << 180          const G4DynamicParticle* aParticle,
                                                   >> 181    G4int ZZ, G4int A,
                                                   >> 182    const G4Isotope*, const G4Element*, const G4Material* mat)
196 {                                                 183 {
197   const G4int Z = (ZZ < MAXZGAMMAXS) ? ZZ : MA    184   const G4int Z = (ZZ < MAXZGAMMAXS) ? ZZ : MAXZGAMMAXS - 1;
198   // cross section per element                    185   // cross section per element
199   G4double xs = ElementCrossSection(ekin, Z);  << 186   G4double xs = GetElementCrossSection(aParticle, Z, mat);
                                                   >> 187   const G4double ekin = aParticle->GetKineticEnergy();
200                                                   188 
201   if (Z > 2) {                                    189   if (Z > 2) {
202     xs *= A/aeff[Z];                              190     xs *= A/aeff[Z];
203   } else {                                        191   } else {
204     G4int AA = A - amin[Z];                       192     G4int AA = A - amin[Z];
205     if(ekin >= ehigh && AA >=0 && AA <=2) {    << 193     if(ekin >= 10.*CLHEP::GeV && AA >=0 && AA <=2) { 
206       xs *= coeff[Z][AA];                         194       xs *= coeff[Z][AA];
207     } else {                                      195     } else {
208       xs = ggXsection->ComputeIsoXSection(ekin << 196       xs = ggXsection->GetIsoCrossSection(aParticle, Z, A);
209     }                                             197     }
210   }                                               198   }
211                                                   199 
212 #ifdef G4VERBOSE                                  200 #ifdef G4VERBOSE
213   if(verboseLevel > 1) {                          201   if(verboseLevel > 1) {
214     G4cout  << "G4GammaNuclearXS::IsoXS: Z= "     202     G4cout  << "G4GammaNuclearXS::IsoXS: Z= " << Z << " A= " << A 
215       << " Ekin(MeV)= " << ekin/CLHEP::MeV        203       << " Ekin(MeV)= " << ekin/CLHEP::MeV 
216       << ", ElmXS(b)= " << xs/CLHEP::barn << G    204       << ", ElmXS(b)= " << xs/CLHEP::barn << G4endl;
217   }                                               205   }
218 #endif                                            206 #endif
219   return xs;                                      207   return xs;
220 }                                                 208 }
221                                                   209 
222 const G4Isotope* G4GammaNuclearXS::SelectIsoto    210 const G4Isotope* G4GammaNuclearXS::SelectIsotope(
223        const G4Element* anElement, G4double ki    211        const G4Element* anElement, G4double kinEnergy, G4double)
224 {                                                 212 {
225   std::size_t nIso = anElement->GetNumberOfIso    213   std::size_t nIso = anElement->GetNumberOfIsotopes();
226   const G4Isotope* iso = anElement->GetIsotope    214   const G4Isotope* iso = anElement->GetIsotope(0);
227                                                   215 
228   if(1 == nIso) { return iso; }                   216   if(1 == nIso) { return iso; }
229                                                   217 
230   const G4double* abundVector = anElement->Get    218   const G4double* abundVector = anElement->GetRelativeAbundanceVector();
231   G4double sum = 0.0;                             219   G4double sum = 0.0;
232   G4int Z = anElement->GetZasInt();               220   G4int Z = anElement->GetZasInt();
233                                                   221 
234   // use isotope cross sections                   222   // use isotope cross sections
235   std::size_t nn = temp.size();                   223   std::size_t nn = temp.size();
236   if(nn < nIso) { temp.resize(nIso, 0.); }        224   if(nn < nIso) { temp.resize(nIso, 0.); }
237                                                   225   
238   for (std::size_t j=0; j<nIso; ++j) {            226   for (std::size_t j=0; j<nIso; ++j) {
239     //G4cout << j << "-th isotope " << (*isoVe    227     //G4cout << j << "-th isotope " << (*isoVector)[j]->GetN() 
240     //       <<  " abund= " << abundVector[j]     228     //       <<  " abund= " << abundVector[j] << G4endl;
241     sum += abundVector[j]*                        229     sum += abundVector[j]*
242       IsoCrossSection(kinEnergy, Z, anElement-    230       IsoCrossSection(kinEnergy, Z, anElement->GetIsotope((G4int)j)->GetN());
243     temp[j] = sum;                                231     temp[j] = sum;
244   }                                               232   }
245   sum *= G4UniformRand();                         233   sum *= G4UniformRand();
246   for (std::size_t j = 0; j<nIso; ++j) {          234   for (std::size_t j = 0; j<nIso; ++j) {
247     if(temp[j] >= sum) {                          235     if(temp[j] >= sum) {
248       iso = anElement->GetIsotope((G4int)j);      236       iso = anElement->GetIsotope((G4int)j);
249       break;                                      237       break;
250     }                                             238     }
251   }                                               239   }
252   return iso;                                     240   return iso;
253 }                                                 241 }
254                                                   242 
255 void G4GammaNuclearXS::BuildPhysicsTable(const    243 void G4GammaNuclearXS::BuildPhysicsTable(const G4ParticleDefinition& p)
256 {                                                 244 {
257   if(verboseLevel > 1) {                          245   if(verboseLevel > 1) {
258     G4cout << "G4GammaNuclearXS::BuildPhysicsT    246     G4cout << "G4GammaNuclearXS::BuildPhysicsTable for " 
259      << p.GetParticleName() << G4endl;            247      << p.GetParticleName() << G4endl;
260   }                                               248   }
261   if(p.GetParticleName() != "gamma") {            249   if(p.GetParticleName() != "gamma") { 
262     G4ExceptionDescription ed;                    250     G4ExceptionDescription ed;
263     ed << p.GetParticleName() << " is a wrong     251     ed << p.GetParticleName() << " is a wrong particle type -"
264        << " only gamma is allowed";               252        << " only gamma is allowed";
265     G4Exception("G4GammaNuclearXS::BuildPhysic    253     G4Exception("G4GammaNuclearXS::BuildPhysicsTable(..)","had012",
266     FatalException, ed, "");                      254     FatalException, ed, "");
267     return;                                       255     return; 
268   }                                               256   }
269                                                   257 
270   // prepare isotope selection                    258   // prepare isotope selection
271   const G4ElementTable* table = G4Element::Get    259   const G4ElementTable* table = G4Element::GetElementTable();
272   std::size_t nIso = temp.size();                 260   std::size_t nIso = temp.size();
273   for (auto const & elm : *table ) {           << 261   for ( auto & elm : *table ) {
274     std::size_t n = elm->GetNumberOfIsotopes()    262     std::size_t n = elm->GetNumberOfIsotopes();
275     if (n > nIso) { nIso = n; }                   263     if (n > nIso) { nIso = n; }
276   }                                               264   }
277   temp.resize(nIso, 0.0);                         265   temp.resize(nIso, 0.0);   
278 }                                                 266 }
279                                                   267 
280 const G4String& G4GammaNuclearXS::FindDirector    268 const G4String& G4GammaNuclearXS::FindDirectoryPath()
281 {                                                 269 {
282   // build the complete string identifying the    270   // build the complete string identifying the file with the data set
283   if(gDataDirectory.empty()) {                    271   if(gDataDirectory.empty()) {
284     std::ostringstream ost;                       272     std::ostringstream ost;
285     ost << G4HadronicParameters::Instance()->G    273     ost << G4HadronicParameters::Instance()->GetDirPARTICLEXS() << "/gamma/inel";
286     gDataDirectory = ost.str();                   274     gDataDirectory = ost.str();
287   }                                               275   }
288   return gDataDirectory;                          276   return gDataDirectory;
289 }                                                 277 }
290                                                   278 
291 void G4GammaNuclearXS::Initialise(G4int Z)        279 void G4GammaNuclearXS::Initialise(G4int Z)
292 {                                                 280 {
293   // upload data from file                        281   // upload data from file
294   std::ostringstream ost;                         282   std::ostringstream ost;
295   ost << FindDirectoryPath() << Z ;               283   ost << FindDirectoryPath() << Z ;
296   G4PhysicsVector* v = RetrieveVector(ost, tru    284   G4PhysicsVector* v = RetrieveVector(ost, true, Z);
297                                                   285   
298   data->InitialiseForElement(Z, v);               286   data->InitialiseForElement(Z, v);
299   /*                                              287   /*
300   G4cout << "G4GammaNuclearXS::Initialise for     288   G4cout << "G4GammaNuclearXS::Initialise for Z= " << Z 
301    << " A= " << Amean << "  Amin= " << amin[Z]    289    << " A= " << Amean << "  Amin= " << amin[Z] 
302    << "  Amax= " << amax[Z] << G4endl;            290    << "  Amax= " << amax[Z] << G4endl;
303   */                                              291   */
304   xs150[Z] = ggXsection->ComputeElementXSectio << 292   G4DynamicParticle theGamma(gamma, G4ThreeVector(1,0,0), eTransitionBound);
                                                   >> 293   xs150[Z] = ggXsection->GetElementCrossSection(&theGamma, Z, 0);
305                                                   294 
306   // compute corrections for low Z data           295   // compute corrections for low Z data
307   if(Z <= 2){                                     296   if(Z <= 2){
                                                   >> 297     theGamma.SetKineticEnergy(10*CLHEP::GeV);
308     if(amax[Z] > amin[Z]) {                       298     if(amax[Z] > amin[Z]) {
309       for(G4int A=amin[Z]; A<=amax[Z]; ++A) {     299       for(G4int A=amin[Z]; A<=amax[Z]; ++A) {
310         G4int AA = A - amin[Z];                   300         G4int AA = A - amin[Z];
311   if(AA >= 0 && AA <= 2) {                        301   if(AA >= 0 && AA <= 2) {
312     G4double sig1 = ggXsection->ComputeIsoXSec << 302     G4double sig1 = ggXsection->GetIsoCrossSection(&theGamma, Z, A);
313     G4double sig2 = ggXsection->ComputeElement << 303     G4double sig2 = ggXsection->GetElementCrossSection(&theGamma, Z, 0);
314     if(sig2 > 0.) { coeff[Z][AA] = (sig1/sig2)    304     if(sig2 > 0.) { coeff[Z][AA] = (sig1/sig2); }
315     else { coeff[Z][AA] = 1.; }                   305     else { coeff[Z][AA] = 1.; }
316   }                                               306   }
317       }                                           307       }
318     }                                             308     }
319   }                                               309   }
320 }                                                 310 }
321                                                   311 
322 G4PhysicsVector*                                  312 G4PhysicsVector* 
323 G4GammaNuclearXS::RetrieveVector(std::ostrings    313 G4GammaNuclearXS::RetrieveVector(std::ostringstream& ost, G4bool warn, G4int Z)
324 {                                                 314 {
325   G4PhysicsVector* v = nullptr;                   315   G4PhysicsVector* v = nullptr;
326                                                   316 
327   std::ifstream filein(ost.str().c_str());        317   std::ifstream filein(ost.str().c_str());
328   if (!filein.is_open()) {                        318   if (!filein.is_open()) {
329     if(warn) {                                    319     if(warn) {
330       G4ExceptionDescription ed;                  320       G4ExceptionDescription ed;
331       ed << "Data file <" << ost.str().c_str()    321       ed << "Data file <" << ost.str().c_str()
332    << "> is not opened!";                         322    << "> is not opened!";
333       G4Exception("G4GammaNuclearXS::RetrieveV    323       G4Exception("G4GammaNuclearXS::RetrieveVector(..)","had014",
334       FatalException, ed, "Check G4PARTICLEXSD    324       FatalException, ed, "Check G4PARTICLEXSDATA");
335     }                                             325     }
336   } else {                                        326   } else {
337     if(verboseLevel > 1) {                        327     if(verboseLevel > 1) {
338       G4cout << "File " << ost.str()              328       G4cout << "File " << ost.str() 
339        << " is opened by G4GammaNuclearXS" <<     329        << " is opened by G4GammaNuclearXS" << G4endl;
340     }                                             330     }
341     // retrieve data from DB                      331     // retrieve data from DB
342     if(std::find(std::begin(freeVectorExceptio    332     if(std::find(std::begin(freeVectorException), std::end(freeVectorException), Z)
343        == std::end(freeVectorException)) {        333        == std::end(freeVectorException)) {
344       v = new G4PhysicsLinearVector(false);       334       v = new G4PhysicsLinearVector(false);
345     } else {                                      335     } else {
346       v = new G4PhysicsFreeVector(false);         336       v = new G4PhysicsFreeVector(false);
347     }                                             337     }
348     if(!v->Retrieve(filein, true)) {              338     if(!v->Retrieve(filein, true)) {
349       G4ExceptionDescription ed;                  339       G4ExceptionDescription ed;
350       ed << "Data file <" << ost.str().c_str()    340       ed << "Data file <" << ost.str().c_str()
351    << "> is not retrieved!";                      341    << "> is not retrieved!";
352       G4Exception("G4GammaNuclearXS::RetrieveV    342       G4Exception("G4GammaNuclearXS::RetrieveVector(..)","had015",
353       FatalException, ed, "Check G4PARTICLEXSD    343       FatalException, ed, "Check G4PARTICLEXSDATA");
354     }                                             344     }
355   }                                               345   }
356   return v;                                       346   return v;
357 }                                                 347 }
358                                                   348 
359                                                   349