ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
PESA::T2TrackBSLLPoly Class Reference

Class that knows details of LogLikelihood approximation with a polynomial. More...

#include <T2TrackBSLLPoly.h>

Collaboration diagram for PESA::T2TrackBSLLPoly:

Public Member Functions

 T2TrackBSLLPoly (double beam_size)
 
void update (double z0, double d0, double phi0, double d0_var, std::vector< double > &coeff)
 Update polynomial coefficients with track data. More...
 

Private Attributes

double m_beam_size {}
 

Detailed Description

Class that knows details of LogLikelihood approximation with a polynomial.

Few particular things that this class handles:

The approximation of the LL function looks like (factorized):

LL = - (d_0 + B_x*sin(phi) - B_y*cos(phi) + t_x*z_0*sin(phi)

(ln(Sigma) + S_prime/Sigma - (S_prime/Sigma)**2/2)/2 var_b = beam_size**2 Sigma = var_d0 + var_b S_prime = omega_x*sin(phi)**2 + omega_y*cos(phi)**2

The variables here are (B_x, B_y, t_x, t_y, omega_x, omega_y), the rest are either track parameters or constants. beam_size is a constant which should be close to actual transverse beam size (typically 0.01 mm). In the expanded representation the polynomial terms have these possible combinations of powers of omega:

omega_x**2, omega_y**2, omega_x*omega_y, omega_x, omega_y, 1

with total of 6 variants and they don't depend on other variables. Four other variables can appear in the polynomial terms in these combinations:

Together with 6 omega combinations this gives (4+4*3/2+4+1)*6 = 90 monomials.

In addition to the 90 coefficients we also store other information in the monitored variables:

Definition at line 58 of file T2TrackBSLLPoly.h.

Constructor & Destructor Documentation

◆ T2TrackBSLLPoly()

PESA::T2TrackBSLLPoly::T2TrackBSLLPoly ( double  beam_size)
inlineexplicit

Definition at line 61 of file T2TrackBSLLPoly.h.

61 : m_beam_size(beam_size) {}

Member Function Documentation

◆ update()

void T2TrackBSLLPoly::update ( double  z0,
double  d0,
double  phi0,
double  d0_var,
std::vector< double > &  coeff 
)

Update polynomial coefficients with track data.

If vector is empty it is resized to have nbins() size, otherwise it has to be at least nbins() elements in size.

Definition at line 18 of file T2TrackBSLLPoly.cxx.

19 {
20  if (coeff.empty()) {
21  coeff.resize(nbins, 0.);
22  }
23 
24  double cos_phi = std::cos(phi);
25  double sin_phi = std::sin(phi);
26  double var_b = m_beam_size*m_beam_size;
27  double var_bd = var_d0 + var_b;
28  double pow_cos_phi[7]{};
29  double pow_sin_phi[7]{};
30  double pow_var_bd[4]{};
31  for (size_t i=2; i<7; ++i) {
32  pow_cos_phi[i] = std::pow(cos_phi, i);
33  pow_sin_phi[i] = std::pow(sin_phi, i);
34  }
35  for (size_t i=2; i<4; ++i) {
36  pow_var_bd[i] = std::pow(var_bd, i);
37  }
38  double pow2_d0 = std::pow(d0, 2);
39  double pow2_z0 = std::pow(z0, 2);
40 
41  // z0 and its square
42  coeff[g_size*g_size2] += z0;
43  coeff[g_size*g_size2+1] += pow2_z0;
44 
45  // store number of tracks and beam_size*n_tracks in last two bins
46  coeff[g_size*g_size2+2] += 1;
48 
49  coeff[idx<0, 0, 0, 0, 0, 0>()] += -pow2_d0/(2*var_bd);
50  coeff[idx<0, 0, 0, 0, 0, 1>()] += pow_cos_phi[2]*pow2_d0/(2*pow_var_bd[2]);
51  coeff[idx<0, 0, 0, 0, 0, 2>()] += -pow_cos_phi[4]*pow2_d0/(2*pow_var_bd[3]);
52  coeff[idx<0, 0, 0, 0, 1, 0>()] += pow2_d0*pow_sin_phi[2]/(2*pow_var_bd[2]);
53  coeff[idx<0, 0, 0, 0, 1, 1>()] += -pow_cos_phi[2]*pow2_d0*pow_sin_phi[2]/pow_var_bd[3];
54  coeff[idx<0, 0, 0, 0, 2, 0>()] += -pow2_d0*pow_sin_phi[4]/(2*pow_var_bd[3]);
55  coeff[idx<0, 0, 0, 1, 0, 0>()] += cos_phi*d0*z0/var_bd;
56  coeff[idx<0, 0, 0, 1, 0, 1>()] += -pow_cos_phi[3]*d0*z0/pow_var_bd[2];
57  coeff[idx<0, 0, 0, 1, 0, 2>()] += pow_cos_phi[5]*d0*z0/pow_var_bd[3];
58  coeff[idx<0, 0, 0, 1, 1, 0>()] += -cos_phi*d0*pow_sin_phi[2]*z0/pow_var_bd[2];
59  coeff[idx<0, 0, 0, 1, 1, 1>()] += 2*pow_cos_phi[3]*d0*pow_sin_phi[2]*z0/pow_var_bd[3];
60  coeff[idx<0, 0, 0, 1, 2, 0>()] += cos_phi*d0*pow_sin_phi[4]*z0/pow_var_bd[3];
61  coeff[idx<0, 0, 0, 2, 0, 0>()] += -pow_cos_phi[2]*pow2_z0/(2*var_bd);
62  coeff[idx<0, 0, 0, 2, 0, 1>()] += pow_cos_phi[4]*pow2_z0/(2*pow_var_bd[2]);
63  coeff[idx<0, 0, 0, 2, 0, 2>()] += -pow_cos_phi[6]*pow2_z0/(2*pow_var_bd[3]);
64  coeff[idx<0, 0, 0, 2, 1, 0>()] += pow_cos_phi[2]*pow_sin_phi[2]*pow2_z0/(2*pow_var_bd[2]);
65  coeff[idx<0, 0, 0, 2, 1, 1>()] += -pow_cos_phi[4]*pow_sin_phi[2]*pow2_z0/pow_var_bd[3];
66  coeff[idx<0, 0, 0, 2, 2, 0>()] += -pow_cos_phi[2]*pow_sin_phi[4]*pow2_z0/(2*pow_var_bd[3]);
67  coeff[idx<0, 0, 1, 0, 0, 0>()] += -d0*sin_phi*z0/var_bd;
68  coeff[idx<0, 0, 1, 0, 0, 1>()] += pow_cos_phi[2]*d0*sin_phi*z0/pow_var_bd[2];
69  coeff[idx<0, 0, 1, 0, 0, 2>()] += -pow_cos_phi[4]*d0*sin_phi*z0/pow_var_bd[3];
70  coeff[idx<0, 0, 1, 0, 1, 0>()] += d0*pow_sin_phi[3]*z0/pow_var_bd[2];
71  coeff[idx<0, 0, 1, 0, 1, 1>()] += -2*pow_cos_phi[2]*d0*pow_sin_phi[3]*z0/pow_var_bd[3];
72  coeff[idx<0, 0, 1, 0, 2, 0>()] += -d0*pow_sin_phi[5]*z0/pow_var_bd[3];
73  coeff[idx<0, 0, 1, 1, 0, 0>()] += cos_phi*sin_phi*pow2_z0/var_bd;
74  coeff[idx<0, 0, 1, 1, 0, 1>()] += -pow_cos_phi[3]*sin_phi*pow2_z0/pow_var_bd[2];
75  coeff[idx<0, 0, 1, 1, 0, 2>()] += pow_cos_phi[5]*sin_phi*pow2_z0/pow_var_bd[3];
76  coeff[idx<0, 0, 1, 1, 1, 0>()] += -cos_phi*pow_sin_phi[3]*pow2_z0/pow_var_bd[2];
77  coeff[idx<0, 0, 1, 1, 1, 1>()] += 2*pow_cos_phi[3]*pow_sin_phi[3]*pow2_z0/pow_var_bd[3];
78  coeff[idx<0, 0, 1, 1, 2, 0>()] += cos_phi*pow_sin_phi[5]*pow2_z0/pow_var_bd[3];
79  coeff[idx<0, 0, 2, 0, 0, 0>()] += -pow_sin_phi[2]*pow2_z0/(2*var_bd);
80  coeff[idx<0, 0, 2, 0, 0, 1>()] += pow_cos_phi[2]*pow_sin_phi[2]*pow2_z0/(2*pow_var_bd[2]);
81  coeff[idx<0, 0, 2, 0, 0, 2>()] += -pow_cos_phi[4]*pow_sin_phi[2]*pow2_z0/(2*pow_var_bd[3]);
82  coeff[idx<0, 0, 2, 0, 1, 0>()] += pow_sin_phi[4]*pow2_z0/(2*pow_var_bd[2]);
83  coeff[idx<0, 0, 2, 0, 1, 1>()] += -pow_cos_phi[2]*pow_sin_phi[4]*pow2_z0/pow_var_bd[3];
84  coeff[idx<0, 0, 2, 0, 2, 0>()] += -pow_sin_phi[6]*pow2_z0/(2*pow_var_bd[3]);
85  coeff[idx<0, 1, 0, 0, 0, 0>()] += cos_phi*d0/var_bd;
86  coeff[idx<0, 1, 0, 0, 0, 1>()] += -pow_cos_phi[3]*d0/pow_var_bd[2];
87  coeff[idx<0, 1, 0, 0, 0, 2>()] += pow_cos_phi[5]*d0/pow_var_bd[3];
88  coeff[idx<0, 1, 0, 0, 1, 0>()] += -cos_phi*d0*pow_sin_phi[2]/pow_var_bd[2];
89  coeff[idx<0, 1, 0, 0, 1, 1>()] += 2*pow_cos_phi[3]*d0*pow_sin_phi[2]/pow_var_bd[3];
90  coeff[idx<0, 1, 0, 0, 2, 0>()] += cos_phi*d0*pow_sin_phi[4]/pow_var_bd[3];
91  coeff[idx<0, 1, 0, 1, 0, 0>()] += -pow_cos_phi[2]*z0/var_bd;
92  coeff[idx<0, 1, 0, 1, 0, 1>()] += pow_cos_phi[4]*z0/pow_var_bd[2];
93  coeff[idx<0, 1, 0, 1, 0, 2>()] += -pow_cos_phi[6]*z0/pow_var_bd[3];
94  coeff[idx<0, 1, 0, 1, 1, 0>()] += pow_cos_phi[2]*pow_sin_phi[2]*z0/pow_var_bd[2];
95  coeff[idx<0, 1, 0, 1, 1, 1>()] += -2*pow_cos_phi[4]*pow_sin_phi[2]*z0/pow_var_bd[3];
96  coeff[idx<0, 1, 0, 1, 2, 0>()] += -pow_cos_phi[2]*pow_sin_phi[4]*z0/pow_var_bd[3];
97  coeff[idx<0, 1, 1, 0, 0, 0>()] += cos_phi*sin_phi*z0/var_bd;
98  coeff[idx<0, 1, 1, 0, 0, 1>()] += -pow_cos_phi[3]*sin_phi*z0/pow_var_bd[2];
99  coeff[idx<0, 1, 1, 0, 0, 2>()] += pow_cos_phi[5]*sin_phi*z0/pow_var_bd[3];
100  coeff[idx<0, 1, 1, 0, 1, 0>()] += -cos_phi*pow_sin_phi[3]*z0/pow_var_bd[2];
101  coeff[idx<0, 1, 1, 0, 1, 1>()] += 2*pow_cos_phi[3]*pow_sin_phi[3]*z0/pow_var_bd[3];
102  coeff[idx<0, 1, 1, 0, 2, 0>()] += cos_phi*pow_sin_phi[5]*z0/pow_var_bd[3];
103  coeff[idx<0, 2, 0, 0, 0, 0>()] += -pow_cos_phi[2]/(2*var_bd);
104  coeff[idx<0, 2, 0, 0, 0, 1>()] += pow_cos_phi[4]/(2*pow_var_bd[2]);
105  coeff[idx<0, 2, 0, 0, 0, 2>()] += -pow_cos_phi[6]/(2*pow_var_bd[3]);
106  coeff[idx<0, 2, 0, 0, 1, 0>()] += pow_cos_phi[2]*pow_sin_phi[2]/(2*pow_var_bd[2]);
107  coeff[idx<0, 2, 0, 0, 1, 1>()] += -pow_cos_phi[4]*pow_sin_phi[2]/pow_var_bd[3];
108  coeff[idx<0, 2, 0, 0, 2, 0>()] += -pow_cos_phi[2]*pow_sin_phi[4]/(2*pow_var_bd[3]);
109  coeff[idx<1, 0, 0, 0, 0, 0>()] += -d0*sin_phi/var_bd;
110  coeff[idx<1, 0, 0, 0, 0, 1>()] += pow_cos_phi[2]*d0*sin_phi/pow_var_bd[2];
111  coeff[idx<1, 0, 0, 0, 0, 2>()] += -pow_cos_phi[4]*d0*sin_phi/pow_var_bd[3];
112  coeff[idx<1, 0, 0, 0, 1, 0>()] += d0*pow_sin_phi[3]/pow_var_bd[2];
113  coeff[idx<1, 0, 0, 0, 1, 1>()] += -2*pow_cos_phi[2]*d0*pow_sin_phi[3]/pow_var_bd[3];
114  coeff[idx<1, 0, 0, 0, 2, 0>()] += -d0*pow_sin_phi[5]/pow_var_bd[3];
115  coeff[idx<1, 0, 0, 1, 0, 0>()] += cos_phi*sin_phi*z0/var_bd;
116  coeff[idx<1, 0, 0, 1, 0, 1>()] += -pow_cos_phi[3]*sin_phi*z0/pow_var_bd[2];
117  coeff[idx<1, 0, 0, 1, 0, 2>()] += pow_cos_phi[5]*sin_phi*z0/pow_var_bd[3];
118  coeff[idx<1, 0, 0, 1, 1, 0>()] += -cos_phi*pow_sin_phi[3]*z0/pow_var_bd[2];
119  coeff[idx<1, 0, 0, 1, 1, 1>()] += 2*pow_cos_phi[3]*pow_sin_phi[3]*z0/pow_var_bd[3];
120  coeff[idx<1, 0, 0, 1, 2, 0>()] += cos_phi*pow_sin_phi[5]*z0/pow_var_bd[3];
121  coeff[idx<1, 0, 1, 0, 0, 0>()] += -pow_sin_phi[2]*z0/var_bd;
122  coeff[idx<1, 0, 1, 0, 0, 1>()] += pow_cos_phi[2]*pow_sin_phi[2]*z0/pow_var_bd[2];
123  coeff[idx<1, 0, 1, 0, 0, 2>()] += -pow_cos_phi[4]*pow_sin_phi[2]*z0/pow_var_bd[3];
124  coeff[idx<1, 0, 1, 0, 1, 0>()] += pow_sin_phi[4]*z0/pow_var_bd[2];
125  coeff[idx<1, 0, 1, 0, 1, 1>()] += -2*pow_cos_phi[2]*pow_sin_phi[4]*z0/pow_var_bd[3];
126  coeff[idx<1, 0, 1, 0, 2, 0>()] += -pow_sin_phi[6]*z0/pow_var_bd[3];
127  coeff[idx<1, 1, 0, 0, 0, 0>()] += cos_phi*sin_phi/var_bd;
128  coeff[idx<1, 1, 0, 0, 0, 1>()] += -pow_cos_phi[3]*sin_phi/pow_var_bd[2];
129  coeff[idx<1, 1, 0, 0, 0, 2>()] += pow_cos_phi[5]*sin_phi/pow_var_bd[3];
130  coeff[idx<1, 1, 0, 0, 1, 0>()] += -cos_phi*pow_sin_phi[3]/pow_var_bd[2];
131  coeff[idx<1, 1, 0, 0, 1, 1>()] += 2*pow_cos_phi[3]*pow_sin_phi[3]/pow_var_bd[3];
132  coeff[idx<1, 1, 0, 0, 2, 0>()] += cos_phi*pow_sin_phi[5]/pow_var_bd[3];
133  coeff[idx<2, 0, 0, 0, 0, 0>()] += -pow_sin_phi[2]/(2*var_bd);
134  coeff[idx<2, 0, 0, 0, 0, 1>()] += pow_cos_phi[2]*pow_sin_phi[2]/(2*pow_var_bd[2]);
135  coeff[idx<2, 0, 0, 0, 0, 2>()] += -pow_cos_phi[4]*pow_sin_phi[2]/(2*pow_var_bd[3]);
136  coeff[idx<2, 0, 0, 0, 1, 0>()] += pow_sin_phi[4]/(2*pow_var_bd[2]);
137  coeff[idx<2, 0, 0, 0, 1, 1>()] += -pow_cos_phi[2]*pow_sin_phi[4]/pow_var_bd[3];
138  coeff[idx<2, 0, 0, 0, 2, 0>()] += -pow_sin_phi[6]/(2*pow_var_bd[3]);
139  coeff[idx<0, 0, 0, 0, 0, 0>() +90] += -std::log(var_bd)/2;
140  coeff[idx<0, 0, 0, 0, 0, 1>() +90] += -pow_cos_phi[2]/(2*var_bd);
141  coeff[idx<0, 0, 0, 0, 0, 2>() +90] += pow_cos_phi[4]/(4*pow_var_bd[2]);
142  coeff[idx<0, 0, 0, 0, 1, 0>() +90] += -pow_sin_phi[2]/(2*var_bd);
143  coeff[idx<0, 0, 0, 0, 1, 1>() +90] += pow_cos_phi[2]*pow_sin_phi[2]/(2*pow_var_bd[2]);
144  coeff[idx<0, 0, 0, 0, 2, 0>() +90] += pow_sin_phi[4]/(4*pow_var_bd[2]);
145 }

Member Data Documentation

◆ m_beam_size

double PESA::T2TrackBSLLPoly::m_beam_size {}
private

Definition at line 74 of file T2TrackBSLLPoly.h.


The documentation for this class was generated from the following files:
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
PESA::nbins
constexpr unsigned nbins
Definition: idx.h:73
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
PESA::g_size2
constexpr unsigned g_size2
Definition: idx.h:71
MuonCalib::Legendre::coeff
constexpr double coeff(const unsigned l, const unsigned k)
Calculates the n-th coefficient of the legendre polynomial series.
Definition: LegendrePoly.h:92
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
PESA::T2TrackBSLLPoly::m_beam_size
double m_beam_size
Definition: T2TrackBSLLPoly.h:74
PESA::g_size
constexpr unsigned g_size
Definition: idx.h:60