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[ 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/pii/src/G4PixeShellDataSet.cc (Version 11.3.0) and /processes/electromagnetic/pii/src/G4PixeShellDataSet.cc (Version 5.0.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 //                                                
 28 // Author: Maria Grazia Pia (Maria.Grazia.Pia@    
 29 //                                                
 30 // History:                                       
 31 // -----------                                    
 32 //  1 Aug 2001   MGP        Created               
 33 // 09.10.01   V.Ivanchenko Add case z=0           
 34 //  9 Mar 2008   MGP        Cleaned up unreada    
 35 //                          (Further clean-up     
 36 // 31 Jul 2008   MGP        Revised               
 37 //                                                
 38 // -------------------------------------------    
 39                                                   
 40 #include "G4PixeShellDataSet.hh"                  
 41 #include "G4DataSet.hh"                           
 42 #include "G4IInterpolator.hh"                     
 43 #include <fstream>                                
 44 #include <sstream>                                
 45                                                   
 46                                                   
 47 G4PixeShellDataSet::G4PixeShellDataSet(G4int z    
 48                G4IInterpolator* algo,             
 49                const G4String& modelK,            
 50                const G4String& modelL,            
 51                const G4String& modelM,            
 52                G4double eUnit,                    
 53                G4double dataUnit):                
 54   z(zeta),                                        
 55   algorithm(algo),                                
 56   unitEnergies(eUnit),                            
 57   unitData(dataUnit)                              
 58 {                                                 
 59   if (algorithm == 0) G4Exception("G4PixeShell    
 60           "pii00000301",                          
 61           FatalException,                         
 62           "interpolation == 0");                  
 63                                                   
 64   crossModel.push_back(modelK);                   
 65   crossModel.push_back(modelL);                   
 66   crossModel.push_back(modelM);                   
 67                                                   
 68   shellName.push_back("k");                       
 69   shellName.push_back("l");                       
 70   shellName.push_back("m");                       
 71                                                   
 72   std::size_t sizeK = modelK.size();              
 73   std::size_t sizeL = modelL.size();              
 74   std::size_t sizeM = modelM.size();              
 75                                                   
 76   if (sizeK > 0) subShellName.push_back("k");     
 77                                                   
 78   if (sizeK > 0 && sizeL > 0)                     
 79     {                                             
 80       subShellName.push_back("l1");               
 81       subShellName.push_back("l2");               
 82       subShellName.push_back("l3");               
 83     }                                             
 84   if (sizeK > 0 && sizeL > 0 && sizeM >0)         
 85     {                                             
 86       subShellName.push_back("m1");               
 87       subShellName.push_back("m2");               
 88       subShellName.push_back("m3");               
 89       subShellName.push_back("m4");               
 90       subShellName.push_back("m5");               
 91     }                                             
 92 }                                                 
 93                                                   
 94                                                   
 95 G4PixeShellDataSet::~G4PixeShellDataSet()         
 96 {                                                 
 97   CleanUpComponents();                            
 98   if (algorithm) delete algorithm;                
 99 }                                                 
100                                                   
101                                                   
102 G4double G4PixeShellDataSet::FindValue(G4doubl    
103 {                                                 
104   // Returns the sum over the shells correspon    
105   G4double value = 0.;                            
106                                                   
107   std::vector<G4IDataSet *>::const_iterator i(    
108   std::vector<G4IDataSet *>::const_iterator en    
109                                                   
110   while (i != end)                                
111     {                                             
112       value += (*i)->FindValue(energy);           
113       i++;                                        
114     }                                             
115   return value;                                   
116 }                                                 
117                                                   
118                                                   
119 void G4PixeShellDataSet::PrintData(void) const    
120 {                                                 
121   const G4int n = (G4int)NumberOfComponents();    
122                                                   
123   G4cout << "The data set has " << n << " comp    
124   G4cout << G4endl;                               
125                                                   
126   G4int i = 0;                                    
127                                                   
128   while (i < n)                                   
129     {                                             
130       G4cout << "--- Component " << i << " ---    
131       GetComponent(i)->PrintData();               
132       ++i;                                        
133     }                                             
134 }                                                 
135                                                   
136                                                   
137 void G4PixeShellDataSet::SetEnergiesData(G4Dat    
138            G4DataVector* data,                    
139            G4int componentId)                     
140 {                                                 
141   G4IDataSet* component = components[component    
142                                                   
143   if (component)                                  
144     {                                             
145       component->SetEnergiesData(energies, dat    
146       return;                                     
147     }                                             
148                                                   
149   std::ostringstream message;                     
150   message << "G4PixeShellDataSet::SetEnergiesD    
151                                                   
152   G4Exception("G4PixeShellDataSet::SetEnergies    
153         "pii000000310",                           
154         FatalException,                           
155         message.str().c_str());                   
156 }                                                 
157                                                   
158                                                   
159 G4bool G4PixeShellDataSet::LoadData(const G4St    
160 {                                                 
161   CleanUpComponents();                            
162                                                   
163   // Load shell cross sections                    
164                                                   
165   std::size_t nShells = subShellName.size();      
166                                                   
167   for (std::size_t subShellIndex=0; subShellIn    
168     {                                             
169       G4String subName = subShellName[subShell    
170       G4String fullFileName = FullFileName(fil    
171                                                   
172       // Create component DataSet with the dat    
173       G4IDataSet* dataSet = new G4DataSet(z,al    
174       dataSet->LoadData(fullFileName);            
175                                                   
176       // Add component to the ShellDataSet        
177       AddComponent(dataSet);                      
178     }                                             
179                                                   
180   return true;                                    
181 }                                                 
182                                                   
183                                                   
184 G4bool G4PixeShellDataSet::SaveData(const G4St    
185 {                                                 
186   // Dummy implementation                         
187   return true;                                    
188 }                                                 
189                                                   
190                                                   
191 void G4PixeShellDataSet::CleanUpComponents(voi    
192 {                                                 
193   while (!components.empty())                     
194     {                                             
195       if (components.back()) delete components    
196       components.pop_back();                      
197     }                                             
198 }                                                 
199                                                   
200                                                   
201 G4String G4PixeShellDataSet::FullFileName(cons    
202             const G4String& subShell) const       
203 {                                                 
204   const char* path = G4FindDataDir("G4PIIDATA"    
205   if (!path)                                      
206     G4Exception("G4PixeShellDataSet::FullFileN    
207           "pii00000320",                          
208           FatalException,                         
209           "G4PIIDATA environment variable not     
210                                                   
211   // Identify the shell this subshell belongs     
212   G4int shellIndex = TranslateShell(subShell);    
213   G4String shellString = shellName[shellIndex]    
214   G4String shellModel = crossModel[shellIndex]    
215                                                   
216   std::ostringstream fullFileName;                
217                                                   
218   fullFileName                                    
219     //<< path                                     
220          << "pixe/"                               
221          << file                                  
222          << '/'                                   
223          << shellString                           
224          << '/'                                   
225          << shellModel                            
226          << '/'                                   
227          << subShell                              
228          << '-' ;                                 
229 //         << z                                   
230   //       << ".dat";                             
231                                                   
232   G4String test(fullFileName.str().c_str());      
233   // std::cout << "PixeShellDataSet - Reading     
234                                                   
235   return G4String(fullFileName.str().c_str());    
236 }                                                 
237                                                   
238 G4int G4PixeShellDataSet::TranslateShell(const    
239 {                                                 
240   // By default return K shell                    
241   G4int index = 0;                                
242                                                   
243   if (subShell == "l1" || subShell == "l2" ||     
244   if (subShell == "m1" ||                         
245       subShell == "m2" ||                         
246       subShell == "m3" ||                         
247       subShell == "m4" ||                         
248       subShell == "m5" ) index = 2;               
249   return index;                                   
250 }                                                 
251