Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/lowenergy/src/G4ShellEMDataSet.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/electromagnetic/lowenergy/src/G4ShellEMDataSet.cc (Version 11.3.0) and /processes/electromagnetic/lowenergy/src/G4ShellEMDataSet.cc (Version 11.0.p1)


  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 // Author: Maria Grazia Pia (Maria.Grazia.Pia@     28 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
 29 //                                                 29 //
 30 // History:                                        30 // History:
 31 // -----------                                     31 // -----------
 32 //  1 Aug 2001   MGP         Created               32 //  1 Aug 2001   MGP         Created
 33 //                                                 33 //
 34 //  09.10.01   V.Ivanchenko  Add case z=0          34 //  09.10.01   V.Ivanchenko  Add case z=0
 35 //                                                 35 //
 36 //  9 Mar 2008   MGP         Cleaned up unread     36 //  9 Mar 2008   MGP         Cleaned up unreadable code modified by former developer
 37 //                           (Further clean-up     37 //                           (Further clean-up needed)
 38 //                                                 38 //
 39 //  15 Jul 2009   Nicolas A. Karakatsanis          39 //  15 Jul 2009   Nicolas A. Karakatsanis
 40 //                                                 40 //
 41 //                           - LoadNonLogData      41 //                           - LoadNonLogData method was created to load only the non-logarithmic data from G4EMLOW
 42 //                             dataset. It is      42 //                             dataset. It is essentially performing the data loading operations as in the past.
 43 //                                                 43 //
 44 //                           - LoadData method     44 //                           - LoadData method was revised in order to calculate the logarithmic values of the data
 45 //                             It retrieves th     45 //                             It retrieves the data values from the G4EMLOW data files but, then, calculates the
 46 //                             respective log      46 //                             respective log values and loads them to seperate data structures. 
 47 //                                                 47 //
 48 //                           - SetLogEnergiesD     48 //                           - SetLogEnergiesData method was cretaed to set logarithmic values to G4 data vectors.
 49 //                             The EM data set     49 //                             The EM data sets, initialized this way, contain both non-log and log values.
 50 //                             These initializ     50 //                             These initialized data sets can enhance the computing performance of data interpolation
 51 //                             operations          51 //                             operations
 52 //                                                 52 // 
 53 //                                                 53 //
 54 // -------------------------------------------     54 // -------------------------------------------------------------------
 55                                                    55 
 56 #include "G4ShellEMDataSet.hh"                     56 #include "G4ShellEMDataSet.hh"
 57 #include "G4EMDataSet.hh"                          57 #include "G4EMDataSet.hh"
 58 #include "G4VDataSetAlgorithm.hh"                  58 #include "G4VDataSetAlgorithm.hh"
 59 #include <fstream>                                 59 #include <fstream>
 60 #include <sstream>                                 60 #include <sstream>
 61                                                    61 
 62 //....oooOO0OOooo........oooOO0OOooo........oo     62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 63 G4ShellEMDataSet::G4ShellEMDataSet(G4int zeta,     63 G4ShellEMDataSet::G4ShellEMDataSet(G4int zeta, G4VDataSetAlgorithm* algo, 
 64            G4double eUnit,                         64            G4double eUnit, 
 65            G4double dataUnit)                      65            G4double dataUnit)
 66   :                                                66   : 
 67   algorithm(algo),                                 67   algorithm(algo),
 68   unitEnergies(eUnit),                             68   unitEnergies(eUnit),
 69   unitData(dataUnit),                              69   unitData(dataUnit),
 70   z(zeta)                                          70   z(zeta)
 71 {                                                  71 {
 72   if (algorithm == nullptr)                        72   if (algorithm == nullptr) 
 73     G4Exception("G4ShellEMDataSet::G4ShellEMDa     73     G4Exception("G4ShellEMDataSet::G4ShellEMDataSet()","em0007",
 74     FatalErrorInArgument, "Interpolation == 0"     74     FatalErrorInArgument, "Interpolation == 0");
 75 }                                                  75 }
 76                                                    76 
 77 //....oooOO0OOooo........oooOO0OOooo........oo     77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 78 G4ShellEMDataSet::~G4ShellEMDataSet()              78 G4ShellEMDataSet::~G4ShellEMDataSet()
 79 {                                                  79 {
 80   CleanUpComponents();                             80   CleanUpComponents();
 81   if (algorithm) delete algorithm;                 81   if (algorithm) delete algorithm;
 82 }                                                  82 }
 83                                                    83 
 84 //....oooOO0OOooo........oooOO0OOooo........oo     84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 85 G4double G4ShellEMDataSet::FindValue(G4double      85 G4double G4ShellEMDataSet::FindValue(G4double energy, G4int /* componentId */) const
 86 {                                                  86 {
 87   // Returns the sum over the shells correspon     87   // Returns the sum over the shells corresponding to e
 88   G4double value = 0.;                             88   G4double value = 0.;
 89                                                    89 
 90   std::vector<G4VEMDataSet *>::const_iterator      90   std::vector<G4VEMDataSet *>::const_iterator i(components.begin());
 91   std::vector<G4VEMDataSet *>::const_iterator      91   std::vector<G4VEMDataSet *>::const_iterator end(components.end());
 92                                                    92 
 93   while (i != end)                                 93   while (i != end)
 94     {                                              94     {
 95       value += (*i)->FindValue(energy);            95       value += (*i)->FindValue(energy);
 96       i++;                                         96       i++;
 97     }                                              97     }
 98                                                    98 
 99   return value;                                    99   return value;
100 }                                                 100 }
101                                                   101 
102 //....oooOO0OOooo........oooOO0OOooo........oo    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
103                                                   103 
104 void G4ShellEMDataSet::PrintData() const          104 void G4ShellEMDataSet::PrintData() const
105 {                                                 105 {
106   const G4int n = (G4int)NumberOfComponents(); << 106   const size_t n = NumberOfComponents();
107                                                   107 
108   G4cout << "The data set has " << n << " comp    108   G4cout << "The data set has " << n << " components" << G4endl;
109   G4cout << G4endl;                               109   G4cout << G4endl;
110                                                   110  
111   G4int i = 0;                                 << 111   size_t i = 0;
112                                                   112  
113   while (i < n)                                   113   while (i < n)
114     {                                             114     {
115       G4cout << "--- Component " << i << " ---    115       G4cout << "--- Component " << i << " ---" << G4endl;
116       GetComponent(i)->PrintData();               116       GetComponent(i)->PrintData();
117       ++i;                                     << 117       i++;
118     }                                             118     }
119 }                                                 119 }
120                                                   120 
121 //....oooOO0OOooo........oooOO0OOooo........oo    121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
122                                                   122 
123 void G4ShellEMDataSet::SetEnergiesData(G4DataV    123 void G4ShellEMDataSet::SetEnergiesData(G4DataVector* energies, 
124                G4DataVector* data,                124                G4DataVector* data, 
125                G4int componentId)                 125                G4int componentId)
126 {                                                 126 {
127   G4VEMDataSet* component = components[compone    127   G4VEMDataSet* component = components[componentId]; 
128   if (component)                                  128   if (component)
129     {                                             129     {
130       component->SetEnergiesData(energies, dat    130       component->SetEnergiesData(energies, data, 0);
131       return;                                     131       return;
132     }                                             132     }
133                                                   133 
134   G4String msg = "component ";                    134   G4String msg = "component ";
135   msg += static_cast<char>(componentId);          135   msg += static_cast<char>(componentId);
136   msg += " not found";                            136   msg += " not found";
137                                                   137  
138   G4Exception("G4ShellEMDataSet::SetEnergiesDa    138   G4Exception("G4ShellEMDataSet::SetEnergiesData()","em0008", FatalErrorInArgument ,msg);
139 }                                                 139 }
140                                                   140 
141 //....oooOO0OOooo........oooOO0OOooo........oo    141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
142                                                   142 
143 void G4ShellEMDataSet::SetLogEnergiesData(G4Da    143 void G4ShellEMDataSet::SetLogEnergiesData(G4DataVector* energies,
144                                           G4Da    144                                           G4DataVector* data,
145                                           G4Da    145                                           G4DataVector* log_energies,
146                                           G4Da    146                                           G4DataVector* log_data,
147                                           G4in    147                                           G4int componentId)
148 {                                                 148 {
149   G4VEMDataSet* component = components[compone    149   G4VEMDataSet* component = components[componentId]; 
150   if (component)                                  150   if (component)
151     {                                             151     {
152       component->SetLogEnergiesData(energies,     152       component->SetLogEnergiesData(energies, data, log_energies, log_data, 0);
153       return;                                     153       return;
154     }                                             154     }
155                                                   155 
156   G4String msg = "component ";                    156   G4String msg = "component ";
157   msg += static_cast<char>(componentId);          157   msg += static_cast<char>(componentId);
158   msg += " not found";                            158   msg += " not found";
159   G4Exception("G4ShellEMDataSet::SetLogEnergie    159   G4Exception("G4ShellEMDataSet::SetLogEnergiesData()","em0008", 
160         FatalErrorInArgument ,msg);               160         FatalErrorInArgument ,msg);
161 }                                                 161 }
162                                                   162 
163 //....oooOO0OOooo........oooOO0OOooo........oo    163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
164                                                   164 
165 G4bool G4ShellEMDataSet::LoadData(const G4Stri    165 G4bool G4ShellEMDataSet::LoadData(const G4String& file)
166 {                                                 166 {
167   CleanUpComponents();                            167   CleanUpComponents();
168                                                   168 
169   G4String fullFileName = FullFileName(file);     169   G4String fullFileName = FullFileName(file);
170   std::ifstream in(fullFileName);                 170   std::ifstream in(fullFileName);
171                                                   171 
172   if (!in.is_open())                              172   if (!in.is_open())
173     {                                             173     {
174       G4String message("Data file \"");           174       G4String message("Data file \"");
175       message += fullFileName;                    175       message += fullFileName;
176       message += "\" not found";                  176       message += "\" not found";
177       G4Exception("G4ShellEMDataSet::LoadData(    177       G4Exception("G4ShellEMDataSet::LoadData()", "em0003",FatalException, message);
178       return 0;                                   178       return 0;
179     }                                             179     }
180                                                   180   
181   G4DataVector* orig_shell_energies = 0;          181   G4DataVector* orig_shell_energies = 0;
182   G4DataVector* orig_shell_data = 0;              182   G4DataVector* orig_shell_data = 0;
183   G4DataVector* log_shell_energies = 0;           183   G4DataVector* log_shell_energies = 0;
184   G4DataVector* log_shell_data = 0;               184   G4DataVector* log_shell_data = 0;
185                                                   185 
186   G4double a = 0.;                                186   G4double a = 0.;
187   G4int shellIndex = 0;                           187   G4int shellIndex = 0;
188   G4int k = 0;                                    188   G4int k = 0;
189   G4int nColumns = 2;                             189   G4int nColumns = 2;
190                                                   190 
191   do                                              191   do
192     {                                             192     {
193       in >> a;                                    193       in >> a;
194                                                   194 
195       if (a==0.) a=1e-300;                        195       if (a==0.) a=1e-300;
196                                                   196 
197       // The file is organized into four colum    197       // The file is organized into four columns:
198       // 1st column contains the values of ene    198       // 1st column contains the values of energy
199       // 2nd column contains the corresponding    199       // 2nd column contains the corresponding data value
200       // The file terminates with the pattern:    200       // The file terminates with the pattern: -1   -1
201       //                                          201       //                                       -2   -2
202       //                                          202       //
203       if (a == -1)                                203       if (a == -1)
204   {                                               204   {
205     if ((k%nColumns == 0) && (orig_shell_energ    205     if ((k%nColumns == 0) && (orig_shell_energies != 0) )
206       {                                           206       {
207        AddComponent(new G4EMDataSet(shellIndex    207        AddComponent(new G4EMDataSet(shellIndex, orig_shell_energies, 
208             orig_shell_data, log_shell_energie    208             orig_shell_data, log_shell_energies, 
209             log_shell_data, algorithm->Clone()    209             log_shell_data, algorithm->Clone(), 
210             unitEnergies, unitData));             210             unitEnergies, unitData));
211         orig_shell_energies = 0;                  211         orig_shell_energies = 0;
212         orig_shell_data = 0;                      212         orig_shell_data = 0;
213               log_shell_energies = 0;             213               log_shell_energies = 0;
214               log_shell_data = 0;                 214               log_shell_data = 0;
215       }                                           215       }
216   }                                               216   }
217       else if (a != -2)                           217       else if (a != -2)
218   {                                               218   {
219     if (orig_shell_energies == 0)                 219     if (orig_shell_energies == 0)
220       {                                           220       {
221        orig_shell_energies = new G4DataVector;    221        orig_shell_energies = new G4DataVector;
222        orig_shell_data = new G4DataVector;        222        orig_shell_data = new G4DataVector;
223              log_shell_energies = new G4DataVe    223              log_shell_energies = new G4DataVector;
224              log_shell_data = new G4DataVector    224              log_shell_data = new G4DataVector;
225       }                                           225       }
226     if (k%nColumns == 0)                          226     if (k%nColumns == 0)
227             {                                     227             {
228        orig_shell_energies->push_back(a*unitEn    228        orig_shell_energies->push_back(a*unitEnergies);
229        log_shell_energies->push_back(std::log1    229        log_shell_energies->push_back(std::log10(a) + std::log10(unitEnergies));
230             }                                     230             }
231     else if (k%nColumns == 1)                     231     else if (k%nColumns == 1)
232             {                                     232             {
233        orig_shell_data->push_back(a*unitData);    233        orig_shell_data->push_back(a*unitData);
234              log_shell_data->push_back(std::lo    234              log_shell_data->push_back(std::log10(a) + std::log10(unitData));
235             }                                     235             }
236           k++;                                    236           k++;
237   }                                               237   }
238       else k = 1;                                 238       else k = 1;
239     }                                             239     }
240   while (a != -2);  // End of file                240   while (a != -2);  // End of file
241                                                   241 
242   delete orig_shell_energies;                     242   delete orig_shell_energies;
243   delete orig_shell_data;                         243   delete orig_shell_data;
244   delete log_shell_energies;                      244   delete log_shell_energies;
245   delete log_shell_data;                          245   delete log_shell_data;
246                                                   246 
247   return true;                                    247   return true;
248 }                                                 248 }
249                                                   249 
250 //....oooOO0OOooo........oooOO0OOooo........oo    250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
251                                                   251 
252 G4bool G4ShellEMDataSet::LoadNonLogData(const     252 G4bool G4ShellEMDataSet::LoadNonLogData(const G4String& file)
253 {                                                 253 {
254   CleanUpComponents();                            254   CleanUpComponents();
255                                                   255 
256   G4String fullFileName = FullFileName(file);     256   G4String fullFileName = FullFileName(file);
257   std::ifstream in(fullFileName);                 257   std::ifstream in(fullFileName);
258                                                   258 
259   if (!in.is_open())                              259   if (!in.is_open())
260     {                                             260     {
261       G4String message("G4ShellEMDataSet::Load    261       G4String message("G4ShellEMDataSet::LoadData - data file \"");
262       message += fullFileName;                    262       message += fullFileName;
263       message += "\" not found";                  263       message += "\" not found";
264       G4Exception("G4ShellEMDataSet::LoadNonLo    264       G4Exception("G4ShellEMDataSet::LoadNonLogData()", "em0003",FatalException, message);
265       return 0;                                   265       return 0;
266     }                                             266     }
267                                                   267 
268   G4DataVector* orig_shell_energies = 0;          268   G4DataVector* orig_shell_energies = 0;
269   G4DataVector* orig_shell_data = 0;              269   G4DataVector* orig_shell_data = 0;
270                                                   270 
271   G4double a = 0.;                                271   G4double a = 0.;
272   G4int shellIndex = 0;                           272   G4int shellIndex = 0;
273   G4int k = 0;                                    273   G4int k = 0;
274   G4int nColumns = 2;                             274   G4int nColumns = 2;
275                                                   275 
276   do                                              276   do
277     {                                             277     {
278       in >> a;                                    278       in >> a;
279       // The file is organized into four colum    279       // The file is organized into four columns:
280       // 1st column contains the values of ene    280       // 1st column contains the values of energy
281       // 2nd column contains the corresponding    281       // 2nd column contains the corresponding data value
282       // The file terminates with the pattern:    282       // The file terminates with the pattern: -1   -1
283       //                                          283       //                                       -2   -2
284       //                                          284       //
285       if (a == -1)                                285       if (a == -1)
286   {                                               286   {
287     if ((k%nColumns == 0) && (orig_shell_energ    287     if ((k%nColumns == 0) && (orig_shell_energies != 0) )
288       {                                           288       {
289        AddComponent(new G4EMDataSet(shellIndex    289        AddComponent(new G4EMDataSet(shellIndex, orig_shell_energies, 
290             orig_shell_data, algorithm->Clone(    290             orig_shell_data, algorithm->Clone(), 
291             unitEnergies, unitData));             291             unitEnergies, unitData));
292         orig_shell_energies = 0;                  292         orig_shell_energies = 0;
293         orig_shell_data = 0;                      293         orig_shell_data = 0;
294       }                                           294       }
295   }                                               295   }
296       else if (a != -2)                           296       else if (a != -2)
297   {                                               297   {
298     if (orig_shell_energies == 0)                 298     if (orig_shell_energies == 0)
299       {                                           299       {
300        orig_shell_energies = new G4DataVector;    300        orig_shell_energies = new G4DataVector;
301        orig_shell_data = new G4DataVector;        301        orig_shell_data = new G4DataVector;
302       }                                           302       }
303     if (k%nColumns == 0)                          303     if (k%nColumns == 0)
304             {                                     304             {
305        orig_shell_energies->push_back(a*unitEn    305        orig_shell_energies->push_back(a*unitEnergies);
306             }                                     306             }
307     else if (k%nColumns == 1)                     307     else if (k%nColumns == 1)
308             {                                     308             {
309        orig_shell_data->push_back(a*unitData);    309        orig_shell_data->push_back(a*unitData);
310             }                                     310             }
311           k++;                                    311           k++;
312   }                                               312   }
313       else k = 1;                                 313       else k = 1;
314     }                                             314     }
315   while (a != -2);  // End of file                315   while (a != -2);  // End of file
316                                                   316 
317                                                   317 
318   delete orig_shell_energies;                     318   delete orig_shell_energies;
319   delete orig_shell_data;                         319   delete orig_shell_data;
320                                                   320 
321   return true;                                    321   return true;
322 }                                                 322 }
323                                                   323 
324 //....oooOO0OOooo........oooOO0OOooo........oo    324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
325                                                   325 
326 G4bool G4ShellEMDataSet::SaveData(const G4Stri    326 G4bool G4ShellEMDataSet::SaveData(const G4String& file) const
327 {                                                 327 {
328   G4String fullFileName = FullFileName(file);     328   G4String fullFileName = FullFileName(file);
329   std::ofstream out(fullFileName);                329   std::ofstream out(fullFileName);
330                                                   330 
331   if (!out.is_open())                             331   if (!out.is_open())
332     {                                             332     {
333       G4String message("Cannot open \"");         333       G4String message("Cannot open \"");
334       message += fullFileName;                    334       message += fullFileName;
335       message += "\"";                            335       message += "\"";
336       G4Exception("G4EMDataSet::SaveData()","e    336       G4Exception("G4EMDataSet::SaveData()","em0005",FatalException,message);
337     }                                             337     }
338                                                   338  
339   const G4int n = (G4int)NumberOfComponents(); << 339   const size_t n = NumberOfComponents();
340   G4int k = 0;                                 << 340   size_t k = 0;
341                                                   341  
342   while (k < n)                                   342   while (k < n)
343     {                                             343     {
344       const G4VEMDataSet* component = GetCompo    344       const G4VEMDataSet* component = GetComponent(k);
345                                                   345   
346       if (component)                              346       if (component)
347   {                                               347   {
348     const G4DataVector& energies = component->    348     const G4DataVector& energies = component->GetEnergies(0);
349     const G4DataVector& data = component->GetD    349     const G4DataVector& data = component->GetData(0);
350                                                   350  
351     G4DataVector::const_iterator i = energies. << 351     G4DataVector::const_iterator i = energies.begin();
352     G4DataVector::const_iterator endI = energi << 352     G4DataVector::const_iterator endI = energies.end();
353     G4DataVector::const_iterator j = data.cbeg << 353     G4DataVector::const_iterator j = data.begin();
354                                                   354   
355     while (i != endI)                             355     while (i != endI)
356       {                                           356       {
357         out.precision(10);                        357         out.precision(10);
358         out.width(15);                            358         out.width(15);
359         out.setf(std::ofstream::left);            359         out.setf(std::ofstream::left);
360         out << ((*i)/unitEnergies) << ' ';        360         out << ((*i)/unitEnergies) << ' ';
361                                                   361 
362         out.precision(10);                        362         out.precision(10);
363         out.width(15);                            363         out.width(15);
364         out.setf(std::ofstream::left);            364         out.setf(std::ofstream::left);
365         out << ((*j)/unitData) << std::endl;      365         out << ((*j)/unitData) << std::endl;
366         i++;                                      366         i++;
367         j++;                                      367         j++;
368       }                                           368       }
369   }                                               369   }
370                                                   370   
371       out.precision(10);                          371       out.precision(10);
372       out.width(15);                              372       out.width(15);
373       out.setf(std::ofstream::left);              373       out.setf(std::ofstream::left);
374       out << -1.f << ' ';                         374       out << -1.f << ' ';
375                                                   375 
376       out.precision(10);                          376       out.precision(10);
377       out.width(15);                              377       out.width(15);
378       out.setf(std::ofstream::left);              378       out.setf(std::ofstream::left);
379       out << -1.f << std::endl;                   379       out << -1.f << std::endl;
380                                                   380   
381       k++;                                        381       k++;
382     }                                             382     }
383                                                   383  
384   out.precision(10);                              384   out.precision(10);
385   out.width(15);                                  385   out.width(15);
386   out.setf(std::ofstream::left);                  386   out.setf(std::ofstream::left);
387   out << -2.f << ' ';                             387   out << -2.f << ' ';
388                                                   388 
389   out.precision(10);                              389   out.precision(10);
390   out.width(15);                                  390   out.width(15);
391   out.setf(std::ofstream::left);                  391   out.setf(std::ofstream::left);
392   out << -2.f << std::endl;                       392   out << -2.f << std::endl;
393                                                   393 
394   return true;                                    394   return true;
395 }                                                 395 }
396                                                   396 
397 //....oooOO0OOooo........oooOO0OOooo........oo    397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
398                                                   398 
399 void G4ShellEMDataSet::CleanUpComponents()        399 void G4ShellEMDataSet::CleanUpComponents()
400 {                                                 400 {
401   while (!components.empty())                     401   while (!components.empty())
402     {                                             402     {
403       if (components.back()) delete components    403       if (components.back()) delete components.back();
404       components.pop_back();                      404       components.pop_back();
405     }                                             405     }
406 }                                                 406 }
407                                                   407 
408 //....oooOO0OOooo........oooOO0OOooo........oo    408 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
409                                                   409 
410 G4String G4ShellEMDataSet::FullFileName(const     410 G4String G4ShellEMDataSet::FullFileName(const G4String& fileName) const
411 {                                                 411 {
412   const char* path = G4FindDataDir("G4LEDATA") << 412   char* path = std::getenv("G4LEDATA");
413                                                   413   
414   if (!path)                                      414   if (!path)
415   {                                               415   {
416     G4Exception("G4ShellEMDataSet::FullFileNam    416     G4Exception("G4ShellEMDataSet::FullFileName()","em0006",JustWarning,"Please set G4LEDATA");
417     return "";                                    417     return "";
418   }                                               418   }
419                                                   419   
420   std::ostringstream fullFileName;                420   std::ostringstream fullFileName;
421                                                   421  
422   fullFileName << path << '/' << fileName << z    422   fullFileName << path << '/' << fileName << z << ".dat";
423                                                   423                       
424   return G4String(fullFileName.str().c_str());    424   return G4String(fullFileName.str().c_str());
425 }                                                 425 }
426                                                   426