File indexing completed on 2024-04-06 12:30:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "DTBNormParam.h"
0021
0022
0023
0024
0025 #include <cmath>
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 DTBNormParam::DTBNormParam()
0040 :
0041 _bnorm(0.0),
0042 l_func(0),
0043 h_func(1) {}
0044
0045 DTBNormParam::DTBNormParam(float bnorm) {
0046
0047
0048 float x_bno = fabs(bnorm) * 10.0;
0049 int i_bno = static_cast<int>(x_bno);
0050 int l_bin;
0051
0052 if (i_bno > 9)
0053 l_bin = 9;
0054 else
0055 l_bin = i_bno;
0056
0057 int h_bin = l_bin + 1;
0058
0059
0060 _bnorm = bnorm;
0061 l_func = ParamFunc(l_bin);
0062 h_func = ParamFunc(h_bin);
0063 }
0064
0065
0066
0067
0068
0069 DTBNormParam::~DTBNormParam() {}
0070
0071
0072
0073
0074
0075 float DTBNormParam::tcor(float xpos) const {
0076
0077 float l_tcor = l_func.tcor(xpos);
0078 float h_tcor = h_func.tcor(xpos);
0079
0080
0081 return l_tcor + ((h_tcor - l_tcor) * l_func.dist(_bnorm) / l_func.dist(h_func));
0082 }
0083
0084 const float DTBNormParam::table_offsc[11] = {0.0,
0085 0.51630E-03,
0086 0.31628E-02,
0087 0.49082E-02,
0088 0.75994E-02,
0089 0.10643E-01,
0090 0.13419E-01,
0091 0.16636E-01,
0092 0.20108E-01,
0093 0.24405E-01,
0094 0.28550E-01};
0095
0096 const float DTBNormParam::table_coeff[11] = {0.0,
0097 0.13900E-03,
0098 -0.16361E-02,
0099 -0.25234E-02,
0100 -0.39586E-02,
0101 -0.56774E-02,
0102 -0.70548E-02,
0103 -0.86567E-02,
0104 -0.10549E-01,
0105 -0.12765E-01,
0106 -0.14833E-01};
0107
0108 DTBNormParam::ParamFunc::ParamFunc() {
0109
0110
0111
0112
0113
0114
0115 }
0116
0117 DTBNormParam::ParamFunc::ParamFunc(int bin) {
0118
0119 bin_bnorm = bin * 0.1;
0120
0121 offsc = table_offsc + bin;
0122 coeff = table_coeff + bin;
0123 }
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 DTBNormParam::ParamFunc::~ParamFunc() {}
0138
0139 float DTBNormParam::ParamFunc::tcor(float xpos) const {
0140
0141 return *offsc + (*coeff * xpos);
0142 }