46 {
47
49 {
50 msg(MSG::WARNING) <<
" More or less than 2 tracks in Vertex. No Neutral Perigee could be created" <<
endmsg;
51 return nullptr;
52 }
53
55 {
56 msg(MSG::WARNING) <<
" Track Particle Element link is not valid" <<
endmsg;
57 return nullptr;
58
59 }
62
65
66 const AmgMatrix(3,3)& vrt_cov = myVertex.covariancePosition();
67 AmgMatrix(3,3) vrt_weight = myVertex.covariancePosition().inverse().eval();
68
69
72
73
74
76 msg(MSG::ERROR) <<
" No LinearizedTrackFactory is defined and no ExtendedVxCandidate is provided. Cannot obtain covariance matrix of neutral particle. Failed... " <<
endmsg;
77 return nullptr;
78 }
79
80
82
85
86 if (myFirstLinearizedTrack==nullptr||mySecondLinearizedTrack==nullptr)
87 {
88 msg(MSG::WARNING) <<
" Could not find one of the linearized tracks. No Neutral Perigee could be created" <<
endmsg;
89 if (myFirstLinearizedTrack) delete myFirstLinearizedTrack;
90 if (mySecondLinearizedTrack) delete mySecondLinearizedTrack;
91 return nullptr;
92 }
93
95 vrt_cov,
96 vrt_weight);
97
99 vrt_cov,
100 vrt_weight);
101
102 delete myFirstLinearizedTrack;
103 delete mySecondLinearizedTrack;
104 } else {
105 msg(MSG::WARNING) <<
" getPosMomentumAndMomentumCovMatrix method failed " <<
endmsg;
106 return nullptr;
107 }
108
109 const AmgVector(5) & myFirstPerigeeParameters=myFirstPerigee.parameters();
110 const AmgVector(5) & mySecondPerigeeParameters=mySecondPerigee.parameters();
111
112 AmgMatrix(3,3) FirstJacobianToPxPyPz=getPhiThetaQOverPToPxPyPzJacobian(myFirstPerigeeParameters[Trk::
qOverP],
113 myFirstPerigeeParameters[Trk::
theta],
114 myFirstPerigeeParameters[Trk::
phi0]);
115
116 AmgMatrix(3,3) SecondJacobianToPxPyPz=getPhiThetaQOverPToPxPyPzJacobian(mySecondPerigeeParameters[Trk::
qOverP],
117 mySecondPerigeeParameters[Trk::
theta],
118 mySecondPerigeeParameters[Trk::
phi0]);
119
120
121
122 AmgMatrix(3,3) posMomentumCovFirst=PosMomAndMomCovFirstTrack.first*FirstJacobianToPxPyPz.transpose();
123 AmgMatrix(3,3) posMomentumCovSecond=PosMomAndMomCovSecondTrack.first*SecondJacobianToPxPyPz.transpose();
124
125 AmgMatrix(3,3) momentumCovFirst=PosMomAndMomCovFirstTrack.second.
similarity(FirstJacobianToPxPyPz);
126 AmgMatrix(3,3) momentumCovSecond=PosMomAndMomCovSecondTrack.second.
similarity(SecondJacobianToPxPyPz);
127
128
129
130 AmgMatrix(3,3) covP1P2; covP1P2.setZero();
131
132
133 covP1P2=posMomentumCovFirst.transpose()*vrt_weight*posMomentumCovSecond;
134
135
136
137 AmgMatrix(3,3) covNewP = momentumCovFirst+momentumCovSecond+covP1P2+covP1P2.transpose();
138
139 AmgMatrix(3,3) covNewXP=posMomentumCovFirst+posMomentumCovSecond;
140
141
142
143 Amg::
Vector3D newMomentum=myFirstPerigee.momentum()+mySecondPerigee.momentum();
144
145 ATH_MSG_VERBOSE(
" new momentum " << newMomentum <<
" new cov Momentum " << covNewP);
146 ATH_MSG_VERBOSE(
" position " << myVertex.position() <<
" cov Pos - Momentum " << covNewXP);
148
149
150
151
152
153 Trk::JacobianPxyzToPhiThetaQoverPspherical JacobianToPhiThetaQOverP(newMomentum.
phi(),
155 1./newMomentum.
mag());
156
158 AmgMatrix(3,3) finalCovNewXP=covNewXP*JacobianToPhiThetaQOverP.transpose();
159
160 double phi=newMomentum.
phi();
163
167
168
169
170
171
172 double sin_phi_v=sin(
phi);
173 double cos_phi_v=cos(
phi);
174 double tan_th=tan(
theta);
175
176
177 AmgMatrix(5,6) globalNeutralJacobian; globalNeutralJacobian.setZero();
178 globalNeutralJacobian(0,0) = -sin_phi_v;
179 globalNeutralJacobian(0,1) = +cos_phi_v;
180 globalNeutralJacobian(1,0) = -cos_phi_v/tan_th;
181 globalNeutralJacobian(1,1) = -sin_phi_v/tan_th;
182 globalNeutralJacobian(1,2) = 1.;
183 globalNeutralJacobian(2,3) = 1.;
184 globalNeutralJacobian(3,4) = 1.;
185 globalNeutralJacobian(4,5) = 1.;
186
187 AmgMatrix(6,6) fullTrkCov; fullTrkCov.setZero();
188 fullTrkCov.block<3,3>(0,3) = finalCovNewXP;
189 fullTrkCov.block<3,3>(3,0) = finalCovNewXP.transpose();
190 fullTrkCov.block<3,3>(0,0) = vrt_cov;
191 fullTrkCov.block<3,3>(3,3) = finalCovNewP;
192
193
194
195
196 Trk::PerigeeSurface perSurface(myVertex.position());
198
200 }
Scalar mag() const
mag method
Matrix< Scalar, OtherDerived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime > similarity(const MatrixBase< OtherDerived > &m) const
similarity method : yields ms = m*s*m^T
#define ATH_MSG_VERBOSE(x)
#define AmgSymMatrix(dim)
#define AmgMatrix(rows, cols)
std::pair< AmgMatrix(3, 3), AmgMatrix(3, 3)> getPosMomentumAndMomentumCovMatrix(const Trk::LinearizedTrack *linTrack, const AmgMatrix(3, 3) &vrt_cov, const AmgMatrix(3, 3) &vrt_weight) const
static AmgMatrix(3, 3) getPhiThetaQOverPToPxPyPzJacobian(double qOverP
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticleLinks_t & trackParticleLinks() const
Get all the particles associated with the vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
const Amg::Vector3D & position() const
Returns the 3-pos.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersT< NeutralParametersDim, Neutral, PerigeeSurface > NeutralPerigee
TrackParticle_v1 TrackParticle
Reference the current persistent version: