Belle II Software  release-08-01-10
CDCDedxSigmaPred.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <reconstruction/utility/CDCDedxSigmaPred.h>
10 
11 using namespace Belle2;
12 
13 double CDCDedxSigmaPred::sigmaCurve(double* x, const double* par, int version) const
14 {
15  // calculate the predicted mean value as a function of beta-gamma (bg)
16  // this is done with a different function depending dE/dx, nhit, and cos(theta)
17  double f = 0;
18 
19  if (version == 0) {
20  if (par[0] == 1) { // return dedx parameterization
21  f = par[1] + par[2] * x[0];
22  } else if (par[0] == 2) { // return nhit or sin(theta) parameterization
23  f = par[1] * std::pow(x[0], 4) + par[2] * std::pow(x[0], 3) +
24  par[3] * x[0] * x[0] + par[4] * x[0] + par[5];
25  } else if (par[0] == 3) { // return cos(theta) parameterization
26  f = par[1] * exp(-0.5 * pow(((x[0] - par[2]) / par[3]), 2)) +
27  par[4] * pow(x[0], 6) + par[5] * pow(x[0], 5) + par[6] * pow(x[0], 4) +
28  par[7] * pow(x[0], 3) + par[8] * x[0] * x[0] + par[9] * x[0] + par[10];
29  }
30  }
31 
32  return f;
33 }
34 
35 double CDCDedxSigmaPred::getSigma(double dedx, double nhit, double cos, double timereso)
36 {
37  double correction = cosPrediction(cos) * nhitPrediction(nhit) * ionzPrediction(dedx) * timereso;
38  return correction;
39 }
40 
41 
43 {
44 
46  double x[1];
47  double nhitpar[6];
48 
49  nhitpar[0] = 2;
50  for (int i = 0; i < 5; ++i) {
51  nhitpar[i + 1] = m_sigmapars[i + 2];
52  }
53 
54  // determine sigma from the nhit parameterization
55  x[0] = nhit;
56 
57  double corNHit;
58  int nhit_min = 8, nhit_max = 37;
59 
60  if (nhit < nhit_min) {
61  x[0] = nhit_min;
62  corNHit = sigmaCurve(x, nhitpar, 0) * sqrt(nhit_min / nhit);
63  } else if (nhit > nhit_max) {
64  x[0] = nhit_max;
65  corNHit = sigmaCurve(x, nhitpar, 0) * sqrt(nhit_max / nhit);
66  } else corNHit = sigmaCurve(x, nhitpar, 0);
67 
68 
69  return corNHit;
70 }
71 
73 {
74 
76  double x[1];
77  double dedxpar[3];
78 
79  dedxpar[0] = 1;
80 
81  for (int i = 0; i < 2; ++i) {
82  dedxpar[i + 1] = m_sigmapars[i];
83 
84  }
85  // determine sigma from the parameterization
86  x[0] = dedx;
87  double corDedx = sigmaCurve(x, dedxpar, 0);
88 
89  return corDedx;
90 }
91 
93 {
94 
96  double x[1];
97  double corCos;
98 
99  if (m_sigmapars.size() == 17) {
100  double cospar[11];
101  cospar[0] = 3;
102  for (int i = 0; i < 10; ++i) {
103  cospar[i + 1] = m_sigmapars[i + 7];
104  }
105  x[0] = cos;
106  corCos = sigmaCurve(x, cospar, 0);
107  }
108 
109  else {
110  double sinpar[6];
111 
112  sinpar[0] = 2;
113  for (int i = 0; i < 5; ++i) {
114  sinpar[i + 1] = m_sigmapars[i + 7];
115  }
116 
117  double sin = sqrt(1 - cos * cos);
118  if (sin > 0.99) sin = 0.99;
119  x[0] = sin;
120 
121  corCos = sigmaCurve(x, sinpar, 0);
122  }
123 
124  return corCos;
125 }
double ionzPrediction(double dedx)
Return sigma from the ionization parameterization.
std::vector< double > getSigmaVector() const
Return the resolution vector from payload.
double sigmaCurve(double *x, const double *par, int version) const
resolution functions depending on dE/dx, nhit, and cos(theta)
double getSigma(double dedx, double nhit, double cos, double timereso)
Return the predicted resolution depending on dE/dx, nhit, and cos(theta)
double cosPrediction(double cos)
Return sigma from the cos parameterization.
std::vector< double > m_sigmapars
dE/dx resolution parameters
double nhitPrediction(double nhit)
Return sigma from the nhit parameterization.
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.