ATLAS Offline Software
Public Member Functions | Static 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...
 

Static Public Member Functions

static unsigned nbins ()
 Return number of bins in the histogram for all plynomial coefficients (and few other numbers). More...
 
static int idx (unsigned power_Bx, unsigned power_By, unsigned power_tx, unsigned power_ty, unsigned power_omegax, unsigned power_omegay)
 Return bin number (0-based) for a monomial coefficient given the powers of the variables in a monomial. 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 coeeficients 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

◆ idx()

int T2TrackBSLLPoly::idx ( unsigned  power_Bx,
unsigned  power_By,
unsigned  power_tx,
unsigned  power_ty,
unsigned  power_omegax,
unsigned  power_omegay 
)
static

Return bin number (0-based) for a monomial coefficient given the powers of the variables in a monomial.

Returns negative number for unexpected input.

Definition at line 92 of file T2TrackBSLLPoly.cxx.

95 {
96  if (power_Bx > 2 or power_By > 2
97  or power_tx > 2 or power_ty > 2
98  or power_omegax > 2 or power_omegay > 2) {
99  return -1;
100  }
101 
102  int idx = g_order[power_Bx][power_By][power_tx][power_ty];
103  if (idx < 0) return -1;
104 
105  int idx2 = g_order2[power_omegax][power_omegay];
106  if (idx2 < 0) return -1;
107 
108  return idx*g_size2 + idx2;
109 }

◆ nbins()

unsigned T2TrackBSLLPoly::nbins ( )
static

Return number of bins in the histogram for all plynomial coefficients (and few other numbers).

Definition at line 79 of file T2TrackBSLLPoly.cxx.

80 {
81  // two extra bins to count number of tracks and beam_size*n_tracks
82  return
83  g_size*g_size2 // all polynomial coefficients
84  + 1 // Sum(z0)
85  + 1 // Sum(z0**2)
86  + 1 // Sum(1)
87  + 1 // Sum(beam_size)
88  ;
89 }

◆ 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 112 of file T2TrackBSLLPoly.cxx.

113 {
114  if (coeff.empty()) {
115  coeff.resize(nbins(), 0.);
116  }
117 
118  double cos_phi = std::cos(phi);
119  double sin_phi = std::sin(phi);
120  double var_b = m_beam_size*m_beam_size;
121  double var_bd = var_d0 + var_b;
122 
123  // z-0 and its square
124  coeff[g_size*g_size2] += z_0;
125  coeff[g_size*g_size2+1] += z_0*z_0;
126 
127  // store number of tracks and beam_size*n_tracks in last two bins
128  coeff[g_size*g_size2+2] += 1;
129  coeff[g_size*g_size2+3] += m_beam_size;
130 
131  // this code is generated by notebook, no point in changing it here
132  using std::pow;
133  coeff[idx(0, 0, 0, 0, 0, 0)] += -pow(d_0, 2)/(2*var_bd);
134  coeff[idx(0, 0, 0, 0, 0, 1)] += pow(cos_phi, 2)*pow(d_0, 2)/(2*pow(var_bd, 2));
135  coeff[idx(0, 0, 0, 0, 0, 2)] += -pow(cos_phi, 4)*pow(d_0, 2)/(2*pow(var_bd, 3));
136  coeff[idx(0, 0, 0, 0, 1, 0)] += pow(d_0, 2)*pow(sin_phi, 2)/(2*pow(var_bd, 2));
137  coeff[idx(0, 0, 0, 0, 1, 1)] += -pow(cos_phi, 2)*pow(d_0, 2)*pow(sin_phi, 2)/pow(var_bd, 3);
138  coeff[idx(0, 0, 0, 0, 2, 0)] += -pow(d_0, 2)*pow(sin_phi, 4)/(2*pow(var_bd, 3));
139  coeff[idx(0, 0, 0, 1, 0, 0)] += cos_phi*d_0*z_0/var_bd;
140  coeff[idx(0, 0, 0, 1, 0, 1)] += -pow(cos_phi, 3)*d_0*z_0/pow(var_bd, 2);
141  coeff[idx(0, 0, 0, 1, 0, 2)] += pow(cos_phi, 5)*d_0*z_0/pow(var_bd, 3);
142  coeff[idx(0, 0, 0, 1, 1, 0)] += -cos_phi*d_0*pow(sin_phi, 2)*z_0/pow(var_bd, 2);
143  coeff[idx(0, 0, 0, 1, 1, 1)] += 2*pow(cos_phi, 3)*d_0*pow(sin_phi, 2)*z_0/pow(var_bd, 3);
144  coeff[idx(0, 0, 0, 1, 2, 0)] += cos_phi*d_0*pow(sin_phi, 4)*z_0/pow(var_bd, 3);
145  coeff[idx(0, 0, 0, 2, 0, 0)] += -pow(cos_phi, 2)*pow(z_0, 2)/(2*var_bd);
146  coeff[idx(0, 0, 0, 2, 0, 1)] += pow(cos_phi, 4)*pow(z_0, 2)/(2*pow(var_bd, 2));
147  coeff[idx(0, 0, 0, 2, 0, 2)] += -pow(cos_phi, 6)*pow(z_0, 2)/(2*pow(var_bd, 3));
148  coeff[idx(0, 0, 0, 2, 1, 0)] += pow(cos_phi, 2)*pow(sin_phi, 2)*pow(z_0, 2)/(2*pow(var_bd, 2));
149  coeff[idx(0, 0, 0, 2, 1, 1)] += -pow(cos_phi, 4)*pow(sin_phi, 2)*pow(z_0, 2)/pow(var_bd, 3);
150  coeff[idx(0, 0, 0, 2, 2, 0)] += -pow(cos_phi, 2)*pow(sin_phi, 4)*pow(z_0, 2)/(2*pow(var_bd, 3));
151  coeff[idx(0, 0, 1, 0, 0, 0)] += -d_0*sin_phi*z_0/var_bd;
152  coeff[idx(0, 0, 1, 0, 0, 1)] += pow(cos_phi, 2)*d_0*sin_phi*z_0/pow(var_bd, 2);
153  coeff[idx(0, 0, 1, 0, 0, 2)] += -pow(cos_phi, 4)*d_0*sin_phi*z_0/pow(var_bd, 3);
154  coeff[idx(0, 0, 1, 0, 1, 0)] += d_0*pow(sin_phi, 3)*z_0/pow(var_bd, 2);
155  coeff[idx(0, 0, 1, 0, 1, 1)] += -2*pow(cos_phi, 2)*d_0*pow(sin_phi, 3)*z_0/pow(var_bd, 3);
156  coeff[idx(0, 0, 1, 0, 2, 0)] += -d_0*pow(sin_phi, 5)*z_0/pow(var_bd, 3);
157  coeff[idx(0, 0, 1, 1, 0, 0)] += cos_phi*sin_phi*pow(z_0, 2)/var_bd;
158  coeff[idx(0, 0, 1, 1, 0, 1)] += -pow(cos_phi, 3)*sin_phi*pow(z_0, 2)/pow(var_bd, 2);
159  coeff[idx(0, 0, 1, 1, 0, 2)] += pow(cos_phi, 5)*sin_phi*pow(z_0, 2)/pow(var_bd, 3);
160  coeff[idx(0, 0, 1, 1, 1, 0)] += -cos_phi*pow(sin_phi, 3)*pow(z_0, 2)/pow(var_bd, 2);
161  coeff[idx(0, 0, 1, 1, 1, 1)] += 2*pow(cos_phi, 3)*pow(sin_phi, 3)*pow(z_0, 2)/pow(var_bd, 3);
162  coeff[idx(0, 0, 1, 1, 2, 0)] += cos_phi*pow(sin_phi, 5)*pow(z_0, 2)/pow(var_bd, 3);
163  coeff[idx(0, 0, 2, 0, 0, 0)] += -pow(sin_phi, 2)*pow(z_0, 2)/(2*var_bd);
164  coeff[idx(0, 0, 2, 0, 0, 1)] += pow(cos_phi, 2)*pow(sin_phi, 2)*pow(z_0, 2)/(2*pow(var_bd, 2));
165  coeff[idx(0, 0, 2, 0, 0, 2)] += -pow(cos_phi, 4)*pow(sin_phi, 2)*pow(z_0, 2)/(2*pow(var_bd, 3));
166  coeff[idx(0, 0, 2, 0, 1, 0)] += pow(sin_phi, 4)*pow(z_0, 2)/(2*pow(var_bd, 2));
167  coeff[idx(0, 0, 2, 0, 1, 1)] += -pow(cos_phi, 2)*pow(sin_phi, 4)*pow(z_0, 2)/pow(var_bd, 3);
168  coeff[idx(0, 0, 2, 0, 2, 0)] += -pow(sin_phi, 6)*pow(z_0, 2)/(2*pow(var_bd, 3));
169  coeff[idx(0, 1, 0, 0, 0, 0)] += cos_phi*d_0/var_bd;
170  coeff[idx(0, 1, 0, 0, 0, 1)] += -pow(cos_phi, 3)*d_0/pow(var_bd, 2);
171  coeff[idx(0, 1, 0, 0, 0, 2)] += pow(cos_phi, 5)*d_0/pow(var_bd, 3);
172  coeff[idx(0, 1, 0, 0, 1, 0)] += -cos_phi*d_0*pow(sin_phi, 2)/pow(var_bd, 2);
173  coeff[idx(0, 1, 0, 0, 1, 1)] += 2*pow(cos_phi, 3)*d_0*pow(sin_phi, 2)/pow(var_bd, 3);
174  coeff[idx(0, 1, 0, 0, 2, 0)] += cos_phi*d_0*pow(sin_phi, 4)/pow(var_bd, 3);
175  coeff[idx(0, 1, 0, 1, 0, 0)] += -pow(cos_phi, 2)*z_0/var_bd;
176  coeff[idx(0, 1, 0, 1, 0, 1)] += pow(cos_phi, 4)*z_0/pow(var_bd, 2);
177  coeff[idx(0, 1, 0, 1, 0, 2)] += -pow(cos_phi, 6)*z_0/pow(var_bd, 3);
178  coeff[idx(0, 1, 0, 1, 1, 0)] += pow(cos_phi, 2)*pow(sin_phi, 2)*z_0/pow(var_bd, 2);
179  coeff[idx(0, 1, 0, 1, 1, 1)] += -2*pow(cos_phi, 4)*pow(sin_phi, 2)*z_0/pow(var_bd, 3);
180  coeff[idx(0, 1, 0, 1, 2, 0)] += -pow(cos_phi, 2)*pow(sin_phi, 4)*z_0/pow(var_bd, 3);
181  coeff[idx(0, 1, 1, 0, 0, 0)] += cos_phi*sin_phi*z_0/var_bd;
182  coeff[idx(0, 1, 1, 0, 0, 1)] += -pow(cos_phi, 3)*sin_phi*z_0/pow(var_bd, 2);
183  coeff[idx(0, 1, 1, 0, 0, 2)] += pow(cos_phi, 5)*sin_phi*z_0/pow(var_bd, 3);
184  coeff[idx(0, 1, 1, 0, 1, 0)] += -cos_phi*pow(sin_phi, 3)*z_0/pow(var_bd, 2);
185  coeff[idx(0, 1, 1, 0, 1, 1)] += 2*pow(cos_phi, 3)*pow(sin_phi, 3)*z_0/pow(var_bd, 3);
186  coeff[idx(0, 1, 1, 0, 2, 0)] += cos_phi*pow(sin_phi, 5)*z_0/pow(var_bd, 3);
187  coeff[idx(0, 2, 0, 0, 0, 0)] += -pow(cos_phi, 2)/(2*var_bd);
188  coeff[idx(0, 2, 0, 0, 0, 1)] += pow(cos_phi, 4)/(2*pow(var_bd, 2));
189  coeff[idx(0, 2, 0, 0, 0, 2)] += -pow(cos_phi, 6)/(2*pow(var_bd, 3));
190  coeff[idx(0, 2, 0, 0, 1, 0)] += pow(cos_phi, 2)*pow(sin_phi, 2)/(2*pow(var_bd, 2));
191  coeff[idx(0, 2, 0, 0, 1, 1)] += -pow(cos_phi, 4)*pow(sin_phi, 2)/pow(var_bd, 3);
192  coeff[idx(0, 2, 0, 0, 2, 0)] += -pow(cos_phi, 2)*pow(sin_phi, 4)/(2*pow(var_bd, 3));
193  coeff[idx(1, 0, 0, 0, 0, 0)] += -d_0*sin_phi/var_bd;
194  coeff[idx(1, 0, 0, 0, 0, 1)] += pow(cos_phi, 2)*d_0*sin_phi/pow(var_bd, 2);
195  coeff[idx(1, 0, 0, 0, 0, 2)] += -pow(cos_phi, 4)*d_0*sin_phi/pow(var_bd, 3);
196  coeff[idx(1, 0, 0, 0, 1, 0)] += d_0*pow(sin_phi, 3)/pow(var_bd, 2);
197  coeff[idx(1, 0, 0, 0, 1, 1)] += -2*pow(cos_phi, 2)*d_0*pow(sin_phi, 3)/pow(var_bd, 3);
198  coeff[idx(1, 0, 0, 0, 2, 0)] += -d_0*pow(sin_phi, 5)/pow(var_bd, 3);
199  coeff[idx(1, 0, 0, 1, 0, 0)] += cos_phi*sin_phi*z_0/var_bd;
200  coeff[idx(1, 0, 0, 1, 0, 1)] += -pow(cos_phi, 3)*sin_phi*z_0/pow(var_bd, 2);
201  coeff[idx(1, 0, 0, 1, 0, 2)] += pow(cos_phi, 5)*sin_phi*z_0/pow(var_bd, 3);
202  coeff[idx(1, 0, 0, 1, 1, 0)] += -cos_phi*pow(sin_phi, 3)*z_0/pow(var_bd, 2);
203  coeff[idx(1, 0, 0, 1, 1, 1)] += 2*pow(cos_phi, 3)*pow(sin_phi, 3)*z_0/pow(var_bd, 3);
204  coeff[idx(1, 0, 0, 1, 2, 0)] += cos_phi*pow(sin_phi, 5)*z_0/pow(var_bd, 3);
205  coeff[idx(1, 0, 1, 0, 0, 0)] += -pow(sin_phi, 2)*z_0/var_bd;
206  coeff[idx(1, 0, 1, 0, 0, 1)] += pow(cos_phi, 2)*pow(sin_phi, 2)*z_0/pow(var_bd, 2);
207  coeff[idx(1, 0, 1, 0, 0, 2)] += -pow(cos_phi, 4)*pow(sin_phi, 2)*z_0/pow(var_bd, 3);
208  coeff[idx(1, 0, 1, 0, 1, 0)] += pow(sin_phi, 4)*z_0/pow(var_bd, 2);
209  coeff[idx(1, 0, 1, 0, 1, 1)] += -2*pow(cos_phi, 2)*pow(sin_phi, 4)*z_0/pow(var_bd, 3);
210  coeff[idx(1, 0, 1, 0, 2, 0)] += -pow(sin_phi, 6)*z_0/pow(var_bd, 3);
211  coeff[idx(1, 1, 0, 0, 0, 0)] += cos_phi*sin_phi/var_bd;
212  coeff[idx(1, 1, 0, 0, 0, 1)] += -pow(cos_phi, 3)*sin_phi/pow(var_bd, 2);
213  coeff[idx(1, 1, 0, 0, 0, 2)] += pow(cos_phi, 5)*sin_phi/pow(var_bd, 3);
214  coeff[idx(1, 1, 0, 0, 1, 0)] += -cos_phi*pow(sin_phi, 3)/pow(var_bd, 2);
215  coeff[idx(1, 1, 0, 0, 1, 1)] += 2*pow(cos_phi, 3)*pow(sin_phi, 3)/pow(var_bd, 3);
216  coeff[idx(1, 1, 0, 0, 2, 0)] += cos_phi*pow(sin_phi, 5)/pow(var_bd, 3);
217  coeff[idx(2, 0, 0, 0, 0, 0)] += -pow(sin_phi, 2)/(2*var_bd);
218  coeff[idx(2, 0, 0, 0, 0, 1)] += pow(cos_phi, 2)*pow(sin_phi, 2)/(2*pow(var_bd, 2));
219  coeff[idx(2, 0, 0, 0, 0, 2)] += -pow(cos_phi, 4)*pow(sin_phi, 2)/(2*pow(var_bd, 3));
220  coeff[idx(2, 0, 0, 0, 1, 0)] += pow(sin_phi, 4)/(2*pow(var_bd, 2));
221  coeff[idx(2, 0, 0, 0, 1, 1)] += -pow(cos_phi, 2)*pow(sin_phi, 4)/pow(var_bd, 3);
222  coeff[idx(2, 0, 0, 0, 2, 0)] += -pow(sin_phi, 6)/(2*pow(var_bd, 3));
223  coeff[idx(0, 0, 0, 0, 0, 0)+90] += -log(var_bd)/2;
224  coeff[idx(0, 0, 0, 0, 0, 1)+90] += -pow(cos_phi, 2)/(2*var_bd);
225  coeff[idx(0, 0, 0, 0, 0, 2)+90] += pow(cos_phi, 4)/(4*pow(var_bd, 2));
226  coeff[idx(0, 0, 0, 0, 1, 0)+90] += -pow(sin_phi, 2)/(2*var_bd);
227  coeff[idx(0, 0, 0, 0, 1, 1)+90] += pow(cos_phi, 2)*pow(sin_phi, 2)/(2*pow(var_bd, 2));
228  coeff[idx(0, 0, 0, 0, 2, 0)+90] += pow(sin_phi, 4)/(4*pow(var_bd, 2));
229 }

Member Data Documentation

◆ m_beam_size

double PESA::T2TrackBSLLPoly::m_beam_size
private

Definition at line 88 of file T2TrackBSLLPoly.h.


The documentation for this class was generated from the following files:
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
PESA::T2TrackBSLLPoly::idx
static int idx(unsigned power_Bx, unsigned power_By, unsigned power_tx, unsigned power_ty, unsigned power_omegax, unsigned power_omegay)
Return bin number (0-based) for a monomial coefficient given the powers of the variables in a monomia...
Definition: T2TrackBSLLPoly.cxx:92
PESA::T2TrackBSLLPoly::nbins
static unsigned nbins()
Return number of bins in the histogram for all plynomial coefficients (and few other numbers).
Definition: T2TrackBSLLPoly.cxx:79
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
PESA::T2TrackBSLLPoly::m_beam_size
double m_beam_size
Definition: T2TrackBSLLPoly.h:88