Belle II Software development
CDCDedxSigmaPars.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/CDCDedxSigmaPars.h>
10#include <framework/logging/Logger.h>
11#include <cmath>
12
13namespace Belle2 {
19 double CDCDedxSigmaPars::sigmaCurve(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 dE/dx, nhit, and sin(theta)
23 double f = 0;
24
25 if (version == 0) {
26 if (par[0] == 1) { // return dedx parameterization
27 f = par[1] + par[2] * x;
28 } else if (par[0] == 2) { // return nhit or sin(theta) parameterization
29 f = par[1] * x * x * x * x + par[2] * x * x * x + par[3] * x * x + par[4] * x + par[5];
30 } else if (par[0] == 3) { // return cos(theta) parameterization
31 f = par[1] * std::exp(-0.5 * std::pow(((x - par[2]) / par[3]), 2)) +
32 par[4] * std::pow(x, 6) + par[5] * std::pow(x, 5) + par[6] * std::pow(x, 4) +
33 par[7] * x * x * x + par[8] * x * x + par[9] * x + par[10];
34 }
35 }
36
37 return f;
38 }
39
40 double CDCDedxSigmaPars::getSigma(double dedx, double nhit, double cosTheta, double timereso) const
41 {
42 const auto& params = m_sigmapars;
43 if (params.size() < 17) B2FATAL("CDCDedxSigmaPars: vector of parameters too short");
44
45 double dedxpar[3];
46 double nhitpar[6];
47 double cospar[11];
48 dedxpar[0] = 1; nhitpar[0] = 2; cospar[0] = 3;
49 for (int i = 0; i < 10; ++i) {
50 if (i < 2) dedxpar[i + 1] = params[i];
51 if (i < 5) nhitpar[i + 1] = params[i + 2];
52 cospar[i + 1] = params[i + 7];
53 }
54
55 // determine sigma from the parameterization
56 double corDedx = sigmaCurve(dedx, dedxpar, 0);
57
58 double nhit_min = 8, nhit_max = 37;
59 double corNHit = 0;
60 if (nhit < nhit_min) {
61 corNHit = sigmaCurve(nhit_min, nhitpar, 0) * std::sqrt(nhit_min / nhit);
62 } else if (nhit > nhit_max) {
63 corNHit = sigmaCurve(nhit_max, nhitpar, 0) * std::sqrt(nhit_max / nhit);
64 } else {
65 corNHit = sigmaCurve(nhit, nhitpar, 0);
66 }
67
68 double corCos = sigmaCurve(cosTheta, cospar, 0);
69
70 return (corDedx * corCos * corNHit * timereso);
71 }
72
74}
std::vector< double > m_sigmapars
dE/dx resolution parameters
double sigmaCurve(double x, const double *par, int version) const
parameterized resolution for predictions
double getSigma(double dedx, double nhit, double cosTheta, double timeReso) const
Returns predicted dE/dx sigma.
Abstract base class for different kinds of events.