Belle II Software development
SVDPositionErrorFunction.h
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#pragma once
10
11#include <framework/logging/Logger.h>
12#include <TObject.h>
13
14#include <cmath>
15#include <vector>
16
17namespace Belle2 {
24 class SVDPositionErrorFunction : public TObject {
25
26 public:
27
29 typedef double (SVDPositionErrorFunction::*posErrFunction)(double, int) const;
30
32 double getPositionError(double snr, int size) const
33 {
35 return (this->*f)(snr, size) ;
36 }
37
40 {
41 // The m_implementations vector is static.
42 // We have to initialize it just once.
43 if (m_implementations.size() == 0) {
45 //m_implementations.push_back(
46 // &SVDPositionErrorFunction::betterVersion);
47 }
48
49 m_current = m_implementations.size() - 1;
50
51 };
52
54 void set_current(int current)
55 {
56 m_current = current;
57 }
58
59 //SETTERS FOR function ID = 0 (v0, CoGOnly)
61 void set_a1(double a1_1, double a1_2, double a1_3, double a1_4, double a1_5)
62 {
63 m_a1[0] = a1_1;
64 m_a1[1] = a1_2;
65 m_a1[2] = a1_3;
66 m_a1[3] = a1_4;
67 m_a1[4] = a1_5;
68 }
70 void set_a2(double a2_1, double a2_2, double a2_3, double a2_4, double a2_5)
71 {
72 m_a2[0] = a2_1;
73 m_a2[1] = a2_2;
74 m_a2[2] = a2_3;
75 m_a2[3] = a2_4;
76 m_a2[4] = a2_5;
77 }
79 void set_b1(double b1_1, double b1_2, double b1_3, double b1_4, double b1_5)
80 {
81 m_b1[0] = b1_1;
82 m_b1[1] = b1_2;
83 m_b1[2] = b1_3;
84 m_b1[3] = b1_4;
85 m_b1[4] = b1_5;
86 }
87
89 void set_c1(double c1_1, double c1_2, double c1_3, double c1_4, double c1_5)
90 {
91 m_c1[0] = c1_1;
92 m_c1[1] = c1_2;
93 m_c1[2] = c1_3;
94 m_c1[3] = c1_4;
95 m_c1[4] = c1_5;
96 }
97
98
101
104
105 private:
106
108 static const int maxClusterSize = 5;
109
118 double m_a1[ maxClusterSize ] = {3, 3, 3, 3, 3};
119 double m_a2[ maxClusterSize ] = {3, 0, 0, 0, 0};
120 double m_b1[ maxClusterSize ] = {0};
121 double m_c1[ maxClusterSize ] = {0};
128 double v0(double clSNR, int clSize) const
129 {
130
131 double x = sqrt(clSize) * clSNR;
132
133 if (clSize > maxClusterSize)
134 clSize = maxClusterSize;
135
136 double A = m_a1[clSize - 1] / (x + m_a2[clSize - 1]);
137 double B = m_b1[clSize - 1] * x;
138 double C = m_c1[clSize - 1];
139
140 return sqrt(A * A + B * B + C * C);
141 };
142
145
147 static std::vector < posErrFunction > m_implementations;
148
150 };
151
153}
class to contain the Cluster Position Error Formulae
static const int maxClusterSize
total number of cluster sizes
void set_b1(double b1_1, double b1_2, double b1_3, double b1_4, double b1_5)
set the b1 cluster size dependent parameters
static std::vector< posErrFunction > m_implementations
vector of functions for position error, we use the m_current
double m_a1[maxClusterSize]
function parameters & implementations
double m_a2[maxClusterSize]
size dependent a2-parameter
void set_a2(double a2_1, double a2_2, double a2_3, double a2_4, double a2_5)
set the a2 cluster size dependent parameters
ClassDef(SVDPositionErrorFunction, 2)
Do not stream this, please throw it in the WC.
double m_c1[maxClusterSize]
size dependent c1-parameter
double getPositionError(double snr, int size) const
returns the position error, depending on the cluster SNR and size
void set_a1(double a1_1, double a1_2, double a1_3, double a1_4, double a1_5)
set the a1 cluster size dependent parameters
double v0(double clSNR, int clSize) const
v0 implementation
double(SVDPositionErrorFunction::* posErrFunction)(double, int) const
typedef of the return value of the position error function
void set_current(int current)
allows to choose the function version
void set_c1(double c1_1, double c1_2, double c1_3, double c1_4, double c1_5)
set the c1 cluster size dependent parameters
SVDPositionErrorFunction & operator=(const Belle2::SVDPositionErrorFunction &a)
operator =
double m_b1[maxClusterSize]
size dependent b1-parameter
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.