1 #include <vxd/background/niel_fun.h>
3 #include <framework/logging/Logger.h>
4 #include <framework/utilities/FileSystem.h>
39 string fullName = FileSystem::findFile(FileName);
41 B2FATAL(
"TNIEL: Can't locate " << FileName);
45 inputfile.open(fullName.c_str(), ifstream::in);
46 if (!inputfile.good()) {
47 B2FATAL(
"TNIEL: Error opening input file " << FileName);
51 B2INFO(
"Reading file " << FileName);
55 while (getline(inputfile, line)) {
56 istringstream iss(line);
57 if (!(iss >> E_nielfactor[i] >> nielfactor[i])) {
58 B2FATAL(
"Error reading NIEL correction data from " << fullName.c_str());
65 B2INFO(
"INITIALIZED TNIEL FROM " << fullName.c_str());
66 for (
int j = 0; j < niel_N; j++)
67 B2DEBUG(100,
"E: " << E_nielfactor[j] <<
" N: " << nielfactor[j]);
74 for (
int i = 0; i < niel_N; i++) {
75 if (EMeV < E_nielfactor[i]) {
81 if (j > 0 && j < niel_N)
82 value = nielfactor[j - 1]
83 + (nielfactor[j] - nielfactor[j - 1])
84 / (E_nielfactor[j] - E_nielfactor[j - 1])
85 * (EMeV - E_nielfactor[j - 1]);
87 value = nielfactor[0];
89 value = nielfactor[niel_N - 1];