Belle II Software development
CDCDedxMeanPars.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 <cdc/dbobjects/CDCDedxMeanPars.h>
10#include <framework/logging/Logger.h>
11#include <cmath>
12
13namespace Belle2 {
19 double CDCDedxMeanPars::meanCurve(double x, const double* par, int version) const
20 {
21 // calculate the predicted mean value as a function of beta-gamma (bg)
22 // this is done with a different function depending on the value of bg
23 double f = 0;
24
25 if (version == 0) {
26 if (par[0] == 1)
27 f = par[1] * std::pow(std::sqrt(x * x + 1), par[3]) / std::pow(x, par[3]) *
28 (par[2] - par[5] * std::log(1 / x)) - par[4] + std::exp(par[6] + par[7] * x);
29 else if (par[0] == 2)
30 f = par[1] * x * x * x + par[2] * x * x + par[3] * x + par[4];
31 else if (par[0] == 3)
32 f = -1.0 * par[1] * std::log(par[4] + std::pow(1 / x, par[2])) + par[3];
33 }
34
35 return f;
36 }
37
38 double CDCDedxMeanPars::getMean(double bg) const
39 {
40 // define the section of the mean to use
41 double A = 0, B = 0, C = 0;
42 if (bg < 4.5)
43 A = 1;
44 else if (bg < 10)
45 B = 1;
46 else
47 C = 1;
48
49 double parsA[9];
50 double parsB[5];
51 double parsC[5];
52
53 const auto& params = m_meanpars;
54 if (params.size() < 15) B2FATAL("CDCDedxMeanPars: vector of parameters too short");
55
56 parsA[0] = 1; parsB[0] = 2; parsC[0] = 3;
57 for (int i = 0; i < 15; ++i) {
58 if (i < 7) parsA[i + 1] = params[i];
59 else if (i < 11) parsB[i % 7 + 1] = params[i];
60 else parsC[i % 11 + 1] = params[i];
61 }
62
63 // calculate dE/dx from the Bethe-Bloch mean
64 double partA = meanCurve(bg, parsA, 0);
65 double partB = meanCurve(bg, parsB, 0);
66 double partC = meanCurve(bg, parsC, 0);
67
68 return (A * partA + B * partB + C * partC);
69 }
70
72}
std::vector< double > m_meanpars
dE/dx mean parameters
double getMean(double bg) const
Returns the predicted dE/dx mean at given beta-gamma.
double meanCurve(double x, const double *par, int version) const
parameterized beta-gamma curve for predicted means
Abstract base class for different kinds of events.