Belle II Software  release-05-01-25
TNiel Class Reference

TNiel - the class providing values for NIEL factors. More...

#include <niel_fun.h>

Public Member Functions

 TNiel (const std::string &FileName)
 Constructor takes NIEL table for a particle as input. More...
 
double getNielFactor (double EMeV)
 Get NIEL factor for a given particle energy. More...
 

Private Attributes

double nielfactor [1710]
 factor values, enough to acommodate the longest file.
 
double E_nielfactor [1710]
 particle energies at which the NIEL factor is tabulated.
 
int niel_N
 number of rows in NIEL table
 

Detailed Description

TNiel - the class providing values for NIEL factors.

The class constructs a spline from a data table, and evaluates the spline at a desired point.

Definition at line 10 of file niel_fun.h.

Constructor & Destructor Documentation

◆ TNiel()

TNiel ( const std::string &  FileName)
explicit

Constructor takes NIEL table for a particle as input.

Parameters
FileNameString containing the table filename.

Definition at line 37 of file niel_fun.cc.

38 {
39  string fullName = FileSystem::findFile(FileName);
40  if (fullName == "") {
41  B2FATAL("TNIEL: Can't locate " << FileName);
42  return;
43  }
44  ifstream inputfile;
45  inputfile.open(fullName.c_str(), ifstream::in);
46  if (!inputfile.good()) {
47  B2FATAL("TNIEL: Error opening input file " << FileName);
48  return;
49  }
50 
51  B2INFO("Reading file " << FileName);
52 
53  int i = 0;
54  string line;
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());
59  break;
60  }
61  i++;
62  }
63  inputfile.close();
64  niel_N = i;
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]);
68 }

Member Function Documentation

◆ getNielFactor()

double getNielFactor ( double  EMeV)

Get NIEL factor for a given particle energy.

Parameters
particlekinetic energy in MeV.
Returns
NIEL factor for a particle with a given energy.

Definition at line 70 of file niel_fun.cc.


The documentation for this class was generated from the following files:
TNiel::niel_N
int niel_N
number of rows in NIEL table
Definition: niel_fun.h:16
TNiel::E_nielfactor
double E_nielfactor[1710]
particle energies at which the NIEL factor is tabulated.
Definition: niel_fun.h:15
TNiel::nielfactor
double nielfactor[1710]
factor values, enough to acommodate the longest file.
Definition: niel_fun.h:14