ATLAS Offline Software
Loading...
Searching...
No Matches
XYZtrp.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
10#include <cmath>
11
12namespace Trk {
13
14#define cnv_ref(a_1,a_2) cnv[(a_2)*6 + (a_1) - 7]
15
16void xyztrp(const long int ich, double *vrt0, double *pv0, double *covi, double BMAG, double *paro, double *errt)
17{
18 double covd[15],par[5], cnv[36]; /* was [6][6] */
19/* ---------------------------------------------------------- */
20/* Subroutine for convertion */
21/* (X,Y,Z,PX,PY,PZ) --> (eps,z,theta,phi,1/r) */
22/* Now it's used in VKalVrtFitter only */
23/* */
24/* Input: */
25/* ICH - charge of track ( +1,0,-1 ) */
26/* VRT0(3) - Vertex of particle */
27/* PV0(3) - Momentum of particle */
28/* COVI(21) - simmetric covariance matrix */
29/* Output: */
30/* PARO(5) - (eps,z,theta,phi,1/r) */
31/* ERRT(15) - simmetric error matrix */
32/* Reference point for output is (0,0,0) */
33/* For ICH=0 PARO(5) = const/pt */
34/* Propagation is done for NEW track, */
35/* so no TrkID reference established */
36/* Author: V.Kostyukhin */
37/* ---------------------------------------------------------- */
38
39 double constBF =BMAG * vkalMagCnvCst;
40
41 double pt = sqrt(pv0[0]*pv0[0] + pv0[1]*pv0[1]);
42 double pp = pt*pt + pv0[2]*pv0[2]; // p**2
43 double cs = pv0[0] / pt;
44 double sn = pv0[1] / pt;
45 double ctg = pv0[2] / pt;
46 double rho = ich * constBF / pt;
47 if (ich == 0)rho = constBF / pt;
48/* -- Output parameters */
49 par[0] = 0.; /* (-Yv*cos + Xv*sin) */
50 par[1] = 0.; /* Zv - cotth*(Xv*cos + Yv*sin) */
51 par[2] = acos(pv0[2] / sqrt(pp));
52 if(par[2]<1.e-5)par[2]=1.e-5;
53 if(par[2]>M_PI-1.e-5) par[2]=M_PI-1.e-5;
54 par[3] = atan2(pv0[1], pv0[0]);
55 par[4] = rho;
56 if (ich == 0)par[4] = constBF / pt;
57//---
58 double dTheta_dPx = pv0[0]*pv0[2]/(pt*pp); //dTheta/dPx
59 double dTheta_dPy = pv0[1]*pv0[2]/(pt*pp); //dTheta/dPy
60 double dTheta_dPz = -pt/pp; //dTheta/dPz
61 double dPhi_dPx = -pv0[1]/(pt*pt); //dPhi/dPx
62 double dPhi_dPy = pv0[0]/(pt*pt); //dPhi/dPy
63 double dPhi_dPz = 0; //dPhi/dPz
64 double dRho_dPx = -pv0[0]/(pt*pt) * rho; //dInvR/dPx
65 double dRho_dPy = -pv0[1]/(pt*pt) * rho; //dInvR/dPy
66 double dRho_dPz = 0.; //dInvR/dPz
67//---
68 cnv_ref(1, 1) = sn;
69 cnv_ref(2, 1) = -cs;
70 cnv_ref(3, 1) = 0.;
71 cnv_ref(4, 1) = 0.;
72 cnv_ref(5, 1) = 0.;
73 cnv_ref(6, 1) = 0.;
74
75 cnv_ref(1, 2) = -cs * ctg;
76 cnv_ref(2, 2) = -sn * ctg;
77 cnv_ref(3, 2) = 1.;
78 cnv_ref(4, 2) = 0.;
79 cnv_ref(5, 2) = 0.;
80 cnv_ref(6, 2) = 0.;
81
82 cnv_ref(1, 3) = 0.;
83 cnv_ref(2, 3) = 0.;
84 cnv_ref(3, 3) = 0.;
85 cnv_ref(4, 3) = dTheta_dPx;
86 cnv_ref(5, 3) = dTheta_dPy;
87 cnv_ref(6, 3) = dTheta_dPz;
88
89 cnv_ref(1, 4) = 0.;
90 cnv_ref(2, 4) = 0.;
91 if(ich) cnv_ref(1, 4) = -cs * rho; // For charged tracks only
92 if(ich) cnv_ref(2, 4) = -sn * rho; //
93 cnv_ref(3, 4) = 0.;
94 cnv_ref(4, 4) = dPhi_dPx;
95 cnv_ref(5, 4) = dPhi_dPy;
96 cnv_ref(6, 4) = dPhi_dPz;
97
98 cnv_ref(1, 5) = 0.;
99 cnv_ref(2, 5) = 0.;
100 cnv_ref(3, 5) = 0.;
101 cnv_ref(4, 5) = dRho_dPx;
102 cnv_ref(5, 5) = dRho_dPy;
103 cnv_ref(6, 5) = dRho_dPz;
104 tdasatVK(cnv, covi , covd, 5, 6);
105
106/* -- Translation to (0,0,0) (BackPropagation) --*/
107 double Ref0[3]={0.,0.,0.};
108 Trk::vkalPropagator::Propagate(-999, ich, par, covd, vrt0, Ref0, paro, errt, nullptr);
109
110}
111
112
113void combinedTrack(long int ICH, double *pv0, double *covi, double BMAG, double *par, double *covo)
114{
115
116 double cnv[36]; /* was [6][6] */
117/* ---------------------------------------------------------- */
118/* Subroutine for convertion for VKalvrtCore */
119/* Correct magnetic field BMAG at conversion point */
120/* is provided externally. */
121/* (X,Y,Z,PX,PY,PZ) --> (eps,z,theta,phi,1/r) */
122/* Input: */
123/* ICH - charge of track ( +1,0,-1 ) */
124/* PV0(3) - Momentum of particle */
125/* COVI(21) - simmetric covariance matrix */
126/* Output: */
127/* PARO(5) - (eps,z,theta,phi,1/r) */
128/* ERRT(15) - simmetric error matrix */
129/* NO PROPAGATION IS DONE!!!! */
130/* For ICH=0 PARO(5) = const/pt */
131/* Author: V.Kostyukhin */
132/* ---------------------------------------------------------- */
133
134 double constBF =BMAG * vkalMagCnvCst;
135
136 double pt = sqrt(pv0[0]*pv0[0] + pv0[1]*pv0[1]);
137 double pp = pt*pt + pv0[2]*pv0[2];
138 double cs = pv0[0] / pt;
139 double sn = pv0[1] / pt;
140 double ctg = pv0[2] / pt;
141 double rho = ICH * constBF / pt;
142 if ( ICH==0 )rho = constBF / pt;
143/* -- Output parameters */
144 par[0] = 0.; /* (-Yv*cos + Xv*sin) */
145 par[1] = 0.; /* Zv - cotth*(Xv*cos + Yv*sin) */
146 par[2] = acos(pv0[2] / sqrt(pp));
147 if(par[2]<1.e-5)par[2]=1.e-5;
148 if(par[2]>M_PI-1.e-5) par[2]=M_PI-1.e-5;
149 par[3] = atan2(pv0[1], pv0[0]);
150 par[4] = rho;
151 if ( ICH==0 )par[4] = constBF / pt;
152//
153 double dTheta_dPx = pv0[0]*pv0[2]/(pt*pp); //dTheta/dPx
154 double dTheta_dPy = pv0[1]*pv0[2]/(pt*pp); //dTheta/dPy
155 double dTheta_dPz = -pt/pp; //dTheta/dPz
156 double dPhi_dPx = -pv0[1]/(pt*pt); //dPhi/dPx
157 double dPhi_dPy = pv0[0]/(pt*pt); //dPhi/dPy
158 double dPhi_dPz = 0; //dPhi/dPz
159 double dRho_dPx = -pv0[0]/(pt*pt) * rho; //dInvR/dPx
160 double dRho_dPy = -pv0[1]/(pt*pt) * rho; //dInvR/dPy
161 double dRho_dPz = 0.; //dInvR/dPz
162//---
163 cnv_ref(1, 1) = sn;
164 cnv_ref(2, 1) = -cs;
165 cnv_ref(3, 1) = 0.;
166 cnv_ref(4, 1) = 0.;
167 cnv_ref(5, 1) = 0.;
168 cnv_ref(6, 1) = 0.;
169
170 cnv_ref(1, 2) = -cs * ctg;
171 cnv_ref(2, 2) = -sn * ctg;
172 cnv_ref(3, 2) = 1.;
173 cnv_ref(4, 2) = 0.;
174 cnv_ref(5, 2) = 0.;
175 cnv_ref(6, 2) = 0.;
176
177 cnv_ref(1, 3) = 0.;
178 cnv_ref(2, 3) = 0.;
179 cnv_ref(3, 3) = 0.;
180 cnv_ref(4, 3) = dTheta_dPx;
181 cnv_ref(5, 3) = dTheta_dPy;
182 cnv_ref(6, 3) = dTheta_dPz;
183
184 cnv_ref(1, 4) = 0.;
185 cnv_ref(2, 4) = 0.;
186 if(ICH) cnv_ref(1, 4) = -cs * rho; //For charged tracks only
187 if(ICH) cnv_ref(2, 4) = -sn * rho; //
188 cnv_ref(3, 4) = 0.;
189 cnv_ref(4, 4) = dPhi_dPx;
190 cnv_ref(5, 4) = dPhi_dPy;
191 cnv_ref(6, 4) = dPhi_dPz;
192
193 cnv_ref(1, 5) = 0.;
194 cnv_ref(2, 5) = 0.;
195 cnv_ref(3, 5) = 0.;
196 cnv_ref(4, 5) = dRho_dPx;
197 cnv_ref(5, 5) = dRho_dPy;
198 cnv_ref(6, 5) = dRho_dPz;
199 tdasatVK(cnv, covi , covo, 5, 6);
200}
201#undef cnv_ref
202
203} /* End of VKalVrtCore namespace */
204
#define M_PI
#define vkalMagCnvCst
Definition CommonPars.h:23
#define cnv_ref(a_1, a_2)
static void Propagate(long int TrkID, long int Charge, double *ParOld, double *CovOld, double *RefStart, double *RefEnd, double *ParNew, double *CovNew, VKalVrtControlBase *FitControl=0)
Ensure that the ATLAS eigen extensions are properly loaded.
void xyztrp(const long int ich, double *vrt0, double *pv0, double *covi, double BMAG, double *paro, double *errt)
Definition XYZtrp.cxx:16
void tdasatVK(const double *Der, const double *CovI, double *CovF, long int M, long int N)
void combinedTrack(long int ICH, double *pv0, double *covi, double BMAG, double *par, double *covo)
Definition XYZtrp.cxx:113