Thermal-FIST  1.3
Package for hadron resonance gas model applications
Acceptance.cpp
Go to the documentation of this file.
1 /*
2  * Thermal-FIST package
3  *
4  * Copyright (c) 2015-2018 Volodymyr Vovchenko
5  *
6  * GNU General Public License (GPLv3 or later)
7  */
9 
10 #include <fstream>
11 
12 namespace thermalfist {
13 
15  {
16  double ymin = 0., ymax = 6.;
17  double ptmin = 0., ptmax = 2.5;
18  func.ys.resize(0);
19  func.pts.resize(0);
20  func.probs.resize(0);
21  std::ifstream fin(filename.c_str());
22  if (!fin.is_open()) return 0;
23  fin >> func.dy >> func.dpt;
24  double ty, tpt, prob;
25  func.ys.resize(0);
26  func.pts.resize(0);
27  func.probs.resize(0);
28  while (fin >> ty >> tpt >> prob) {
29  if (tpt<ptmin || tpt>ptmax || ty<ymin || ty>ymax) continue;
30  func.ys.push_back(ty);
31  func.pts.push_back(tpt);
32  func.probs.push_back(prob);
33  }
34  func.setSpline();
35  fin.close();
36  return 1;
37  }
38 
39  double Acceptance::AcceptanceFunction::getAcceptance(const double & y, const double & pt) const {
40  double ret = sfunc.Eval(y, pt);
41  if (ret < 0.) ret = 0.;
42  if (ret > 1.) ret = 1.;
43  return ret;
44  }
45 
46 } // namespace thermalfist
std::vector< double > ys
Vector of bin rapidities. One element per bin.
Definition: Acceptance.h:34
double getAcceptance(const double &y, const double &pt) const
Binomial acceptance for the given values of y and pt.
Definition: Acceptance.cpp:39
Structure which contains the binomial probabilities for particle with given y and pt to be accepted...
Definition: Acceptance.h:28
BilinearSplineFunction sfunc
2D spline interpolation of the acceptance function
Definition: Acceptance.h:37
int ReadAcceptanceFunction(AcceptanceFunction &func, std::string filename)
Definition: Acceptance.cpp:14
std::vector< double > probs
Vector of acceptance probabilities for each bin.
Definition: Acceptance.h:36
double Eval(double x, double y) const
Evaluates interpolated f(x,y)
The main namespace where all classes and functions of the Thermal-FIST library reside.
std::vector< double > pts
Vector of bin pT values. One element per bin.
Definition: Acceptance.h:35
double dy
Rapidity width of a bin.
Definition: Acceptance.h:31