CbmRoot
ImpactParameterModel.h
Go to the documentation of this file.
1 #ifndef IMPACTPARAMETERMODEL_H
2 #define IMPACTPARAMETERMODEL_H
3 
4 //#include <cmath>
5 #include "TMath.h"
6 #include <string>
7 
8 //#include <omp.h>
9 
10 
12  std::vector<double> bfromN;
13  std::vector<double> bfromNerror;
14 
15 public:
16  ImpactParameterModel(std::string filename = "");
17 
18  virtual ~ImpactParameterModel(void) {}
19 
20  double getB(int Nchg) {
21  if (Nchg <= 0. || Nchg == 0)
22  return 15.;
23  else if (Nchg >= static_cast<int>(bfromN.size()))
24  return 0.;
25  else
26  return bfromN[Nchg];
27  }
28 
29  double getBerror(int Nchg) {
30  if (Nchg <= 0. || Nchg == 0)
31  return 2.;
32  else if (Nchg >= static_cast<int>(bfromN.size()))
33  return 1.;
34  else
35  return bfromNerror[Nchg];
36  }
37 
38  double getB(double Nchg) {
39  if (Nchg <= 0. || Nchg == 0.)
40  return 15.;
41  else if (Nchg >= bfromN.size())
42  return 0.;
43  else {
44  int Nchg1 = static_cast<int>(Nchg);
45  int Nchg2 = Nchg1 + 1;
46  double w = (Nchg - Nchg1);
47  return (1. - w) * bfromN[Nchg1] + w * bfromN[Nchg2];
48  }
49  }
50 
51  double getBerror(double Nchg) {
52  if (Nchg <= 0. || Nchg == 0.)
53  return 2.;
54  else if (Nchg >= bfromN.size())
55  return 1.;
56  else {
57  int Nchg1 = static_cast<int>(Nchg);
58  int Nchg2 = Nchg1 + 1;
59  double w = (Nchg - Nchg1);
60  return (1. - w) * bfromNerror[Nchg1] + w * bfromNerror[Nchg2];
61  }
62  }
63 };
64 
65 #endif
ImpactParameterModel::getB
double getB(double Nchg)
Definition: ImpactParameterModel.h:38
ImpactParameterModel::getB
double getB(int Nchg)
Definition: ImpactParameterModel.h:20
ImpactParameterModel::bfromN
std::vector< double > bfromN
Definition: ImpactParameterModel.h:12
ImpactParameterModel
Definition: ImpactParameterModel.h:11
ImpactParameterModel::ImpactParameterModel
ImpactParameterModel(std::string filename="")
Definition: ImpactParameterModel.cxx:6
ImpactParameterModel::~ImpactParameterModel
virtual ~ImpactParameterModel(void)
Definition: ImpactParameterModel.h:18
ImpactParameterModel::getBerror
double getBerror(int Nchg)
Definition: ImpactParameterModel.h:29
ImpactParameterModel::bfromNerror
std::vector< double > bfromNerror
Definition: ImpactParameterModel.h:13
ImpactParameterModel::getBerror
double getBerror(double Nchg)
Definition: ImpactParameterModel.h:51