8 #include <vxd/background/niel_fun.h>
10 #include <framework/logging/Logger.h>
11 #include <framework/utilities/FileSystem.h>
46 string fullName = FileSystem::findFile(FileName);
48 B2FATAL(
"TNIEL: Can't locate " << FileName);
52 inputfile.open(fullName.c_str(), ifstream::in);
53 if (!inputfile.good()) {
54 B2FATAL(
"TNIEL: Error opening input file " << FileName);
58 B2INFO(
"Reading file " << FileName);
62 while (getline(inputfile, line)) {
63 istringstream iss(line);
64 if (!(iss >> E_nielfactor[i] >> nielfactor[i])) {
65 B2FATAL(
"Error reading NIEL correction data from " << fullName.c_str());
72 B2INFO(
"INITIALIZED TNIEL FROM " << fullName.c_str());
73 for (
int j = 0; j < niel_N; j++)
74 B2DEBUG(100,
"E: " << E_nielfactor[j] <<
" N: " << nielfactor[j]);
81 for (
int i = 0; i < niel_N; i++) {
82 if (EMeV < E_nielfactor[i]) {
88 if (j > 0 && j < niel_N)
89 value = nielfactor[j - 1]
90 + (nielfactor[j] - nielfactor[j - 1])
91 / (E_nielfactor[j] - E_nielfactor[j - 1])
92 * (EMeV - E_nielfactor[j - 1]);
94 value = nielfactor[0];
96 value = nielfactor[niel_N - 1];
TNiel(const std::string &FileName)
Constructor takes NIEL table for a particle as input.
double getNielFactor(double EMeV)
Get NIEL factor for a given particle energy.
Abstract base class for different kinds of events.