Belle II Software  release-08-01-10
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 17 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 44 of file niel_fun.cc.

45 {
46  string fullName = FileSystem::findFile(FileName);
47  if (fullName == "") {
48  B2FATAL("TNIEL: Can't locate " << FileName);
49  return;
50  }
51  ifstream inputfile;
52  inputfile.open(fullName.c_str(), ifstream::in);
53  if (!inputfile.good()) {
54  B2FATAL("TNIEL: Error opening input file " << FileName);
55  return;
56  }
57 
58  B2INFO("Reading file " << FileName);
59 
60  int i = 0;
61  string line;
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());
66  break;
67  }
68  i++;
69  }
70  inputfile.close();
71  niel_N = i;
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]);
75 }
int niel_N
number of rows in NIEL table
Definition: niel_fun.h:23
double nielfactor[1710]
factor values, enough to acommodate the longest file.
Definition: niel_fun.h:21
double E_nielfactor[1710]
particle energies at which the NIEL factor is tabulated.
Definition: niel_fun.h:22

Member Function Documentation

◆ getNielFactor()

double getNielFactor ( double  EMeV)

Get NIEL factor for a given particle energy.

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

Definition at line 77 of file niel_fun.cc.


The documentation for this class was generated from the following files: