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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/hadronic/models/abla/src/G4AblaDataFile.cc (Version 11.3.0) and /processes/hadronic/models/abla/src/G4AblaDataFile.cc (Version 10.4.p2)


  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 // ABLAXX statistical de-excitation model          26 // ABLAXX statistical de-excitation model
 27 // Jose Luis Rodriguez, UDC (translation from  <<  27 // Jose Luis Rodriguez, CEA (translation from ABLA07 and contact person)
 28 // Pekka Kaitaniemi, HIP (initial translation  <<  28 // Pekka Kaitaniemi, HIP (translation)
 29 // Aleksandra Kelic, GSI (ABLA07 code)         <<  29 // Christelle Schmidt, IPNL (fission code)
 30 // Davide Mancusi, CEA (contact person INCL)       30 // Davide Mancusi, CEA (contact person INCL)
 31 // Aatos Heikkinen, HIP (project coordination)     31 // Aatos Heikkinen, HIP (project coordination)
 32 //                                                 32 //
                                                   >>  33 #define ABLAXX_IN_GEANT4_MODE 1
 33                                                    34 
 34 #include "G4AblaDataFile.hh"                   << 
 35 #include "G4AblaDataDefs.hh"                   << 
 36 #include "globals.hh"                              35 #include "globals.hh"
 37                                                    36 
 38 #include <cmath>                               <<  37 #include "G4AblaDataFile.hh"
 39 #include <cstdlib>                             <<  38 //#include "G4HadronicException.hh"
                                                   >>  39 #ifdef ABLAXX_IN_GEANT4_MODE
                                                   >>  40 #include "globals.hh"
                                                   >>  41 #else
                                                   >>  42 #include "G4INCLGeant4Compat.hh"
                                                   >>  43 #endif
 40 #include <fstream>                                 44 #include <fstream>
                                                   >>  45 #include <cmath>
 41 #include <iostream>                                46 #include <iostream>
                                                   >>  47 #include <cstdlib>
                                                   >>  48 
                                                   >>  49 #ifdef ABLAXX_IN_GEANT4_MODE
                                                   >>  50 G4AblaDataFile::G4AblaDataFile() {
                                                   >>  51 #else
                                                   >>  52 G4AblaDataFile::G4AblaDataFile(G4INCL::Config *config)
                                                   >>  53   : G4AblaVirtualData(config) {
                                                   >>  54   theConfig = config;
                                                   >>  55 #endif
                                                   >>  56   verboseLevel = 0;
                                                   >>  57 }
 42                                                    58 
 43 G4AblaDataFile::G4AblaDataFile() { verboseLeve <<  59 G4AblaDataFile::~G4AblaDataFile()
                                                   >>  60 {
                                                   >>  61 }
 44                                                    62 
 45 /**                                                63 /**
 46  * Read all data from files.                       64  * Read all data from files.
 47  */                                                65  */
 48 G4bool G4AblaDataFile::readData()              <<  66 bool G4AblaDataFile::readData()
 49 {                                                  67 {
 50     if (!G4FindDataDir("G4ABLADATA"))          <<  68 #ifdef ABLAXX_IN_GEANT4_MODE
 51     {                                          <<  69   if(!getenv("G4ABLADATA")) {
 52         G4ExceptionDescription ed;             <<  70     //    throw G4HadronicException(__FILE__, __LINE__, "ERROR: Data
 53         ed << " Data missing: set environment  <<  71     //    missing. Set environment variable G4ABLA3.0 to point to the
 54            << " to point to the directory cont <<  72     //    directory containing data files needed by INCL and ABLA
 55            << " by the ABLA model" << G4endl;  <<  73     //    models.");
 56         G4Exception("G4AblaDataFile::readData( <<  74     // G4String errorMessage1 = "ERROR: Data missing. Set environment variable G4ABLADATA\n";
 57     }                                          <<  75     // G4String errorMessage2 = "\t to point to the directory containing data files needed\n";
 58     G4String dataPath(G4FindDataDir("G4ABLADAT <<  76     // G4String errorMessage3 = "\t by INCL and ABLA models.\n";
 59                                                <<  77     // G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3;
 60     G4String flAlphaFile(dataPath + "/flalpha. <<  78     // G4Exception(errorMessage);
 61     G4String frldmFile(dataPath + "/frldm.dat" <<  79     G4ExceptionDescription ed;
 62     G4String vgsldFile(dataPath + "/vgsld.dat" <<  80     ed << " Data missing: set environment variable G4ABLADATA\n"
 63     G4String rmsFile(dataPath + "/rms.dat");   <<  81        << " to point to the directory containing data files needed\n"
 64     G4String defoFile(dataPath + "/defo.dat"); <<  82        << " by the ABLA model" << G4endl;
 65     G4String massFile(dataPath + "/mass2020.da <<  83     G4Exception("G4AblaDataFile::readData()","ABLA_001",
 66                                                <<  84                 FatalException, ed);
 67     if (verboseLevel > 1)                      <<  85   }
 68     {                                          <<  86   G4String dataPath(getenv("G4ABLADATA"));
 69         // G4cout <<"Data path   = " << dataPa <<  87 #else
 70         // G4cout <<"FlAlphaFile = " << flAlph <<  88   G4String dataPath(theConfig->getABLAXXDataFilePath().c_str());
 71         // G4cout <<"FrldmFile   = " << frldmF <<  89 #endif
 72         // G4cout <<"VgsldFile   = " << vgsldF <<  90   G4String flAlphaFile(dataPath + "/flalpha.dat");
 73     }                                          <<  91   G4String frldmFile(  dataPath + "/frldm.dat");
 74                                                <<  92   G4String vgsldFile(  dataPath + "/vgsld.dat");
 75     std::ifstream flalphain(flAlphaFile.c_str( <<  93   G4String pace2File(  dataPath + "/pace2.dat");
 76     std::ifstream frldmin(frldmFile.c_str());  <<  94   G4String rmsFile(  dataPath + "/rms.dat");
 77     std::ifstream vgsldin(vgsldFile.c_str());  <<  95   G4String defoFile(  dataPath + "/defo.dat");
 78     std::ifstream rmsin(rmsFile.c_str());      <<  96   G4String massFile(  dataPath + "/mass2003.dat");
 79     std::ifstream defoin(defoFile.c_str());    <<  97 
 80     std::ifstream massin(massFile.c_str());    <<  98   if(verboseLevel > 1) {
 81                                                <<  99     // G4cout <<"Data path   = " << dataPath    << G4endl;
 82     if (!massin.is_open())                     << 100     // G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl;
 83     {                                          << 101     // G4cout <<"FrldmFile   = " << frldmFile   << G4endl;
 84         massFile = dataPath + "/mass2016.dat"; << 102     // G4cout <<"VgsldFile   = " << vgsldFile   << G4endl;
 85         massin.close();                        << 103     // G4cout <<"Pace2File   = " << pace2File   << G4endl;
 86         massin.open(massFile.c_str());         << 104   }
 87         std::cout << "Mass evaluation file mas << 105   
 88                                                << 106   std::ifstream flalphain(flAlphaFile.c_str());
 89         if (!massin.is_open())                 << 107   std::ifstream frldmin(frldmFile.c_str());  
 90         {                                      << 108   std::ifstream vgsldin(vgsldFile.c_str());  
 91             massFile = dataPath + "/mass2003.d << 109   std::ifstream pace2in(pace2File.c_str());
 92             massin.close();                    << 110   std::ifstream rmsin(rmsFile.c_str());
 93             massin.open(massFile.c_str());     << 111   std::ifstream defoin(defoFile.c_str());
 94             std::cout << "Mass evaluation file << 112   std::ifstream massin(massFile.c_str());
 95         }                                      << 113 
 96     }                                          << 114   std::filebuf *buf1 = flalphain.rdbuf();
 97                                                << 115   std::filebuf *buf2 = frldmin.rdbuf();
 98     std::filebuf* buf1 = flalphain.rdbuf();    << 116   std::filebuf *buf3 = vgsldin.rdbuf();
 99     std::filebuf* buf2 = frldmin.rdbuf();      << 117   std::filebuf *buf4 = pace2in.rdbuf();  
100     std::filebuf* buf3 = vgsldin.rdbuf();      << 118   std::filebuf *buf5 = rmsin.rdbuf(); 
101     std::filebuf* buf4 = rmsin.rdbuf();        << 119   std::filebuf *buf6 = defoin.rdbuf();
102     std::filebuf* buf5 = defoin.rdbuf();       << 120   std::filebuf *buf7 = massin.rdbuf();
103     std::filebuf* buf6 = massin.rdbuf();       << 121   if (!((buf1->is_open()) && (buf2->is_open()) && (buf3->is_open()) && (buf4->is_open()) && (buf5->is_open()) && (buf6->is_open()) && (buf7->is_open()))) {
104     if (!((buf1->is_open()) && (buf2->is_open( << 122 #ifdef ABLAXX_IN_GEANT4_MODE
105           (buf6->is_open())))                  << 123     G4ExceptionDescription ed;
106     {                                          << 124     ed << " Data missing: could not find ABLA data file in " << dataPath
107         G4ExceptionDescription ed;             << 125        << "defined by environment variable G4ABLADATA" << G4endl;
108         ed << "Data missing: could not find AB << 126     G4Exception("G4AblaDataFile::readData()", "ABLA", FatalException, ed);
109            << "defined by environment variable << 127 #else
110         G4Exception("G4AblaDataFile::readData( << 128     std::cerr << "Error opening file." << std::endl;
111     }                                          << 129 #endif
112                                                << 130   }
113     G4double fflalpha, ffrldm, fvgsld, frms;   << 131   
114     G4int fj = 0, fk = 0, a2, a3, a4;          << 132   G4double fflalpha, ffrldm, fvgsld, fpace2, frms;
115     G4double fbeta2, fbeta4;                   << 133   int fj,fk,a2,a3,a4;
116     G4double a7;                               << 134   G4double fbeta2,fbeta4;
117     const G4int rows = 99;                     << 135   G4double a7;
118     const G4int cols = 154;                    << 136   const G4int rows = 99;
119     const G4int rowsbeta = 137;                << 137   const G4int cols = 154;
120     const G4int colsbeta = 251;                << 138   const G4int rowsbeta = 137;
121                                                << 139   const G4int colsbeta = 251;
122     for (G4int i = 0; i < zcols; i++)          << 140   const G4int rowsmass = 13;
123     {                                          << 141   const G4int colsmass = 154;
124         for (G4int j = 0; j < nrows; j++)      << 142   const G4int massnumbers = 263;
125         {                                      << 143   for(int i = 0; i < rows; i++) {
126             setAlpha(j, i, 0.0);               << 144     for(int j = 0; j < cols; j++) {
127             setEcnz(j, i, 0.0);                << 145       setAlpha(j, i, 0.0);
128             setVgsld(j, i, 0.0);               << 146       setEcnz( j, i, 0.0);
129             setRms(j, i, 0.0);                 << 147       setVgsld(j, i, 0.0);
130         }                                      << 148       setRms(j, i, 0.0);
131     }                                          << 149     }
132                                                << 150   }
133     for (G4int i = 0; i < rows; i++)           << 151   
134     {                                          << 152   for(int i = 0; i < rows; i++) {
135         for (G4int j = 0; j < cols; j++)       << 153     for(int j = 0; j < cols; j++) {
136         {                                      << 154       flalphain >> fflalpha;
137             flalphain >> fflalpha;             << 155       frldmin >> ffrldm;
138             frldmin >> ffrldm;                 << 156       vgsldin >> fvgsld;  
139             vgsldin >> fvgsld;                 << 157       rmsin >> frms;    
140             rmsin >> frms;                     << 158       setAlpha(j, i, fflalpha);
141             setAlpha(j, i, fflalpha);          << 159       setEcnz( j, i, ffrldm);
142             setEcnz(j, i, ffrldm);             << 160       setVgsld(j, i, fvgsld);
143             setVgsld(j, i, fvgsld);            << 161       setRms(j, i, frms);
144             setRms(j, i, frms);                << 162     }
145         }                                      << 163   }
146     }                                          << 164 
147                                                << 165 
148     for (G4int i = 0; i < rowsbeta; i++)       << 166   for(int i = 0; i < rowsbeta; i++) {
149     {                                          << 167     for(int j = 0; j < colsbeta; j++) {
150         for (G4int j = 0; j < colsbeta; j++)   << 168       setBeta2(j, i, 0.0);
151         {                                      << 169       setBeta4(j, i, 0.0);
152             setBeta2(j, i, 0.0);               << 170     }
153             setBeta4(j, i, 0.0);               << 171   }
154         }                                      << 172 
155     }                                          << 173   for(int i = 0; i < 8983; i++) {
156                                                << 174   defoin >> fj >> fk >> fbeta2 >> fbeta4;
157     defoin >> fj >> fk >> fbeta2 >> fbeta4;    << 175   setBeta2(fk, fj, fbeta2);
158     while (!defoin.eof())                      << 176   setBeta4(fk, fj, fbeta4);
159     {                                          << 177   }
160         setBeta2(fk, fj, fbeta2);              << 178 
161         setBeta4(fk, fj, fbeta4);              << 179   for(int i = 0; i < rowsmass; i++) {
162         defoin >> fj >> fk >> fbeta2 >> fbeta4 << 180     for(int j = 0; j < colsmass; j++) {
163     }                                          << 181       setMexp(j, i, 0.0);
164                                                << 182       setMexpID(j,i,0);
165     for (G4int i = 0; i < zcols; i++)          << 183     }
166     {                                          << 184   }
167         for (G4int j = 0; j < nrows; j++)      << 185    massin >> a2 >> a3 >> a4 >> a7 ;
168         {                                      << 186    while(!massin.eof()){
169             setMexp(j, i, 0.0);                << 187    //
170             setMexpID(j, i, 0);                << 188      if(a3<13.){
171         }                                      << 189      setMexpID(a2,a3,1);
172     }                                          << 190      setMexp(a2,a3,938.7829835*a3+939.5653301*a2-1.*a4*a7/1000.);
173     massin >> a2 >> a3 >> a4 >> a7;            << 191      }
174     while (!massin.eof())                      << 192      massin >> a2 >> a3 >> a4 >> a7 ;
175     {                                          << 193    }
176         //                                     << 194 
177         if (a3 < lpcols)                       << 195   flalphain.close();
178         {                                      << 196   frldmin.close();  
179             setMexpID(a2, a3, 1);              << 197   vgsldin.close();
180             setMexp(a2, a3, 938.7829835 * a3 + << 198   rmsin.close();
181         }                                      << 199   defoin.close();
182         massin >> a2 >> a3 >> a4 >> a7;        << 200   massin.close();
183     }                                          << 201 
184                                                << 202   G4String str1, str2, str3;
185     flalphain.close();                         << 203   for(int i = 0; i < 500; i++) {
186     frldmin.close();                           << 204     for(int j = 0; j < 500; j++) {
187     vgsldin.close();                           << 205       setPace2(i, j, 0.0);
188     rmsin.close();                             << 206     }
189     defoin.close();                            << 207   }
190     massin.close();                            << 208   
                                                   >> 209   int A = 0, Zbegin = 0, Zend = 0;
                                                   >> 210   for(int i = 0; i < massnumbers; i++) {
                                                   >> 211     pace2in >> str1 >> A >> str2 >> Zbegin >> str3 >> Zend;
                                                   >> 212     if(Zbegin >= 0 && Zbegin < getPaceCols() &&
                                                   >> 213        A >= 0 && A < getPaceRows()) {
                                                   >> 214       for(int j = Zbegin; j <= Zend; j++) {
                                                   >> 215   pace2in >> fpace2;
                                                   >> 216   setPace2(A, j, fpace2);
                                                   >> 217       }
                                                   >> 218     }
                                                   >> 219   }
                                                   >> 220   pace2in.close();
                                                   >> 221   if(std::abs(getPace2(A, Zend) - 114516.10) > 1e-6) {
                                                   >> 222     std::cerr << "ERROR: Problem in parsing datafile " + pace2File << std::endl;
                                                   >> 223     return false;
                                                   >> 224   }
191                                                   225 
192     return true;                               << 226   return true;
193 }                                                 227 }
                                                   >> 228 
194                                                   229