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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 9.4.p4)


  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 // $Id: G4AblaDataFile.cc,v 1.1 2008-02-27 18:31:11 miheikki Exp $ 
 27 // Jose Luis Rodriguez, UDC (translation from  <<  27 // Translation of INCL4.2/ABLA V3 
 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 // Alain Boudard, CEA (contact person INCL/ABLA)
 31 // Aatos Heikkinen, HIP (project coordination)     31 // Aatos Heikkinen, HIP (project coordination)
 32 //                                             << 
 33                                                    32 
 34 #include "G4AblaDataFile.hh"                       33 #include "G4AblaDataFile.hh"
 35 #include "G4AblaDataDefs.hh"                   <<  34 //#include "G4HadronicException.hh"
 36 #include "globals.hh"                          <<  35 #include "globals.hh" // Needed for G4Exception.
 37                                                << 
 38 #include <cmath>                               << 
 39 #include <cstdlib>                             << 
 40 #include <fstream>                                 36 #include <fstream>
 41 #include <iostream>                            << 
 42                                                    37 
 43 G4AblaDataFile::G4AblaDataFile() { verboseLeve <<  38 G4AblaDataFile::G4AblaDataFile()
                                                   >>  39 {
                                                   >>  40   verboseLevel = 0;
                                                   >>  41 }
 44                                                    42 
 45 /**                                                43 /**
 46  * Read all data from files.                       44  * Read all data from files.
 47  */                                                45  */
 48 G4bool G4AblaDataFile::readData()              <<  46 bool G4AblaDataFile::readData()
 49 {                                                  47 {
 50     if (!G4FindDataDir("G4ABLADATA"))          <<  48   if(!getenv("G4ABLADATA")) {
 51     {                                          <<  49     //    throw G4HadronicException(__FILE__, __LINE__, "ERROR: Data
 52         G4ExceptionDescription ed;             <<  50     //    missing. Set environment variable G4ABLA3.0 to point to the
 53         ed << " Data missing: set environment  <<  51     //    directory containing data files needed by INCL and ABLA
 54            << " to point to the directory cont <<  52     //    models.");
 55            << " by the ABLA model" << G4endl;  <<  53     G4String errorMessage1 = "ERROR: Data missing. Set environment variable G4ABLADATA\n";
 56         G4Exception("G4AblaDataFile::readData( <<  54     G4String errorMessage2 = "\t to point to the directory containing data files needed\n";
 57     }                                          <<  55     G4String errorMessage3 = "\t by INCL and ABLA models.\n";
 58     G4String dataPath(G4FindDataDir("G4ABLADAT <<  56     G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3;
 59                                                <<  57     G4Exception(errorMessage);
 60     G4String flAlphaFile(dataPath + "/flalpha. <<  58   }
 61     G4String frldmFile(dataPath + "/frldm.dat" <<  59   
 62     G4String vgsldFile(dataPath + "/vgsld.dat" <<  60   G4String dataPath(getenv("G4ABLADATA"));
 63     G4String rmsFile(dataPath + "/rms.dat");   <<  61   G4String flAlphaFile(dataPath + "/flalpha.dat");
 64     G4String defoFile(dataPath + "/defo.dat"); <<  62   G4String frldmFile(  dataPath + "/frldm.dat");
 65     G4String massFile(dataPath + "/mass2020.da <<  63   G4String vgsldFile(  dataPath + "/vgsld.dat");
 66                                                <<  64   G4String pace2File(  dataPath + "/pace2.dat");
 67     if (verboseLevel > 1)                      <<  65 
 68     {                                          <<  66   if(verboseLevel > 1) {
 69         // G4cout <<"Data path   = " << dataPa <<  67     G4cout <<"Data path   = " << dataPath    << G4endl;
 70         // G4cout <<"FlAlphaFile = " << flAlph <<  68     G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl;
 71         // G4cout <<"FrldmFile   = " << frldmF <<  69     G4cout <<"FrldmFile   = " << frldmFile   << G4endl;
 72         // G4cout <<"VgsldFile   = " << vgsldF <<  70     G4cout <<"VgsldFile   = " << vgsldFile   << G4endl;
 73     }                                          <<  71     G4cout <<"Pace2File   = " << pace2File   << G4endl;
 74                                                <<  72   }
 75     std::ifstream flalphain(flAlphaFile.c_str( <<  73   
 76     std::ifstream frldmin(frldmFile.c_str());  <<  74   std::ifstream flalphain(flAlphaFile.c_str());
 77     std::ifstream vgsldin(vgsldFile.c_str());  <<  75   std::ifstream frldmin(frldmFile.c_str());  
 78     std::ifstream rmsin(rmsFile.c_str());      <<  76   std::ifstream vgsldin(vgsldFile.c_str());  
 79     std::ifstream defoin(defoFile.c_str());    <<  77   std::ifstream pace2in(pace2File.c_str());
 80     std::ifstream massin(massFile.c_str());    <<  78 
 81                                                <<  79   std::filebuf *buf1 = flalphain.rdbuf();
 82     if (!massin.is_open())                     <<  80   std::filebuf *buf2 = frldmin.rdbuf();
 83     {                                          <<  81   std::filebuf *buf3 = vgsldin.rdbuf();
 84         massFile = dataPath + "/mass2016.dat"; <<  82   std::filebuf *buf4 = pace2in.rdbuf();  
 85         massin.close();                        <<  83   if (!((buf1->is_open()) && (buf2->is_open()) && (buf3->is_open()) && (buf4->is_open()))) {
 86         massin.open(massFile.c_str());         <<  84     G4Exception("ERROR: Data missing. Could not find ABLA data file in " + dataPath +
 87         std::cout << "Mass evaluation file mas <<  85     " defined by environment variable G4ABLADATA");
 88                                                <<  86   }
 89         if (!massin.is_open())                 <<  87   
 90         {                                      <<  88   G4double flalpha, frldm, vgsld, pace2;
 91             massFile = dataPath + "/mass2003.d <<  89   const G4int rows = 98;
 92             massin.close();                    <<  90   const G4int cols = 153;
 93             massin.open(massFile.c_str());     <<  91   const G4int massnumbers = 263;
 94             std::cout << "Mass evaluation file <<  92   for(int i = 0; i < rows; i++) {
 95         }                                      <<  93     for(int j = 0; j < cols; j++) {
 96     }                                          <<  94       setAlpha(j, i, 0.0);
 97                                                <<  95       setEcnz( j, i, 0.0);
 98     std::filebuf* buf1 = flalphain.rdbuf();    <<  96       setVgsld(j, i, 0.0);      
 99     std::filebuf* buf2 = frldmin.rdbuf();      <<  97     }
100     std::filebuf* buf3 = vgsldin.rdbuf();      <<  98   }
101     std::filebuf* buf4 = rmsin.rdbuf();        <<  99   
102     std::filebuf* buf5 = defoin.rdbuf();       << 100   for(int i = 0; i < rows; i++) {
103     std::filebuf* buf6 = massin.rdbuf();       << 101     for(int j = 0; j < cols; j++) {
104     if (!((buf1->is_open()) && (buf2->is_open( << 102       flalphain >> flalpha;
105           (buf6->is_open())))                  << 103       frldmin >> frldm;
106     {                                          << 104       vgsldin >> vgsld;      
107         G4ExceptionDescription ed;             << 105       setAlpha(j, i, flalpha);
108         ed << "Data missing: could not find AB << 106       setEcnz( j, i, frldm);
109            << "defined by environment variable << 107       setVgsld(j, i, vgsld);      
110         G4Exception("G4AblaDataFile::readData( << 108     }
111     }                                          << 109   }
112                                                << 110   flalphain.close();
113     G4double fflalpha, ffrldm, fvgsld, frms;   << 111   frldmin.close();  
114     G4int fj = 0, fk = 0, a2, a3, a4;          << 112   vgsldin.close();
115     G4double fbeta2, fbeta4;                   << 113 
116     G4double a7;                               << 114   int A = 0, Zbegin = 0, Zend = 0;
117     const G4int rows = 99;                     << 115   G4String str1, str2, str3;
118     const G4int cols = 154;                    << 116   for(int i = 0; i < 500; i++) {
119     const G4int rowsbeta = 137;                << 117     for(int j = 0; j < 500; j++) {
120     const G4int colsbeta = 251;                << 118       setPace2(i, j, 0.0);
121                                                << 119     }
122     for (G4int i = 0; i < zcols; i++)          << 120   }
123     {                                          << 121   
124         for (G4int j = 0; j < nrows; j++)      << 122   for(int i = 0; i < massnumbers; i++) {
125         {                                      << 123     pace2in >> str1 >> A >> str2 >> Zbegin >> str3 >> Zend;
126             setAlpha(j, i, 0.0);               << 124     for(int j = Zbegin; j <= Zend; j++) {
127             setEcnz(j, i, 0.0);                << 125       pace2in >> pace2;
128             setVgsld(j, i, 0.0);               << 126       setPace2(A, j, pace2);
129             setRms(j, i, 0.0);                 << 127     }
130         }                                      << 128   }
131     }                                          << 129   pace2in.close();
132                                                << 130   if(std::fabs(getPace2(A, Zend) - 114516.10) > 1e-6) {
133     for (G4int i = 0; i < rows; i++)           << 131     G4cout <<"ERROR: Problem in parsing datafile " + pace2File << G4endl;
134     {                                          << 132     return false;
135         for (G4int j = 0; j < cols; j++)       << 133   }
136         {                                      << 
137             flalphain >> fflalpha;             << 
138             frldmin >> ffrldm;                 << 
139             vgsldin >> fvgsld;                 << 
140             rmsin >> frms;                     << 
141             setAlpha(j, i, fflalpha);          << 
142             setEcnz(j, i, ffrldm);             << 
143             setVgsld(j, i, fvgsld);            << 
144             setRms(j, i, frms);                << 
145         }                                      << 
146     }                                          << 
147                                                   134 
148     for (G4int i = 0; i < rowsbeta; i++)       << 135   return true;
149     {                                          << 136 }
150         for (G4int j = 0; j < colsbeta; j++)   << 
151         {                                      << 
152             setBeta2(j, i, 0.0);               << 
153             setBeta4(j, i, 0.0);               << 
154         }                                      << 
155     }                                          << 
156                                                << 
157     defoin >> fj >> fk >> fbeta2 >> fbeta4;    << 
158     while (!defoin.eof())                      << 
159     {                                          << 
160         setBeta2(fk, fj, fbeta2);              << 
161         setBeta4(fk, fj, fbeta4);              << 
162         defoin >> fj >> fk >> fbeta2 >> fbeta4 << 
163     }                                          << 
164                                                << 
165     for (G4int i = 0; i < zcols; i++)          << 
166     {                                          << 
167         for (G4int j = 0; j < nrows; j++)      << 
168         {                                      << 
169             setMexp(j, i, 0.0);                << 
170             setMexpID(j, i, 0);                << 
171         }                                      << 
172     }                                          << 
173     massin >> a2 >> a3 >> a4 >> a7;            << 
174     while (!massin.eof())                      << 
175     {                                          << 
176         //                                     << 
177         if (a3 < lpcols)                       << 
178         {                                      << 
179             setMexpID(a2, a3, 1);              << 
180             setMexp(a2, a3, 938.7829835 * a3 + << 
181         }                                      << 
182         massin >> a2 >> a3 >> a4 >> a7;        << 
183     }                                          << 
184                                                   137 
185     flalphain.close();                         << 
186     frldmin.close();                           << 
187     vgsldin.close();                           << 
188     rmsin.close();                             << 
189     defoin.close();                            << 
190     massin.close();                            << 
191                                                   138 
192     return true;                               << 
193 }                                              << 
194                                                   139