source: trunk/source/processes/hadronic/models/incl/src/G4InclAblaDataFile.cc@ 1344

Last change on this file since 1344 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 5.1 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// $Id: G4InclAblaDataFile.cc,v 1.9 2010/06/14 16:10:01 gcosmo Exp $
27// Translation of INCL4.2/ABLA V3
28// Pekka Kaitaniemi, HIP (translation)
29// Christelle Schmidt, IPNL (fission code)
30// Alain Boudard, CEA (contact person INCL/ABLA)
31// Aatos Heikkinen, HIP (project coordination)
32
33#include "G4InclAblaDataFile.hh"
34//#include "G4HadronicException.hh"
35#include "globals.hh" // Needed for G4Exception.
36#include <fstream>
37
38G4InclAblaDataFile::G4InclAblaDataFile() : G4InclAblaVirtualData()
39{
40 verboseLevel = 0;
41}
42
43G4InclAblaDataFile::~G4InclAblaDataFile()
44{
45}
46
47/**
48 * Read all data from files.
49 */
50bool G4InclAblaDataFile::readData()
51{
52 if(!getenv("G4ABLADATA")) {
53 // throw G4HadronicException(__FILE__, __LINE__, "ERROR: Data
54 // missing. Set environment variable G4ABLA3.0 to point to the
55 // directory containing data files needed by INCL and ABLA
56 // models.");
57 G4String errorMessage1 = "ERROR: Data missing. Set environment variable G4ABLADATA\n";
58 G4String errorMessage2 = "\t to point to the directory containing data files needed\n";
59 G4String errorMessage3 = "\t by INCL and ABLA models.\n";
60 G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3;
61 G4Exception(errorMessage);
62 }
63
64 G4String dataPath(getenv("G4ABLADATA"));
65 G4String flAlphaFile(dataPath + "/flalpha.dat");
66 G4String frldmFile( dataPath + "/frldm.dat");
67 G4String vgsldFile( dataPath + "/vgsld.dat");
68 G4String pace2File( dataPath + "/pace2.dat");
69
70 if(verboseLevel > 1) {
71 G4cout <<"Data path = " << dataPath << G4endl;
72 G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl;
73 G4cout <<"FrldmFile = " << frldmFile << G4endl;
74 G4cout <<"VgsldFile = " << vgsldFile << G4endl;
75 G4cout <<"Pace2File = " << pace2File << G4endl;
76 }
77
78 std::ifstream flalphain(flAlphaFile.c_str());
79 std::ifstream frldmin(frldmFile.c_str());
80 std::ifstream vgsldin(vgsldFile.c_str());
81 std::ifstream pace2in(pace2File.c_str());
82
83 std::filebuf *buf1 = flalphain.rdbuf();
84 std::filebuf *buf2 = frldmin.rdbuf();
85 std::filebuf *buf3 = vgsldin.rdbuf();
86 std::filebuf *buf4 = pace2in.rdbuf();
87 if (!((buf1->is_open()) && (buf2->is_open()) && (buf3->is_open()) && (buf4->is_open()))) {
88 G4Exception("ERROR: Data missing. Could not find ABLA data file in " + dataPath +
89 " defined by environment variable G4ABLADATA");
90 }
91
92 G4double flalpha, frldm, vgsld, pace2;
93 const G4int rows = 99;
94 const G4int cols = 154;
95 const G4int massnumbers = 263;
96 for(int i = 0; i < rows; i++) {
97 for(int j = 0; j < cols; j++) {
98 setAlpha(j, i, 0.0);
99 setEcnz( j, i, 0.0);
100 setVgsld(j, i, 0.0);
101 }
102 }
103
104 for(int i = 0; i < rows; i++) {
105 for(int j = 0; j < cols; j++) {
106 flalphain >> flalpha;
107 frldmin >> frldm;
108 vgsldin >> vgsld;
109 setAlpha(j, i, flalpha);
110 setEcnz( j, i, frldm);
111 setVgsld(j, i, vgsld);
112 }
113 }
114 flalphain.close();
115 frldmin.close();
116 vgsldin.close();
117
118 int A = 0, Zbegin = 0, Zend = 0;
119 G4String str1, str2, str3;
120 for(int i = 0; i < 500; i++) {
121 for(int j = 0; j < 500; j++) {
122 setPace2(i, j, 0.0);
123 }
124 }
125
126 for(int i = 0; i < massnumbers; i++) {
127 pace2in >> str1 >> A >> str2 >> Zbegin >> str3 >> Zend;
128 for(int j = Zbegin; j <= Zend; j++) {
129 pace2in >> pace2;
130 setPace2(A, j, pace2);
131 }
132 }
133 pace2in.close();
134 if(std::fabs(getPace2(A, Zend) - 114516.10) > 1e-6) {
135 G4cout <<"ERROR: Problem in parsing datafile " + pace2File << G4endl;
136 return false;
137 }
138
139 return true;
140}
141
142
Note: See TracBrowser for help on using the repository browser.