Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/eRosita/physics/src/G4RDeIonisationParameters.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 /examples/advanced/eRosita/physics/src/G4RDeIonisationParameters.cc (Version 11.3.0) and /examples/advanced/eRosita/physics/src/G4RDeIonisationParameters.cc (Version 9.6.p3)


  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 // $Id$
                                                   >>  28 // GEANT4 tag $Name: geant4-09-01-ref-00 $
 27 //                                                 29 //
 28 // Author: Maria Grazia Pia (Maria.Grazia.Pia@     30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
 29 //                                                 31 //
 30 // History:                                        32 // History:
 31 // -----------                                     33 // -----------
 32 // 31 Jul 2001   MGP        Created, with dumm     34 // 31 Jul 2001   MGP        Created, with dummy implementation
 33 // 12.09.01 V.Ivanchenko    Add param and inte     35 // 12.09.01 V.Ivanchenko    Add param and interpolation of parameters
 34 // 04.10.01 V.Ivanchenko    Add BindingEnergy      36 // 04.10.01 V.Ivanchenko    Add BindingEnergy method
 35 // 25.10.01 MGP             Many bug fixes, mo     37 // 25.10.01 MGP             Many bug fixes, mostly related to the
 36 //                          management of poin     38 //                          management of pointers
 37 // 29.11.01 V.Ivanchenko    New parametrisatio     39 // 29.11.01 V.Ivanchenko    New parametrisation + Excitation
 38 // 30.05.02 V.Ivanchenko    Format and names o     40 // 30.05.02 V.Ivanchenko    Format and names of the data files were
 39 //                          chenged to "ion-..     41 //                          chenged to "ion-..."
 40 // 17.02.04 V.Ivanchenko    Increase buffer si     42 // 17.02.04 V.Ivanchenko    Increase buffer size
 41 //                                                 43 //
 42 // -------------------------------------------     44 // -------------------------------------------------------------------
 43                                                    45 
 44 #include <fstream>                                 46 #include <fstream>
 45 #include <sstream>                                 47 #include <sstream>
 46                                                    48 
 47 #include "G4RDeIonisationParameters.hh"            49 #include "G4RDeIonisationParameters.hh"
 48 #include "G4RDVEMDataSet.hh"                       50 #include "G4RDVEMDataSet.hh"
 49 #include "G4RDShellEMDataSet.hh"                   51 #include "G4RDShellEMDataSet.hh"
 50 #include "G4RDEMDataSet.hh"                        52 #include "G4RDEMDataSet.hh"
 51 #include "G4RDCompositeEMDataSet.hh"               53 #include "G4RDCompositeEMDataSet.hh"
 52 #include "G4RDLinInterpolation.hh"                 54 #include "G4RDLinInterpolation.hh"
 53 #include "G4RDLogLogInterpolation.hh"              55 #include "G4RDLogLogInterpolation.hh"
 54 #include "G4RDLinLogLogInterpolation.hh"           56 #include "G4RDLinLogLogInterpolation.hh"
 55 #include "G4RDSemiLogInterpolation.hh"             57 #include "G4RDSemiLogInterpolation.hh"
 56 #include "G4SystemOfUnits.hh"                      58 #include "G4SystemOfUnits.hh"
 57 #include "G4Material.hh"                           59 #include "G4Material.hh"
 58 #include "G4DataVector.hh"                         60 #include "G4DataVector.hh"
 59                                                    61 
 60 G4RDeIonisationParameters:: G4RDeIonisationPar     62 G4RDeIonisationParameters:: G4RDeIonisationParameters(G4int minZ, G4int maxZ)
 61   : zMin(minZ), zMax(maxZ),                        63   : zMin(minZ), zMax(maxZ),
 62   length(24)                                       64   length(24)
 63 {                                                  65 {
 64   LoadData();                                      66   LoadData();
 65 }                                                  67 }
 66                                                    68 
 67                                                    69 
 68 G4RDeIonisationParameters::~G4RDeIonisationPar     70 G4RDeIonisationParameters::~G4RDeIonisationParameters()
 69 {                                                  71 { 
 70   // Reset the map of data sets: remove the da     72   // Reset the map of data sets: remove the data sets from the map 
 71   std::map<G4int,G4RDVEMDataSet*,std::less<G4i     73   std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::iterator pos;
 72                                                    74 
 73   for (pos = param.begin(); pos != param.end()     75   for (pos = param.begin(); pos != param.end(); ++pos)
 74     {                                              76     {
 75       G4RDVEMDataSet* dataSet = (*pos).second;     77       G4RDVEMDataSet* dataSet = (*pos).second;
 76       delete dataSet;                              78       delete dataSet;
 77     }                                              79     }
 78                                                    80 
 79   for (pos = excit.begin(); pos != excit.end()     81   for (pos = excit.begin(); pos != excit.end(); ++pos)
 80     {                                              82     {
 81       G4RDVEMDataSet* dataSet = (*pos).second;     83       G4RDVEMDataSet* dataSet = (*pos).second;
 82       delete dataSet;                              84       delete dataSet;
 83     }                                              85     }
 84                                                    86 
 85   activeZ.clear();                                 87   activeZ.clear();
 86 }                                                  88 }
 87                                                    89 
 88                                                    90 
 89 G4double G4RDeIonisationParameters::Parameter(     91 G4double G4RDeIonisationParameters::Parameter(G4int Z, G4int shellIndex, 
 90                                                    92                                                      G4int parameterIndex, 
 91                                                    93                                                      G4double e) const
 92 {                                                  94 {
 93   G4double value = 0.;                             95   G4double value = 0.;
 94   G4int id = Z*100 + parameterIndex;               96   G4int id = Z*100 + parameterIndex;
 95   std::map<G4int,G4RDVEMDataSet*,std::less<G4i     97   std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator pos;
 96                                                    98 
 97   pos = param.find(id);                            99   pos = param.find(id);
 98   if (pos!= param.end()) {                        100   if (pos!= param.end()) {
 99     G4RDVEMDataSet* dataSet = (*pos).second;      101     G4RDVEMDataSet* dataSet = (*pos).second;
100     G4int nShells = dataSet->NumberOfComponent    102     G4int nShells = dataSet->NumberOfComponents();
101                                                   103 
102     if(shellIndex < nShells) {                    104     if(shellIndex < nShells) { 
103       const G4RDVEMDataSet* component = dataSe    105       const G4RDVEMDataSet* component = dataSet->GetComponent(shellIndex);
104       const G4DataVector ener = component->Get    106       const G4DataVector ener = component->GetEnergies(0);
105       G4double ee = std::max(ener.front(),std:    107       G4double ee = std::max(ener.front(),std::min(ener.back(),e));
106       value = component->FindValue(ee);           108       value = component->FindValue(ee);
107     } else {                                      109     } else {
108       G4cout << "WARNING: G4IonisationParamete    110       G4cout << "WARNING: G4IonisationParameters::FindParameter "
109              << "has no parameters for shell=     111              << "has no parameters for shell= " << shellIndex 
110              << "; Z= " << Z                      112              << "; Z= " << Z
111              << G4endl;                           113              << G4endl;
112     }                                             114     }
113   } else {                                        115   } else {
114     G4cout << "WARNING: G4IonisationParameters    116     G4cout << "WARNING: G4IonisationParameters::Parameter "
115            << "did not find ID = "                117            << "did not find ID = "
116            << shellIndex << G4endl;               118            << shellIndex << G4endl;
117   }                                               119   }
118                                                   120 
119   return value;                                   121   return value;
120 }                                                 122 }
121                                                   123 
122 G4double G4RDeIonisationParameters::Excitation    124 G4double G4RDeIonisationParameters::Excitation(G4int Z, G4double e) const
123 {                                                 125 {
124   G4double value = 0.;                            126   G4double value = 0.;
125   std::map<G4int,G4RDVEMDataSet*,std::less<G4i    127   std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator pos;
126                                                   128 
127   pos = excit.find(Z);                            129   pos = excit.find(Z);
128   if (pos!= excit.end()) {                        130   if (pos!= excit.end()) {
129     G4RDVEMDataSet* dataSet = (*pos).second;      131     G4RDVEMDataSet* dataSet = (*pos).second;
130                                                   132 
131     const G4DataVector ener = dataSet->GetEner    133     const G4DataVector ener = dataSet->GetEnergies(0);
132     G4double ee = std::max(ener.front(),std::m    134     G4double ee = std::max(ener.front(),std::min(ener.back(),e));
133     value = dataSet->FindValue(ee);               135     value = dataSet->FindValue(ee);
134   } else {                                        136   } else {
135     G4cout << "WARNING: G4IonisationParameters    137     G4cout << "WARNING: G4IonisationParameters::Excitation "
136            << "did not find ID = "                138            << "did not find ID = "
137            << Z << G4endl;                        139            << Z << G4endl;
138   }                                               140   }
139                                                   141 
140   return value;                                   142   return value;
141 }                                                 143 }
142                                                   144 
143                                                   145 
144 void G4RDeIonisationParameters::LoadData()        146 void G4RDeIonisationParameters::LoadData()
145 {                                                 147 {
146   // ---------------------------------------      148   // ---------------------------------------
147   // Please document what are the parameters      149   // Please document what are the parameters 
148   // ---------------------------------------      150   // ---------------------------------------
149                                                   151 
150   // define active elements                       152   // define active elements
151                                                   153 
152   const G4MaterialTable* materialTable = G4Mat    154   const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
153   if (materialTable == 0)                         155   if (materialTable == 0)
154      G4Exception("G4RDeIonisationParameters::L    156      G4Exception("G4RDeIonisationParameters::LoadData()", "InvalidSetup",
155                  FatalException, "No MaterialT    157                  FatalException, "No MaterialTable found!");
156                                                   158 
157   G4int nMaterials = G4Material::GetNumberOfMa    159   G4int nMaterials = G4Material::GetNumberOfMaterials();
158                                                   160   
159   for (G4int m=0; m<nMaterials; m++) {            161   for (G4int m=0; m<nMaterials; m++) {
160                                                   162 
161     const G4Material* material= (*materialTabl    163     const G4Material* material= (*materialTable)[m];        
162     const G4ElementVector* elementVector = mat    164     const G4ElementVector* elementVector = material->GetElementVector();
163     const size_t nElements = material->GetNumb    165     const size_t nElements = material->GetNumberOfElements();
164                                                   166       
165     for (size_t iEl=0; iEl<nElements; iEl++) {    167     for (size_t iEl=0; iEl<nElements; iEl++) {
166       G4Element* element = (*elementVector)[iE    168       G4Element* element = (*elementVector)[iEl];
167       G4double Z = element->GetZ();               169       G4double Z = element->GetZ();
168       if (!(activeZ.contains(Z))) {               170       if (!(activeZ.contains(Z))) {
169   activeZ.push_back(Z);                           171   activeZ.push_back(Z);
170       }                                           172       }
171     }                                             173     }
172   }                                               174   }
173                                                   175   
174   const char* path = G4FindDataDir("G4LEDATA") << 176   char* path = getenv("G4LEDATA");
175   if (!path)                                      177   if (!path)
176     {                                             178     { 
177       G4String excep("G4LEDATA environment var    179       G4String excep("G4LEDATA environment variable not set!");
178       G4Exception("G4RDeIonisationParameters::    180       G4Exception("G4RDeIonisationParameters::LoadData()", "InvalidSetup",
179                   FatalException, excep);         181                   FatalException, excep);
180     }                                             182     }
181                                                   183     
182   G4String pathString(path);                      184   G4String pathString(path);
183   G4String path2("/ioni/ion-sp-");                185   G4String path2("/ioni/ion-sp-");
184   pathString += path2;                            186   pathString += path2;  
185                                                   187   
186   G4double energy, sum;                           188   G4double energy, sum;
187                                                   189   
188   size_t nZ = activeZ.size();                     190   size_t nZ = activeZ.size();
189                                                   191   
190   for (size_t i=0; i<nZ; i++) {                   192   for (size_t i=0; i<nZ; i++) {
191                                                   193     
192     G4int Z = (G4int)activeZ[i];                  194     G4int Z = (G4int)activeZ[i];
193     std::ostringstream ost;                       195     std::ostringstream ost;
194     ost << pathString << Z << ".dat";             196     ost << pathString << Z << ".dat";
195     G4String name(ost.str());                     197     G4String name(ost.str());
196                                                   198 
197     std::ifstream file(name);                     199     std::ifstream file(name);
198     std::filebuf* lsdp = file.rdbuf();            200     std::filebuf* lsdp = file.rdbuf();
199                                                   201 
200     if (! (lsdp->is_open()) ) {                   202     if (! (lsdp->is_open()) ) {
201       G4String excep = G4String("Data file: ")    203       G4String excep = G4String("Data file: ")
202       + name + G4String(" not found. The versi    204       + name + G4String(" not found. The version 1.# of G4LEDATA should be used");
203       G4Exception("G4RDeIonisationParameters::    205       G4Exception("G4RDeIonisationParameters::LoadData()", "DataNotFound",
204                   FatalException, excep);         206                   FatalException, excep);
205     }                                             207     }
206                                                   208 
207     // The file is organized into:                209     // The file is organized into:
208     // For each shell there are two lines:        210     // For each shell there are two lines:
209     //    1st line:                               211     //    1st line:
210     // 1st column is the energy of incident e-    212     // 1st column is the energy of incident e-,
211     // 2d  column is the parameter of screan t    213     // 2d  column is the parameter of screan term;
212     //    2d line:                                214     //    2d line:
213     // 3 energy (MeV) subdividing different ap    215     // 3 energy (MeV) subdividing different approximation area of the spectrum
214     // 20 point on the spectrum                   216     // 20 point on the spectrum
215     // The shell terminates with the pattern:     217     // The shell terminates with the pattern: -1   -1
216     // The file terminates with the pattern: -    218     // The file terminates with the pattern: -2   -2
217                                                   219 
218     std::vector<G4RDVEMDataSet*> p;               220     std::vector<G4RDVEMDataSet*> p;
219     for (size_t k=0; k<length; k++)               221     for (size_t k=0; k<length; k++) 
220       {                                           222       {
221   G4RDVDataSetAlgorithm* inter = new G4RDLinLo    223   G4RDVDataSetAlgorithm* inter = new G4RDLinLogLogInterpolation();
222   G4RDVEMDataSet* composite = new G4RDComposit    224   G4RDVEMDataSet* composite = new G4RDCompositeEMDataSet(inter,1.,1.);
223   p.push_back(composite);                         225   p.push_back(composite);
224       }                                           226       }
225                                                   227 
226     G4int shell = 0;                              228     G4int shell = 0;
227     std::vector<G4DataVector*> a;                 229     std::vector<G4DataVector*> a;
228     for (size_t j=0; j<length; j++)               230     for (size_t j=0; j<length; j++) 
229       {                                           231       {
230   G4DataVector* aa = new G4DataVector();          232   G4DataVector* aa = new G4DataVector();
231   a.push_back(aa);                                233   a.push_back(aa);
232       }                                           234       } 
233     G4DataVector e;                               235     G4DataVector e;
234     e.clear();                                    236     e.clear();
235     do {                                          237     do {
236       file >> energy >> sum;                      238       file >> energy >> sum;
237       if (energy == -2) break;                    239       if (energy == -2) break;
238                                                   240 
239       if (energy >  -1) {                         241       if (energy >  -1) {
240         e.push_back(energy);                      242         e.push_back(energy);
241         a[0]->push_back(sum);                     243         a[0]->push_back(sum);
242         for (size_t j=0; j<length-1; j++) {       244         for (size_t j=0; j<length-1; j++) {
243     G4double qRead;                               245     G4double qRead;
244     file >> qRead;                                246     file >> qRead;
245     a[j + 1]->push_back(qRead);                   247     a[j + 1]->push_back(qRead);
246   }                                               248   }    
247                                                   249 
248       } else {                                    250       } else {
249                                                   251 
250         // End of set for a shell, fill the ma    252         // End of set for a shell, fill the map
251   for (size_t k=0; k<length; k++) {               253   for (size_t k=0; k<length; k++) {
252                                                   254 
253           G4RDVDataSetAlgorithm* interp;          255           G4RDVDataSetAlgorithm* interp;
254           if(0 == k) interp  = new G4RDLinLogL    256           if(0 == k) interp  = new G4RDLinLogLogInterpolation();
255           else       interp  = new G4RDLogLogI    257           else       interp  = new G4RDLogLogInterpolation();
256                                                   258 
257     G4DataVector* eVector = new G4DataVector;     259     G4DataVector* eVector = new G4DataVector;
258     size_t eSize = e.size();                      260     size_t eSize = e.size();
259     for (size_t s=0; s<eSize; s++) {              261     for (size_t s=0; s<eSize; s++) {
260          eVector->push_back(e[s]);                262          eVector->push_back(e[s]);
261     }                                             263     }
262     G4RDVEMDataSet* set = new G4RDEMDataSet(sh    264     G4RDVEMDataSet* set = new G4RDEMDataSet(shell,eVector,a[k],interp,1.,1.);
263                                                   265 
264     p[k]->AddComponent(set);                      266     p[k]->AddComponent(set);
265   }                                               267   } 
266                                                   268     
267   // clear vectors                                269   // clear vectors
268         for (size_t j2=0; j2<length; j2++) {      270         for (size_t j2=0; j2<length; j2++) {
269     a[j2] = new G4DataVector();                   271     a[j2] = new G4DataVector();
270   }                                               272   } 
271         shell++;                                  273         shell++;
272         e.clear();                                274         e.clear();
273       }                                           275       }
274     } while (energy > -2);                        276     } while (energy > -2);
275                                                   277     
276     file.close();                                 278     file.close();
277                                                   279 
278     for (size_t kk=0; kk<length; kk++)            280     for (size_t kk=0; kk<length; kk++) 
279       {                                           281       {
280   G4int id = Z*100 + kk;                          282   G4int id = Z*100 + kk;
281   param[id] = p[kk];                              283   param[id] = p[kk];
282       }                                           284       }
283   }                                               285   }
284                                                   286 
285   G4String pathString_a(path);                    287   G4String pathString_a(path);
286   G4String name_a = pathString_a + G4String("/    288   G4String name_a = pathString_a + G4String("/ioni/ion-ex-av.dat");  
287   std::ifstream file_a(name_a);                   289   std::ifstream file_a(name_a);
288   std::filebuf* lsdp_a = file_a.rdbuf();          290   std::filebuf* lsdp_a = file_a.rdbuf();
289   G4String pathString_b(path);                    291   G4String pathString_b(path);
290   G4String name_b = pathString_b + G4String("/    292   G4String name_b = pathString_b + G4String("/ioni/ion-ex-sig.dat");  
291   std::ifstream file_b(name_b);                   293   std::ifstream file_b(name_b);
292   std::filebuf* lsdp_b = file_b.rdbuf();          294   std::filebuf* lsdp_b = file_b.rdbuf();
293                                                   295   
294   if (! (lsdp_a->is_open()) ) {                   296   if (! (lsdp_a->is_open()) ) {
295      G4String excep = G4String("Cannot open fi    297      G4String excep = G4String("Cannot open file ")
296                     + name_a;                     298                     + name_a;
297      G4Exception("G4RDeIonisationParameters::L    299      G4Exception("G4RDeIonisationParameters::LoadData()", "CannotOpenFile",
298                  FatalException, excep);          300                  FatalException, excep);
299   }                                               301   }  
300   if (! (lsdp_b->is_open()) ) {                   302   if (! (lsdp_b->is_open()) ) {
301      G4String excep = G4String("Cannot open fi    303      G4String excep = G4String("Cannot open file ")
302                     + name_b;                     304                     + name_b;
303      G4Exception("G4RDeIonisationParameters::L    305      G4Exception("G4RDeIonisationParameters::LoadData()", "CannotOpenFile",
304                  FatalException, excep);          306                  FatalException, excep);
305   }                                               307   }  
306                                                   308 
307   // The file is organized into two columns:      309   // The file is organized into two columns:
308   // 1st column is the energy                     310   // 1st column is the energy
309   // 2nd column is the corresponding value        311   // 2nd column is the corresponding value
310   // The file terminates with the pattern: -1     312   // The file terminates with the pattern: -1   -1
311   //                                       -2     313   //                                       -2   -2
312                                                   314 
313   G4double ener, ener1, sig, sig1;                315   G4double ener, ener1, sig, sig1;
314   G4int z    = 0;                                 316   G4int z    = 0;
315                                                   317 
316   G4DataVector e;                                 318   G4DataVector e;
317   e.clear();                                      319   e.clear();
318   G4DataVector d;                                 320   G4DataVector d;
319   d.clear();                                      321   d.clear();
320                                                   322 
321   do {                                            323   do {
322     file_a >> ener >> sig;                        324     file_a >> ener >> sig;
323     file_b >> ener1 >> sig1;                      325     file_b >> ener1 >> sig1;
324                                                   326     
325     if(ener != ener1) {                           327     if(ener != ener1) {
326       G4cout << "G4RDeIonisationParameters: pr    328       G4cout << "G4RDeIonisationParameters: problem in excitation data "
327              << "ener= " << ener                  329              << "ener= " << ener
328              << " ener1= " << ener1               330              << " ener1= " << ener1
329              << G4endl;                           331              << G4endl;
330     }                                             332     }
331                                                   333 
332     // End of file                                334     // End of file
333     if (ener == -2) {                             335     if (ener == -2) {
334       break;                                      336       break;
335                                                   337 
336       // End of next element                      338       // End of next element
337     } else if (ener == -1) {                      339     } else if (ener == -1) {
338                                                   340 
339       z++;                                        341       z++;
340       G4double Z = (G4double)z;                   342       G4double Z = (G4double)z;
341                                                   343     
342   // fill map if Z is used                        344   // fill map if Z is used
343       if (activeZ.contains(Z)) {                  345       if (activeZ.contains(Z)) {
344                                                   346 
345   G4RDVDataSetAlgorithm* inter  = new G4RDLinI    347   G4RDVDataSetAlgorithm* inter  = new G4RDLinInterpolation();
346   G4DataVector* eVector = new G4DataVector;       348   G4DataVector* eVector = new G4DataVector;
347   G4DataVector* dVector = new G4DataVector;       349   G4DataVector* dVector = new G4DataVector;
348   size_t eSize = e.size();                        350   size_t eSize = e.size();
349   for (size_t s=0; s<eSize; s++) {                351   for (size_t s=0; s<eSize; s++) {
350            eVector->push_back(e[s]);              352            eVector->push_back(e[s]);
351            dVector->push_back(d[s]);              353            dVector->push_back(d[s]);
352   }                                               354   }
353   G4RDVEMDataSet* set = new G4RDEMDataSet(z,eV    355   G4RDVEMDataSet* set = new G4RDEMDataSet(z,eVector,dVector,inter,1.,1.);
354       excit[z] = set;                             356       excit[z] = set; 
355       }                                           357       }
356       e.clear();                                  358       e.clear();
357       d.clear();                                  359       d.clear();
358                                                   360   
359     } else {                                      361     } else {
360                                                   362 
361       e.push_back(ener*MeV);                      363       e.push_back(ener*MeV);
362       d.push_back(sig1*sig*barn*MeV);             364       d.push_back(sig1*sig*barn*MeV);
363     }                                             365     }
364   } while (ener != -2);                           366   } while (ener != -2);
365                                                   367   
366   file_a.close();                                 368   file_a.close();
367                                                   369 
368 }                                                 370 }
369                                                   371 
370                                                   372 
371 void G4RDeIonisationParameters::PrintData() co    373 void G4RDeIonisationParameters::PrintData() const
372 {                                                 374 {
373   G4cout << G4endl;                               375   G4cout << G4endl;
374   G4cout << "===== G4RDeIonisationParameters =    376   G4cout << "===== G4RDeIonisationParameters =====" << G4endl;
375   G4cout << G4endl;                               377   G4cout << G4endl;
376                                                   378 
377   size_t nZ = activeZ.size();                     379   size_t nZ = activeZ.size();
378   std::map<G4int,G4RDVEMDataSet*,std::less<G4i    380   std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator pos;
379                                                   381 
380   for (size_t i=0; i<nZ; i++) {                   382   for (size_t i=0; i<nZ; i++) {
381     G4int Z = (G4int)activeZ[i];                  383     G4int Z = (G4int)activeZ[i];      
382                                                   384 
383     for (size_t j=0; j<length; j++) {             385     for (size_t j=0; j<length; j++) {
384                                                   386     
385       G4int index = Z*100 + j;                    387       G4int index = Z*100 + j;
386                                                   388 
387       pos = param.find(index);                    389       pos = param.find(index);
388       if (pos!= param.end()) {                    390       if (pos!= param.end()) {
389         G4RDVEMDataSet* dataSet = (*pos).secon    391         G4RDVEMDataSet* dataSet = (*pos).second;
390         size_t nShells = dataSet->NumberOfComp    392         size_t nShells = dataSet->NumberOfComponents();
391                                                   393 
392         for (size_t k=0; k<nShells; k++) {        394         for (size_t k=0; k<nShells; k++) {
393                                                   395 
394           G4cout << "===== Z= " << Z << " shel    396           G4cout << "===== Z= " << Z << " shell= " << k 
395                  << " parameter[" << j << "]      397                  << " parameter[" << j << "]  =====" 
396                  << G4endl;                       398                  << G4endl;
397           const G4RDVEMDataSet* comp = dataSet    399           const G4RDVEMDataSet* comp = dataSet->GetComponent(k);
398           comp->PrintData();                      400           comp->PrintData();
399   }                                               401   }
400       }                                           402       }
401     }                                             403     }
402   }                                               404   }
403   G4cout << "=================================    405   G4cout << "====================================" << G4endl;
404 }                                                 406 }
405                                                   407 
406                                                   408 
407                                                   409