30 double tmp_refFrameX = 0, tmp_refFrameY = 0, tmp_refFrameZ = 0;
44 for (
const auto& mPer : InpPerigee) {
45 if( mPer ==
nullptr ){
continue; }
50 if(std::abs(perGlobalPos.z()) >
m_IDsizeZ)
return StatusCode::FAILURE;
51 if(perGlobalPos.perp() >
m_IDsizeR)
return StatusCode::FAILURE;
55 tmp_refFrameX += perGlobalPos.x() ;
56 tmp_refFrameY += perGlobalPos.y() ;
57 tmp_refFrameZ += perGlobalPos.z() ;
76 if(
counter == 0)
return StatusCode::FAILURE;
86 double fx = 0., fy = 0., BMAG_FIXED = 0.;
87 for (
const auto& mPer : InpPerigee) {
88 if(mPer ==
nullptr){
continue; }
89 AmgVector(5) VectPerig = mPer->parameters();
93 Amg::Vector3D perGlobalVrt = mPer->associatedSurface().center();
102 if(std::abs(BMAG_FIXED) < 0.01) BMAG_FIXED = 0.01;
104 double CovVertTrk[15];
107 if(!
convertAmg5SymMtx(mPer->covariance(), CovVertTrk))
return StatusCode::FAILURE;
109 static_cast<double>(VectPerig(0)),
110 static_cast<double>(VectPerig(1)),
111 static_cast<double>(VectPerig(2)),
112 static_cast<double>(VectPerig(3)),
113 static_cast<double>(VectPerig(4)),
126 double dX = tmp_refFrameX-perGlobalVrt.x();
127 double dY = tmp_refFrameY-perGlobalVrt.y();
128 double dZ = tmp_refFrameZ-perGlobalVrt.z();
129 if(std::abs(dX)+std::abs(dY)+std::abs(dZ) != 0.) {
130 double pari[5], covi[15];
131 double vrtini[3] = {0.,0.,0.};
132 double vrtend[3] = {dX,dY,dZ};
133 for(
int i=0;
i<5;
i++) pari[
i] = state.
m_apar[ntrk][
i];
134 for(
int i=0;
i<15;
i++) covi[
i] = state.
m_awgt[ntrk][
i];
135 long int Charge = (
long int) mPer->charge();
136 long int TrkID = ntrk;
138 vrtini, vrtend, &state.
m_apar[ntrk][0],
144 if(ntrk>=
NTrMaxVFit)
return StatusCode::FAILURE;
155 return StatusCode::SUCCESS;
158 std::unique_ptr<Perigee>
160 const std::vector<double>& VKCov,
163 assert(
dynamic_cast<const State*
> (&istate)!=
nullptr);
171 std::unique_ptr<Perigee>
173 const std::vector<double>& VKPerigee,
174 const std::vector<double>& VKCov,
179 double fx = 0., fy = 0., BMAG_CUR = 0.;
181 if(std::abs(BMAG_CUR) < 0.01) BMAG_CUR=0.01;
183 double TrkP3 = 0., TrkP4 = 0., TrkP5 = 0.;
184 VKalToTrkTrack(BMAG_CUR, VKPerigee[2], VKPerigee[3], VKPerigee[4],
185 TrkP3, TrkP4, TrkP5);
186 double TrkP1 = -VKPerigee[0];
187 double TrkP2 = VKPerigee[1];
191 double Deriv[5][5],CovMtxOld[5][5];
192 for(
int i=0;
i<5;
i++){
193 for(
int j=0; j<5; j++){
205 CovMtxOld[0][0] = VKCov[0];
206 CovMtxOld[0][1] = CovMtxOld[1][0] = VKCov[1];
207 CovMtxOld[1][1] = VKCov[2];
208 CovMtxOld[0][2] = CovMtxOld[2][0] = VKCov[3];
209 CovMtxOld[1][2] = CovMtxOld[2][1] = VKCov[4];
210 CovMtxOld[2][2] = VKCov[5];
211 CovMtxOld[0][3] = CovMtxOld[3][0] = VKCov[6];
212 CovMtxOld[1][3] = CovMtxOld[3][1] = VKCov[7];
213 CovMtxOld[2][3] = CovMtxOld[3][2] = VKCov[8];
214 CovMtxOld[3][3] = VKCov[9];
215 CovMtxOld[0][4] = CovMtxOld[4][0] = VKCov[10];
216 CovMtxOld[1][4] = CovMtxOld[4][1] = VKCov[11];
217 CovMtxOld[2][4] = CovMtxOld[4][2] = VKCov[12];
218 CovMtxOld[3][4] = CovMtxOld[4][3] = VKCov[13];
219 CovMtxOld[4][4] = VKCov[14];
221 for(
int i=0;
i<5;
i++){
222 for(
int j=
i; j<5; j++){
224 for(
int ik=4; ik>=0; ik--){
225 if(Deriv[
i][ik]==0.)
continue;
226 for(
int jk=4; jk>=0; jk--){
227 if(Deriv[j][jk]==0.)
continue;
228 tmp += Deriv[
i][ik]*CovMtxOld[ik][jk]*Deriv[j][jk];
231 CovMtx(
i,j) = CovMtx(j,
i)=
tmp;
239 return std::make_unique<Perigee>(TrkP1, TrkP2, TrkP3, TrkP4, TrkP5,