12 template <
unsigned int N>
25 std::pair<bool, double> chi2P =
26 chi2Increment(oldVertex.
vertexState(), newVertexState, track->linearizedTrack(),
weight);
30 chi1 += sign * chi2P.second;
33 std::vector<RefCountedVertexTrack> newVertexTracks = oldVertex.
tracks();
36 newVertexTracks.push_back(track);
38 typename std::vector<RefCountedVertexTrack>::iterator pos =
39 find(newVertexTracks.begin(), newVertexTracks.end(),
track);
40 if (pos != newVertexTracks.end()) {
41 newVertexTracks.erase(pos);
43 std::cout <<
"KalmanVertexUpdator::Unable to find requested track in the current vertex" << std::endl;
44 throw VertexException(
"KalmanVertexUpdator::Unable to find requested track in the current vertex");
55 template <
unsigned int N>
58 float weight = track->weight();
59 return update(oldVertex, track, weight, +1);
62 template <
unsigned int N>
65 float weight = track->weight();
66 return update(oldVertex, track, weight, -1);
69 template <
unsigned int N>
76 if (!linearizedTrack->isValid())
88 <<
"predictedState error matrix inversion failed. An invalid vertex will be returned.";
100 edm::LogWarning(
"KalmanVertexUpdator") <<
"S matrix inversion failed. An invalid vertex will be returned.";
105 trackParametersWeight - ROOT::Math::Similarity(trackParametersWeight, ROOT::Math::Similarity(b, s));
115 (weight *
sign) * ((ROOT::Math::Transpose(a) * gB) *
116 (linearizedTrack->predictedStateParameters() - linearizedTrack->constantTerm()));
128 template <
unsigned int N>
136 if (!linearizedTrack->isValid())
137 return std::pair<bool, double>(
false, -1.);
140 newVertexPositionV(0) = newVertexPosition.
x();
141 newVertexPositionV(1) = newVertexPosition.
y();
142 newVertexPositionV(2) = newVertexPosition.
z();
147 AlgebraicVectorN trackParameters = linearizedTrack->predictedStateParameters();
152 <<
"predictedState error matrix inversion failed. An invalid vertex will be returned.";
153 return std::pair<bool, double>(
false, -1.);
158 edm::LogWarning(
"KalmanVertexUpdator") <<
"S matrix inversion failed. An invalid vertex will be returned.";
159 return std::pair<bool, double>(
false, -1.);
163 AlgebraicVectorN vv = trackParameters - theResidual - a * newVertexPositionV;
164 AlgebraicVectorM newTrackMomentumP = s * ROOT::Math::Transpose(b) * trackParametersWeight * vv;
169 linearizedTrack->checkParameters(parameterResiduals);
171 double chi2 = weight * ROOT::Math::Similarity(parameterResiduals, trackParametersWeight);
174 chi2 += helper.vertexChi2(oldVertex, newVertexState);
176 return std::pair<bool, double>(
true,
chi2);
std::pair< bool, double > chi2Increment(const VertexState &oldVertex, const VertexState &newVertexState, const RefCountedLinearizedTrackState linearizedTrack, float weight) const
std::vector< RefCountedVertexTrack > tracks() const
CachingVertex< N > remove(const CachingVertex< N > &oldVertex, const RefCountedVertexTrack track) const override
VertexState const & vertexState() const
const AlgebraicSymMatrix33 matrix() const
ROOT::Math::SMatrix< double, N, 3, ROOT::Math::MatRepStd< double, N, 3 > > AlgebraicMatrixN3
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
GlobalPoint position() const
ROOT::Math::SMatrix< double, N-2, N-2, ROOT::Math::MatRepSym< double, N-2 > > AlgebraicSymMatrixMM
ROOT::Math::SVector< double, N-2 > AlgebraicVectorM
AlgebraicVector3 weightTimesPosition() const
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
float totalChiSquared() const
Abs< T >::type abs(const T &t)
ROOT::Math::SVector< double, N > AlgebraicVectorN
GlobalWeight weight() const
VertexState positionUpdate(const VertexState &oldVertex, const RefCountedLinearizedTrackState linearizedTrack, const float weight, int sign) const
VertexState const & priorVertexState() const
GlobalErrorBase< double, WeightMatrixTag > GlobalWeight
bool isValid() const
Make the ReferenceCountingProxy method to check validity public.
ROOT::Math::SVector< double, 3 > AlgebraicVector3
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
CachingVertex< N > add(const CachingVertex< N > &oldVertex, const RefCountedVertexTrack track) const override
Log< level::Warning, false > LogWarning
CachingVertex< N > update(const CachingVertex< N > &oldVertex, const RefCountedVertexTrack track, float weight, int sign) const
ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N > > AlgebraicSymMatrixNN
ROOT::Math::SMatrix< double, N, N-2, ROOT::Math::MatRepStd< double, N, N-2 > > AlgebraicMatrixNM