Belle II Software development
CDCDedxMeanPred.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/CDCDedxMeanPred.h>
10
11using namespace Belle2;
12
13double CDCDedxMeanPred::meanCurve(double* x, 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 on the value of bg
17 double f = 0;
18
19 if (version == 0) {
20 if (par[0] == 1)
21 f = par[1] * std::pow(std::sqrt(x[0] * x[0] + 1), par[3]) / std::pow(x[0], par[3]) *
22 (par[2] - par[5] * std::log(1 / x[0])) - par[4] + std::exp(par[6] + par[7] * x[0]);
23 else if (par[0] == 2)
24 f = par[1] * std::pow(x[0], 3) + par[2] * x[0] * x[0] + par[3] * x[0] + par[4];
25 else if (par[0] == 3)
26 f = -1.0 * par[1] * std::log(par[4] + std::pow(1 / x[0], par[2])) + par[3];
27 }
28
29 return f;
30}
31
32double CDCDedxMeanPred::getMean(double bg)
33{
35
36 // define the section of the mean to use
37 double A = 0, B = 0, C = 0;
38 if (bg < 4.5)
39 A = 1;
40 else if (bg < 10)
41 B = 1;
42 else
43 C = 1;
44
45 double x[1]; x[0] = bg;
46 double parsA[9];
47 double parsB[5];
48 double parsC[5];
49
50 parsA[0] = 1; parsB[0] = 2; parsC[0] = 3;
51 for (int i = 0; i < 15; ++i) {
52 if (i < 7) parsA[i + 1] = m_meanpars[i];
53 else if (i < 11) parsB[i % 7 + 1] = m_meanpars[i];
54 else parsC[i % 11 + 1] = m_meanpars[i];
55 }
56
57 // calculate dE/dx from the Bethe-Bloch mean
58 double partA = meanCurve(x, parsA, 0);
59 double partB = meanCurve(x, parsB, 0);
60 double partC = meanCurve(x, parsC, 0);
61
62 return (A * partA + B * partB + C * partC);
63}
64
std::vector< double > getMeanVector() const
Return the mean vector from payload.
double meanCurve(double *x, double *par, int version) const
beta-gamma (bg) curve function
std::vector< double > m_meanpars
dE/dx mean parameters
double getMean(double bg)
Return the predicted mean value as a function of beta-gamma (bg)
Abstract base class for different kinds of events.