Geant4 Cross Reference |
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 // MR - 04/04/2012 26 // MR - 04/04/2012 27 // Based on G4DNACrossSectionDataSet 27 // Based on G4DNACrossSectionDataSet 28 // 28 // 29 29 30 30 31 #include "G4MicroElecCrossSectionDataSet.hh" 31 #include "G4MicroElecCrossSectionDataSet.hh" 32 #include "G4VDataSetAlgorithm.hh" 32 #include "G4VDataSetAlgorithm.hh" 33 #include "G4EMDataSet.hh" 33 #include "G4EMDataSet.hh" 34 #include <vector> 34 #include <vector> 35 #include <fstream> 35 #include <fstream> 36 #include <sstream> 36 #include <sstream> 37 37 38 38 39 G4MicroElecCrossSectionDataSet::G4MicroElecCro 39 G4MicroElecCrossSectionDataSet::G4MicroElecCrossSectionDataSet(G4VDataSetAlgorithm* argAlgorithm, 40 G4double argUnitEnergies, 40 G4double argUnitEnergies, 41 G4double argUnitData) 41 G4double argUnitData) 42 : 42 : 43 algorithm(argAlgorithm), unitEnergies(argUn 43 algorithm(argAlgorithm), unitEnergies(argUnitEnergies), unitData(argUnitData) 44 {;} << 44 { >> 45 z = 0; >> 46 >> 47 } >> 48 45 49 46 //....oooOO0OOooo........oooOO0OOooo........oo << 47 G4MicroElecCrossSectionDataSet::~G4MicroElecCr 50 G4MicroElecCrossSectionDataSet::~G4MicroElecCrossSectionDataSet() 48 { 51 { 49 CleanUpComponents(); 52 CleanUpComponents(); 50 53 51 if (algorithm) 54 if (algorithm) 52 delete algorithm; 55 delete algorithm; 53 } 56 } 54 57 55 //....oooOO0OOooo........oooOO0OOooo........oo << 56 G4bool G4MicroElecCrossSectionDataSet::LoadDat 58 G4bool G4MicroElecCrossSectionDataSet::LoadData(const G4String & argFileName) 57 { 59 { 58 CleanUpComponents(); 60 CleanUpComponents(); 59 61 60 G4String fullFileName(FullFileName(argFileNa 62 G4String fullFileName(FullFileName(argFileName)); 61 std::ifstream in(fullFileName, std::ifstream 63 std::ifstream in(fullFileName, std::ifstream::binary|std::ifstream::in); 62 64 63 if (!in.is_open()) 65 if (!in.is_open()) 64 { 66 { 65 G4String message("Data file \""); 67 G4String message("Data file \""); 66 message+=fullFileName; 68 message+=fullFileName; 67 message+="\" not found"; 69 message+="\" not found"; 68 G4Exception("G4MicroElecCrossSectionData 70 G4Exception("G4MicroElecCrossSectionDataSet::LoadData","em0003", 69 FatalException,message); 71 FatalException,message); 70 return false; 72 return false; 71 } 73 } 72 74 73 std::vector<G4DataVector *> columns; 75 std::vector<G4DataVector *> columns; 74 std::vector<G4DataVector *> log_columns; 76 std::vector<G4DataVector *> log_columns; 75 77 76 std::stringstream *stream(new std::stringstr 78 std::stringstream *stream(new std::stringstream); 77 char c; 79 char c; 78 G4bool comment(false); 80 G4bool comment(false); 79 G4bool space(true); 81 G4bool space(true); 80 G4bool first(true); 82 G4bool first(true); 81 83 82 try 84 try 83 { 85 { 84 while (!in.eof()) 86 while (!in.eof()) 85 { 87 { 86 in.get(c); 88 in.get(c); 87 89 88 switch (c) 90 switch (c) 89 { 91 { 90 case '\r': 92 case '\r': 91 case '\n': 93 case '\n': 92 if (!first) 94 if (!first) 93 { 95 { 94 unsigned long i(0); 96 unsigned long i(0); 95 G4double value; 97 G4double value; 96 98 97 while (!stream->eof()) 99 while (!stream->eof()) 98 { 100 { 99 (*stream) >> value; 101 (*stream) >> value; 100 102 101 while (i>=columns.size()) 103 while (i>=columns.size()) 102 { 104 { 103 columns.push_back(new G4DataVector); 105 columns.push_back(new G4DataVector); 104 log_columns.push_back 106 log_columns.push_back(new G4DataVector); 105 } 107 } 106 108 107 columns[i]->push_back(value); 109 columns[i]->push_back(value); 108 // N. A. Karakatsanis << 110 109 // A condition is applied to check i << 111 // N. A. Karakatsanis 110 // If yes, then a near-zero value is << 112 // A condition is applied to check if negative or zero values are present in the dataset. 111 // If a value is zero, this simplifi << 113 // If yes, then a near-zero value is applied to allow the computation of the logarithmic value 112 // If a value is negative, then it i << 114 // If a value is zero, this simplification is acceptable 113 // logarithmic values should not be << 115 // If a value is negative, then it is not acceptable and the data of the particular column of 114 // << 116 // logarithmic values should not be used by interpolation methods. 115 // Therefore, G4LogLogInterpolation << 117 // 116 // Instead, G4LinInterpolation is sa << 118 // Therefore, G4LogLogInterpolation and G4LinLogLogInterpolation should not be used if negative values are present. 117 // SemiLogInterpolation is safe only << 119 // Instead, G4LinInterpolation is safe in every case 118 // G4LinLogInterpolation is safe onl << 120 // SemiLogInterpolation is safe only if the energy columns are non-negative >> 121 // G4LinLogInterpolation is safe only if the cross section data columns are non-negative 119 122 120 if (value <=0.) value = 123 if (value <=0.) value = 1e-300; 121 log_columns[i]->push_bac 124 log_columns[i]->push_back(std::log10(value)); 122 125 123 ++i; << 126 i++; 124 } << 127 } >> 128 125 delete stream; 129 delete stream; 126 stream=new std::stringstream; 130 stream=new std::stringstream; 127 } 131 } 128 first=true; << 132 129 comment=false; << 133 first=true; 130 space=true; << 134 comment=false; 131 break; << 135 space=true; 132 << 136 break; >> 137 133 case '#': 138 case '#': 134 comment=true; 139 comment=true; 135 break; << 140 break; >> 141 136 case '\t': 142 case '\t': 137 case ' ': 143 case ' ': 138 space = true; 144 space = true; 139 break; << 145 break; >> 146 140 default: 147 default: 141 if (comment) { break; } 148 if (comment) { break; } 142 if (space && (!first)) { (*stream) << << 149 if (space && (!first)) { (*stream) << ' '; } >> 150 143 first=false; 151 first=false; 144 (*stream) << c; 152 (*stream) << c; 145 space=false; 153 space=false; 146 } 154 } 147 } 155 } 148 } 156 } 149 catch(const std::ios::failure &e) 157 catch(const std::ios::failure &e) 150 { 158 { 151 // some implementations of STL could thr 159 // some implementations of STL could throw a "failture" exception 152 // when read wants read characters after 160 // when read wants read characters after end of file 153 } 161 } 154 162 155 delete stream; 163 delete stream; 156 164 157 std::size_t maxI(columns.size()); << 165 std::vector<G4DataVector *>::size_type maxI(columns.size()); 158 166 159 if (maxI<2) 167 if (maxI<2) 160 { 168 { 161 G4String message("Data file \""); 169 G4String message("Data file \""); 162 message+=fullFileName; 170 message+=fullFileName; 163 message+="\" should have at least two co 171 message+="\" should have at least two columns"; 164 G4Exception("G4MicroElecCrossSectionData 172 G4Exception("G4MicroElecCrossSectionDataSet::LoadData","em0005", 165 FatalException,message); 173 FatalException,message); 166 return false; 174 return false; 167 } 175 } 168 176 169 std::size_t i(1); << 177 std::vector<G4DataVector*>::size_type i(1); 170 while (i<maxI) 178 while (i<maxI) 171 { 179 { 172 std::size_t maxJ(columns[i]->size()); << 180 G4DataVector::size_type maxJ(columns[i]->size()); 173 181 174 if (maxJ!=columns[0]->size()) 182 if (maxJ!=columns[0]->size()) 175 { 183 { 176 G4String message("Data file \""); 184 G4String message("Data file \""); 177 message+=fullFileName; 185 message+=fullFileName; 178 message+="\" has lines with a different nu 186 message+="\" has lines with a different number of columns"; 179 G4Exception("G4MicroElecCrossSectionDataSe 187 G4Exception("G4MicroElecCrossSectionDataSet::LoadData","em0005", 180 FatalException,message); 188 FatalException,message); 181 return false; 189 return false; 182 } 190 } 183 191 184 std::size_t j(0); << 192 G4DataVector::size_type j(0); 185 << 193 186 G4DataVector *argEnergies=new G4DataVect 194 G4DataVector *argEnergies=new G4DataVector; 187 G4DataVector *argData=new G4DataVector; 195 G4DataVector *argData=new G4DataVector; 188 G4DataVector *argLogEnergies=new G4DataV 196 G4DataVector *argLogEnergies=new G4DataVector; 189 G4DataVector *argLogData=new G4DataVecto 197 G4DataVector *argLogData=new G4DataVector; 190 << 198 191 while(j<maxJ) 199 while(j<maxJ) 192 { 200 { 193 argEnergies->push_back(columns[0]->operato 201 argEnergies->push_back(columns[0]->operator[] (j)*GetUnitEnergies()); 194 argData->push_back(columns[i]->operator[] 202 argData->push_back(columns[i]->operator[] (j)*GetUnitData()); 195 argLogEnergies->push_back(log_columns[0]-> 203 argLogEnergies->push_back(log_columns[0]->operator[] (j) + std::log10(GetUnitEnergies())); 196 argLogData->push_back(log_columns[i]->oper 204 argLogData->push_back(log_columns[i]->operator[] (j) + std::log10(GetUnitData())); 197 j++; 205 j++; 198 } 206 } 199 << 207 200 AddComponent(new G4EMDataSet(G4int(i-1), << 208 AddComponent(new G4EMDataSet(i-1, argEnergies, argData, argLogEnergies, argLogData, GetAlgorithm()->Clone(), GetUnitEnergies(), GetUnitData())); 201 GetAlgorithm()->Clone(), GetUnitEne << 202 209 203 ++i; << 210 i++; 204 } 211 } 205 212 206 i=maxI; 213 i=maxI; 207 while (i>0) 214 while (i>0) 208 { 215 { 209 --i; << 216 i--; 210 delete columns[i]; 217 delete columns[i]; 211 delete log_columns[i]; 218 delete log_columns[i]; 212 } 219 } 213 220 214 return true; 221 return true; 215 } 222 } 216 223 217 //....oooOO0OOooo........oooOO0OOooo........oo << 218 224 219 G4bool G4MicroElecCrossSectionDataSet::LoadNon 225 G4bool G4MicroElecCrossSectionDataSet::LoadNonLogData(const G4String & argFileName) 220 { 226 { 221 CleanUpComponents(); 227 CleanUpComponents(); 222 228 223 G4String fullFileName(FullFileName(argFileNa 229 G4String fullFileName(FullFileName(argFileName)); 224 std::ifstream in(fullFileName, std::ifstream 230 std::ifstream in(fullFileName, std::ifstream::binary|std::ifstream::in); 225 231 226 if (!in.is_open()) 232 if (!in.is_open()) 227 { 233 { 228 G4String message("Data file \""); 234 G4String message("Data file \""); 229 message+=fullFileName; 235 message+=fullFileName; 230 message+="\" not found"; 236 message+="\" not found"; 231 G4Exception("G4MicroElecCrossSectionData 237 G4Exception("G4MicroElecCrossSectionDataSet::LoadData","em0003", 232 FatalException,message); 238 FatalException,message); 233 return false; 239 return false; 234 } 240 } 235 241 236 std::vector<G4DataVector *> columns; 242 std::vector<G4DataVector *> columns; 237 243 238 std::stringstream *stream(new std::stringstr 244 std::stringstream *stream(new std::stringstream); 239 char c; 245 char c; 240 G4bool comment(false); 246 G4bool comment(false); 241 G4bool space(true); 247 G4bool space(true); 242 G4bool first(true); 248 G4bool first(true); 243 249 244 try 250 try 245 { 251 { 246 while (!in.eof()) 252 while (!in.eof()) 247 { 253 { 248 in.get(c); 254 in.get(c); 249 255 250 switch (c) 256 switch (c) 251 { 257 { 252 case '\r': 258 case '\r': 253 case '\n': 259 case '\n': 254 if (!first) 260 if (!first) 255 { 261 { 256 unsigned long i(0); 262 unsigned long i(0); 257 G4double value; 263 G4double value; 258 264 259 while (!stream->eof()) 265 while (!stream->eof()) 260 { 266 { 261 (*stream) >> value; 267 (*stream) >> value; 262 268 263 while (i>=columns.size()) 269 while (i>=columns.size()) 264 { 270 { 265 columns.push_back(new G4DataVector); 271 columns.push_back(new G4DataVector); 266 } 272 } 267 273 268 columns[i]->push_back(value); 274 columns[i]->push_back(value); 269 275 270 i++; 276 i++; 271 } 277 } 272 278 273 delete stream; 279 delete stream; 274 stream=new std::stringstream; 280 stream=new std::stringstream; 275 } 281 } 276 282 277 first=true; 283 first=true; 278 comment=false; 284 comment=false; 279 space=true; 285 space=true; 280 break; 286 break; 281 287 282 case '#': 288 case '#': 283 comment=true; 289 comment=true; 284 break; 290 break; 285 291 286 case '\t': 292 case '\t': 287 case ' ': 293 case ' ': 288 space = true; 294 space = true; 289 break; 295 break; 290 296 291 default: 297 default: 292 if (comment) { break; } 298 if (comment) { break; } 293 if (space && (!first)) { (*stream) << 299 if (space && (!first)) { (*stream) << ' '; } 294 300 295 first=false; 301 first=false; 296 (*stream) << c; 302 (*stream) << c; 297 space=false; 303 space=false; 298 } 304 } 299 } 305 } 300 } 306 } 301 catch(const std::ios::failure &e) 307 catch(const std::ios::failure &e) 302 { 308 { 303 // some implementations of STL could thr 309 // some implementations of STL could throw a "failture" exception 304 // when read wants read characters after 310 // when read wants read characters after end of file 305 } 311 } 306 312 307 delete stream; 313 delete stream; 308 314 309 std::size_t maxI(columns.size()); << 315 std::vector<G4DataVector *>::size_type maxI(columns.size()); 310 316 311 if (maxI<2) 317 if (maxI<2) 312 { 318 { 313 G4String message("Data file \""); 319 G4String message("Data file \""); 314 message+=fullFileName; 320 message+=fullFileName; 315 message+="\" should have at least two co 321 message+="\" should have at least two columns"; 316 G4Exception("G4MicroElecCrossSectionData 322 G4Exception("G4MicroElecCrossSectionDataSet::LoadData","em0005", 317 FatalException,message); 323 FatalException,message); 318 return false; 324 return false; 319 } 325 } 320 326 321 std::size_t i(1); << 327 std::vector<G4DataVector*>::size_type i(1); 322 while (i<maxI) 328 while (i<maxI) 323 { 329 { 324 std::size_t maxJ(columns[i]->size()); << 330 G4DataVector::size_type maxJ(columns[i]->size()); 325 331 326 if (maxJ!=columns[0]->size()) 332 if (maxJ!=columns[0]->size()) 327 { 333 { 328 G4String message("Data file \""); 334 G4String message("Data file \""); 329 message+=fullFileName; 335 message+=fullFileName; 330 message+="\" has lines with a different nu 336 message+="\" has lines with a different number of columns."; 331 G4Exception("G4MicroElecCrossSection 337 G4Exception("G4MicroElecCrossSectionDataSet::LoadData","em0005", 332 FatalException,message); 338 FatalException,message); 333 return false; 339 return false; 334 } 340 } 335 341 336 std::size_t j(0); << 342 G4DataVector::size_type j(0); 337 343 338 G4DataVector *argEnergies=new G4DataVect 344 G4DataVector *argEnergies=new G4DataVector; 339 G4DataVector *argData=new G4DataVector; 345 G4DataVector *argData=new G4DataVector; 340 346 341 while(j<maxJ) 347 while(j<maxJ) 342 { 348 { 343 argEnergies->push_back(columns[0]->operato 349 argEnergies->push_back(columns[0]->operator[] (j)*GetUnitEnergies()); 344 argData->push_back(columns[i]->operator[] 350 argData->push_back(columns[i]->operator[] (j)*GetUnitData()); 345 j++; 351 j++; 346 } 352 } 347 353 348 AddComponent(new G4EMDataSet(G4int(i-1), << 354 AddComponent(new G4EMDataSet(i-1, argEnergies, argData, GetAlgorithm()->Clone(), GetUnitEnergies(), GetUnitData())); 349 355 350 i++; 356 i++; 351 } 357 } 352 358 353 i=maxI; 359 i=maxI; 354 while (i>0) 360 while (i>0) 355 { 361 { 356 i--; 362 i--; 357 delete columns[i]; 363 delete columns[i]; 358 } 364 } 359 365 360 return true; 366 return true; 361 } 367 } 362 368 363 //....oooOO0OOooo........oooOO0OOooo........oo << 364 369 365 G4bool G4MicroElecCrossSectionDataSet::SaveDat 370 G4bool G4MicroElecCrossSectionDataSet::SaveData(const G4String & argFileName) const 366 { 371 { 367 const std::size_t n(NumberOfComponents()); << 372 const size_t n(NumberOfComponents()); >> 373 368 if (n==0) 374 if (n==0) 369 { 375 { 370 G4Exception("G4MicroElecCrossSectionData 376 G4Exception("G4MicroElecCrossSectionDataSet::SaveData","em0005", 371 FatalException,"Expected 377 FatalException,"Expected at least one component"); 372 378 373 return false; 379 return false; 374 } 380 } 375 381 376 G4String fullFileName(FullFileName(argFileNa 382 G4String fullFileName(FullFileName(argFileName)); 377 std::ofstream out(fullFileName); 383 std::ofstream out(fullFileName); 378 384 379 if (!out.is_open()) 385 if (!out.is_open()) 380 { 386 { 381 G4String message("Cannot open \""); 387 G4String message("Cannot open \""); 382 message+=fullFileName; 388 message+=fullFileName; 383 message+="\""; 389 message+="\""; 384 G4Exception("G4MicroElecCrossSectionData 390 G4Exception("G4MicroElecCrossSectionDataSet::SaveData","em0005", 385 FatalException,message); 391 FatalException,message); 386 return false; 392 return false; 387 } 393 } 388 394 389 G4DataVector::const_iterator iEnergies(GetCo 395 G4DataVector::const_iterator iEnergies(GetComponent(0)->GetEnergies(0).begin()); 390 G4DataVector::const_iterator iEnergiesEnd(Ge 396 G4DataVector::const_iterator iEnergiesEnd(GetComponent(0)->GetEnergies(0).end()); 391 G4DataVector::const_iterator * iData(new G4D 397 G4DataVector::const_iterator * iData(new G4DataVector::const_iterator[n]); 392 398 393 std::size_t k(n); << 399 size_t k(n); 394 400 395 while (k>0) 401 while (k>0) 396 { 402 { 397 k--; 403 k--; 398 iData[k]=GetComponent((G4int)k)->GetData << 404 iData[k]=GetComponent(k)->GetData(0).begin(); 399 } 405 } 400 406 401 while (iEnergies!=iEnergiesEnd) 407 while (iEnergies!=iEnergiesEnd) 402 { 408 { 403 out.precision(10); 409 out.precision(10); 404 out.width(15); 410 out.width(15); 405 out.setf(std::ofstream::left); 411 out.setf(std::ofstream::left); 406 out << ((*iEnergies)/GetUnitEnergies()); 412 out << ((*iEnergies)/GetUnitEnergies()); 407 413 408 k=0; 414 k=0; 409 415 410 while (k<n) 416 while (k<n) 411 { 417 { 412 out << ' '; 418 out << ' '; 413 out.precision(10); 419 out.precision(10); 414 out.width(15); 420 out.width(15); 415 out.setf(std::ofstream::left); 421 out.setf(std::ofstream::left); 416 out << ((*(iData[k]))/GetUnitData()); 422 out << ((*(iData[k]))/GetUnitData()); 417 423 418 iData[k]++; 424 iData[k]++; 419 k++; 425 k++; 420 } 426 } 421 out << std::endl; << 427 >> 428 out << std::endl; >> 429 422 iEnergies++; 430 iEnergies++; 423 } 431 } >> 432 424 delete[] iData; 433 delete[] iData; 425 434 426 return true; 435 return true; 427 } 436 } 428 437 429 //....oooOO0OOooo........oooOO0OOooo........oo << 430 438 431 G4String G4MicroElecCrossSectionDataSet::FullF 439 G4String G4MicroElecCrossSectionDataSet::FullFileName(const G4String& argFileName) const 432 { 440 { 433 const char* path = G4FindDataDir("G4LEDATA") << 441 char* path = std::getenv("G4LEDATA"); 434 if (!path) 442 if (!path) 435 { 443 { 436 G4Exception("G4MicroElecCrossSectionData 444 G4Exception("G4MicroElecCrossSectionDataSet::FullFileName","em0006", 437 FatalException,"G4LEDATA 445 FatalException,"G4LEDATA environment variable not set."); 438 446 439 return ""; 447 return ""; 440 } 448 } 441 449 442 std::ostringstream fullFileName; 450 std::ostringstream fullFileName; 443 451 444 fullFileName << path << "/" << argFileName < 452 fullFileName << path << "/" << argFileName << ".dat"; 445 453 446 return G4String(fullFileName.str().c_str()); 454 return G4String(fullFileName.str().c_str()); 447 } 455 } 448 456 449 //....oooOO0OOooo........oooOO0OOooo........oo << 450 457 451 G4double G4MicroElecCrossSectionDataSet::FindV 458 G4double G4MicroElecCrossSectionDataSet::FindValue(G4double argEnergy, G4int /* argComponentId */) const 452 { 459 { 453 // Returns the sum over the shells correspon 460 // Returns the sum over the shells corresponding to e 454 G4double value = 0.; 461 G4double value = 0.; 455 462 456 std::vector<G4VEMDataSet *>::const_iterator 463 std::vector<G4VEMDataSet *>::const_iterator i(components.begin()); 457 std::vector<G4VEMDataSet *>::const_iterator 464 std::vector<G4VEMDataSet *>::const_iterator end(components.end()); 458 465 459 while (i!=end) 466 while (i!=end) 460 { 467 { 461 value+=(*i)->FindValue(argEnergy); 468 value+=(*i)->FindValue(argEnergy); 462 i++; 469 i++; 463 } 470 } 464 471 465 return value; 472 return value; 466 } 473 } 467 474 468 //....oooOO0OOooo........oooOO0OOooo........oo << 469 475 470 void G4MicroElecCrossSectionDataSet::PrintData 476 void G4MicroElecCrossSectionDataSet::PrintData(void) const 471 { 477 { 472 const std::size_t n(NumberOfComponents()); << 478 const size_t n(NumberOfComponents()); 473 479 474 G4cout << "The data set has " << n << " comp 480 G4cout << "The data set has " << n << " components" << G4endl; 475 G4cout << G4endl; 481 G4cout << G4endl; 476 482 477 G4int i(0); << 483 size_t i(0); 478 484 479 while (i<(G4int)n) << 485 while (i<n) 480 { 486 { 481 G4cout << "--- Component " << i << " --- 487 G4cout << "--- Component " << i << " ---" << G4endl; 482 GetComponent(i)->PrintData(); 488 GetComponent(i)->PrintData(); 483 i++; 489 i++; 484 } 490 } 485 } 491 } 486 492 487 //....oooOO0OOooo........oooOO0OOooo........oo << 488 493 489 void G4MicroElecCrossSectionDataSet::SetEnergi 494 void G4MicroElecCrossSectionDataSet::SetEnergiesData(G4DataVector* argEnergies, 490 G4DataVector* argData, 495 G4DataVector* argData, 491 G4int argComponentId) 496 G4int argComponentId) 492 { 497 { 493 G4VEMDataSet * component(components[argCompo 498 G4VEMDataSet * component(components[argComponentId]); 494 499 495 if (component) 500 if (component) 496 { 501 { 497 component->SetEnergiesData(argEnergies, 502 component->SetEnergiesData(argEnergies, argData, 0); 498 return; 503 return; 499 } 504 } 500 505 501 std::ostringstream message; 506 std::ostringstream message; 502 message << "Component " << argComponentId << 507 message << "Component " << argComponentId << " not found"; 503 508 504 G4Exception("G4MicroElecCrossSectionDataSet: 509 G4Exception("G4MicroElecCrossSectionDataSet::SetEnergiesData","em0005", 505 FatalException,message.str(). 510 FatalException,message.str().c_str()); 506 511 507 } 512 } 508 513 509 //....oooOO0OOooo........oooOO0OOooo........oo << 510 514 511 void G4MicroElecCrossSectionDataSet::SetLogEne 515 void G4MicroElecCrossSectionDataSet::SetLogEnergiesData(G4DataVector* argEnergies, 512 G4DataVector* argData, 516 G4DataVector* argData, 513 G4Dat 517 G4DataVector* argLogEnergies, 514 G4Dat 518 G4DataVector* argLogData, 515 G4int argComponentId) 519 G4int argComponentId) 516 { 520 { 517 G4VEMDataSet * component(components[argCompo 521 G4VEMDataSet * component(components[argComponentId]); 518 522 519 if (component) 523 if (component) 520 { 524 { 521 component->SetLogEnergiesData(argEnergie 525 component->SetLogEnergiesData(argEnergies, argData, argLogEnergies, argLogData, 0); 522 return; 526 return; 523 } 527 } 524 528 525 std::ostringstream message; 529 std::ostringstream message; 526 message << "Component " << argComponentId << 530 message << "Component " << argComponentId << " not found"; 527 531 528 G4Exception("G4MicroElecCrossSectionDataSet: 532 G4Exception("G4MicroElecCrossSectionDataSet::SetLogEnergiesData","em0005", 529 FatalException,message.str(). 533 FatalException,message.str().c_str()); 530 534 531 } 535 } 532 536 533 //....oooOO0OOooo........oooOO0OOooo........oo << 534 537 535 void G4MicroElecCrossSectionDataSet::CleanUpCo 538 void G4MicroElecCrossSectionDataSet::CleanUpComponents() 536 { 539 { 537 while (!components.empty()) 540 while (!components.empty()) 538 { 541 { 539 if (components.back()) delete components 542 if (components.back()) delete components.back(); 540 components.pop_back(); 543 components.pop_back(); 541 } 544 } 542 } 545 } 543 546 544 547 545 548