11 template <
unsigned int N>
16 (
"KalmanVertexUpdator::abs(sign) not equal to 1");
19 track->linearizedTrack(),
weight, sign);
23 std::pair <bool, double> chi2P = chi2Increment(oldVertex.
vertexState(), newVertexState,
24 track->linearizedTrack() ,
weight );
27 chi1 +=sign * chi2P.second;
30 std::vector<RefCountedVertexTrack> newVertexTracks = oldVertex.
tracks();
33 newVertexTracks.push_back(track);
36 typename std::vector<RefCountedVertexTrack>::iterator
pos
37 =
find(newVertexTracks.begin(), newVertexTracks.end(), track);
38 if (pos != newVertexTracks.end()) {
39 newVertexTracks.erase(pos);
41 std::cout<<
"KalmanVertexUpdator::Unable to find requested track in the current vertex"<<std::endl;
42 throw VertexException(
"KalmanVertexUpdator::Unable to find requested track in the current vertex");
48 newVertexState, newVertexTracks, chi1);
55 template <
unsigned int N>
59 float weight = track->weight();
60 return update(oldVertex,track,weight,+1);
63 template <
unsigned int N>
67 float weight = track->weight();
68 return update(oldVertex,track,weight,-1);
72 template <
unsigned int N>
76 const float weight,
int sign)
const
80 if (!linearizedTrack->isValid())
90 linearizedTrack->predictedStateWeight(error);
92 edm::LogWarning(
"KalmanVertexUpdator") <<
"predictedState error matrix inversion failed. An invalid vertex will be returned.";
104 error = ! s.Invert();
106 edm::LogWarning(
"KalmanVertexUpdator") <<
"S matrix inversion failed. An invalid vertex will be returned.";
111 ROOT::Math::Similarity(trackParametersWeight, ROOT::Math::Similarity(b,s));
116 + weight * sign * ROOT::Math::SimilarityT(a,gB);
123 ( linearizedTrack->predictedStateParameters() - linearizedTrack->constantTerm());
136 template <
unsigned int N>
145 if (!linearizedTrack->isValid())
146 return std::pair <bool, double> (
false, -1. );
149 newVertexPositionV(0) = newVertexPosition.
x();
150 newVertexPositionV(1) = newVertexPosition.
y();
151 newVertexPositionV(2) = newVertexPosition.
z();
157 linearizedTrack->predictedStateParameters();
160 linearizedTrack->predictedStateWeight(error);
162 edm::LogWarning(
"KalmanVertexUpdator") <<
"predictedState error matrix inversion failed. An invalid vertex will be returned.";
163 return std::pair <bool, double> (
false, -1.);
167 error = ! s.Invert();
169 edm::LogWarning(
"KalmanVertexUpdator") <<
"S matrix inversion failed. An invalid vertex will be returned.";
170 return std::pair <bool, double> (
false, -1.);
174 AlgebraicVectorM newTrackMomentumP = s * ROOT::Math::Transpose(b) * trackParametersWeight *
175 (trackParameters - theResidual - a*newVertexPositionV);
181 ( theResidual + a * newVertexPositionV + b * newTrackMomentumP);
182 linearizedTrack->checkParameters(parameterResiduals);
184 double chi2 = weight * ROOT::Math::Similarity(parameterResiduals, trackParametersWeight);
187 chi2 += helper.vertexChi2(oldVertex, newVertexState);
189 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
VertexState vertexState() const
ROOT::Math::SMatrix< double, N, N-2, ROOT::Math::MatRepStd< double, N, N-2 > > AlgebraicMatrixNM
ROOT::Math::SVector< double, N > AlgebraicVectorN
ROOT::Math::SMatrix< double, N, 3, ROOT::Math::MatRepStd< double, N, 3 > > AlgebraicMatrixN3
ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N > > AlgebraicSymMatrixNN
ROOT::Math::SMatrix< double, N-2, N-2, ROOT::Math::MatRepSym< double, N-2 > > AlgebraicSymMatrixMM
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
GlobalPoint position() const
const AlgebraicSymMatrix33 & matrix_new() const
CachingVertex< N > remove(const CachingVertex< N > &oldVertex, const RefCountedVertexTrack track) const
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
AlgebraicVector3 weightTimesPosition() const
VertexState priorVertexState() const
float totalChiSquared() const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
GlobalWeight weight() const
VertexState positionUpdate(const VertexState &oldVertex, const RefCountedLinearizedTrackState linearizedTrack, const float weight, int sign) const
GlobalErrorBase< double, WeightMatrixTag > GlobalWeight
bool isValid() const
Make the ReferenceCountingProxy method to check validity public.
CachingVertex< N > add(const CachingVertex< N > &oldVertex, const RefCountedVertexTrack track) const
CachingVertex< N > update(const CachingVertex< N > &oldVertex, const RefCountedVertexTrack track, float weight, int sign) const
ROOT::Math::SVector< double, N-2 > AlgebraicVectorM