Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4INCLHFB.cc
Go to the documentation of this file.
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// INCL++ intra-nuclear cascade model
27// Alain Boudard, CEA-Saclay, France
28// Joseph Cugnon, University of Liege, Belgium
29// Jean-Christophe David, CEA-Saclay, France
30// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31// Sylvie Leray, CEA-Saclay, France
32// Davide Mancusi, CEA-Saclay, France
33//
34#define INCLXX_IN_GEANT4_MODE 1
35
36#include "globals.hh"
37
38/*
39 * HFB.cc
40 *
41 * \date Oct 25, 2017
42 * \author Jose Luis Rodriguez Sanchez
43 */
44
45#include "G4INCLHFB.hh"
47#include "G4INCLGlobals.hh"
48#include "G4Threading.hh"
49#include <algorithm>
50#include <istream>
51
52namespace G4INCL {
53
54 namespace {
55 #ifdef INCLXX_IN_GEANT4_MODE
60 #else
63 G4double diffusenessP[TableZSize][TableASize];
64 G4double diffusenessN[TableZSize][TableASize];
65 #endif
66
67 void cleanTable(){
68 for(G4int i=0;i<TableZSize;++i)
69 for(G4int j=0;j<TableASize;++j){
70 radiusP[i][j]=-1.;
71 radiusN[i][j]=-1.;
72 diffusenessP[i][j]=-1.;
73 diffusenessN[i][j]=-1.;
74 }
75 }
76 }
77
78 namespace HFB {
79
80#ifdef INCLXX_IN_GEANT4_MODE
81 void initialize() {
82#else
83 void initialize(const std::string &path) {
84#endif
85
86 // Clear the existing tables, if any
87 cleanTable();
88
89#ifdef INCLXX_IN_GEANT4_MODE
90 if(!G4FindDataDir("G4INCLDATA")) {
92 ed << " Data missing: set environment variable G4INCLDATA\n"
93 << " to point to the directory containing data files needed\n"
94 << " by the INCL++ model" << G4endl;
95 G4Exception("G4INCLDataFile::readData()","table_radius_hfb.dat",
96 FatalException, ed);
97 }
98 G4String dataPath0(G4FindDataDir("G4INCLDATA"));
99 G4String dataPath(dataPath0 + "/table_radius_hfb.dat");
100#else
101 // File name
102 std::string dataPath(path + "/table_radius_hfb.dat");
103 INCL_DEBUG("Reading radius and diffuseness parameters from file " << dataPath << '\n');
104#endif
105
106 // Open the file stream
107 std::ifstream hfbTableIn(dataPath.c_str());
108 if(!hfbTableIn.good()) {
109 std::cerr << "Cannot open " << dataPath << " data file." << '\n';
110 std::abort();
111 return;
112 }
113
114 // read the file
115 G4int z, a, nbnuclei=0;
116 G4double rp, rn, dp, dn;
117 while(hfbTableIn.good()) { /* Loop checking, 22.01.2018, J.L. Rodriguez */
118 hfbTableIn >> z >> a >> rp >> rn >> dp >> dn;
119 radiusP[z][a] = rp;
120 radiusN[z][a] = rn;
121 diffusenessP[z][a] = dp;
122 diffusenessN[z][a] = dn;
123 nbnuclei++;
124 }
125 hfbTableIn.close();
126 INCL_DEBUG("Read " << nbnuclei << " nuclei" << '\n');
127
128 }
129
131 // HFB calculations
132 G4double r0=0.;
133 if(t==Neutron)
134 if(radiusN[Z][A]>0.)r0=radiusN[Z][A];
135 if(t==Proton)
136 if(radiusP[Z][A]>0.)r0=radiusP[Z][A];
137 return r0;
138 }
139
141 // HFB calculations
142 G4double a=0.;
143 if(t==Neutron)
144 if(diffusenessN[Z][A]>0.)a=diffusenessN[Z][A];
145 if(t==Proton)
146 if(diffusenessP[Z][A]>0.)a=diffusenessP[Z][A];
147 return a;
148 }
149 }
150}
const char * G4FindDataDir(const char *)
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define INCL_DEBUG(x)
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
#define G4endl
Definition: G4ios.hh:57
void initialize()
Definition: G4INCLHFB.cc:81
G4double getSurfaceDiffusenessHFB(const ParticleType t, const G4int A, const G4int Z)
Definition: G4INCLHFB.cc:140
G4double getRadiusParameterHFB(const ParticleType t, const G4int A, const G4int Z)
Get the radius and diffuseness parameters from HFB calculations.
Definition: G4INCLHFB.cc:130
const G4int TableASize
Definition: G4INCLHFB.hh:50
const G4int TableZSize
Definition: G4INCLHFB.hh:49
#define G4ThreadLocal
Definition: tls.hh:77