12 std::vector<RefCountedVertexTrack>
tracks =
vertex.tracks();
13 int numberOfTracks =
tracks.size();
14 if (numberOfTracks < 1)
18 GlobalPoint priorVertexPosition =
tracks[0]->linearizedTrack()->linearizationPoint();
22 std::vector<RefCountedVertexTrack> initialTracks;
23 CachingVertex<5> fitVertex(priorVertexPosition, priorVertexError, initialTracks, 0);
27 fitVertex =
CachingVertex<5>(priorVertexState, priorVertexState, initialTracks, 0);
31 std::vector<CachingVertex<5> > ascendingFittedVertices;
32 ascendingFittedVertices.reserve(numberOfTracks);
33 ascendingFittedVertices.push_back(fitVertex);
36 for (std::vector<RefCountedVertexTrack>::const_iterator
i =
tracks.begin();
i != (
tracks.end() - 1); ++
i) {
40 ascendingFittedVertices.push_back(fitVertex);
44 priorVertexPosition =
tracks[0]->linearizedTrack()->linearizationPoint();
46 fitVertex =
CachingVertex<5>(priorVertexPosition, priorVertexError, initialTracks, 0);
49 std::vector<CachingVertex<5> > descendingFittedVertices;
50 descendingFittedVertices.reserve(numberOfTracks);
51 descendingFittedVertices.push_back(fitVertex);
54 for (std::vector<RefCountedVertexTrack>::const_iterator
i = (
tracks.end() - 1);
i != (
tracks.begin()); --
i) {
58 descendingFittedVertices.insert(descendingFittedVertices.begin(), fitVertex);
61 std::vector<RefCountedVertexTrack> newTracks;
62 double smoothedChi2 = 0.;
65 for (std::vector<RefCountedVertexTrack>::const_iterator
i =
tracks.begin();
i !=
tracks.end();
i++) {
66 int indexNumber =
i -
tracks.begin();
69 descendingFittedVertices[indexNumber].vertexState());
74 smoothedChi2 += thePair.second.second;
78 thePair.second.second,
96 if (prevVtxComponents.empty()) {
97 throw VertexException(
"GsfVertexSmoother::(Previous) Vertex to update has no components");
100 LTC ltComponents =
track->linearizedTrack()->components();
101 if (ltComponents.empty()) {
102 throw VertexException(
"GsfVertexSmoother::Track to add to vertex has no components");
106 std::vector<RefittedTrackComponent> newTrackComponents;
107 newTrackComponents.reserve(prevVtxComponents.size() * ltComponents.size());
109 for (VSC::iterator vertexCompIter = prevVtxComponents.begin(); vertexCompIter != prevVtxComponents.end();
111 for (LTC::iterator trackCompIter = ltComponents.begin(); trackCompIter != ltComponents.end(); trackCompIter++) {
125 const std::vector<GsfVertexSmoother::RefittedTrackComponent>& trackComponents,
130 double totalVtxChi2 = 0., totalTrkChi2 = 0.;
132 for (std::vector<RefittedTrackComponent>::const_iterator iter = trackComponents.begin();
133 iter != trackComponents.end();
136 totalVtxChi2 += iter->second.first * iter->first.second;
137 totalTrkChi2 += iter->second.second * iter->first.second;
143 std::vector<RefCountedRefittedTrackState> reWeightedRTSC;
144 reWeightedRTSC.reserve(trackComponents.size());
146 for (std::vector<RefittedTrackComponent>::const_iterator iter = trackComponents.begin();
147 iter != trackComponents.end();
149 if (iter->second.first != 0) {
150 reWeightedRTSC.push_back(iter->first.first->stateWithNewWeight(iter->second.first /
totalWeight));
179 std::pair<bool, double> trkCi2 =
helper.trackParameterChi2(linTrack, thePair.first);
186 std::vector<VertexState> vsCompA = vertexA.
components();
187 std::vector<VertexState> vsCompB = vertexB.
components();
188 std::vector<VertexState> finalVS;
189 finalVS.reserve(vsCompA.size() * vsCompB.size());
190 for (std::vector<VertexState>::iterator iA = vsCompA.begin(); iA != vsCompA.end(); ++iA) {
191 for (std::vector<VertexState>::iterator iB = vsCompB.begin(); iB != vsCompB.end(); ++iB) {
193 AlgebraicVector3 newWtP = iA->weightTimesPosition() + iB->weightTimesPosition();
194 double newWeightInMixture = iA->weightInMixture() * iB->weightInMixture();
195 finalVS.push_back(
VertexState(newWtP, newWeight, newWeightInMixture));
198 #ifndef CMS_NO_COMPLEX_RETURNS 207 std::vector<VertexState> priorVertexComp = priorVertex.
components();
208 std::vector<VertexState> fittedVertexComp = fittedVertex.
components();
209 double vetexChi2 = 0.;
210 for (std::vector<VertexState>::iterator pvI = priorVertexComp.begin(); pvI != priorVertexComp.end(); ++pvI) {
211 for (std::vector<VertexState>::iterator fvI = fittedVertexComp.begin(); fvI != fittedVertexComp.end(); ++fvI) {
212 vetexChi2 += (pvI->weightInMixture()) * (fvI->weightInMixture()) *
helper.vertexChi2(*pvI, *fvI);
VertexTrackFactory< 5 > theVTFactory
double calculate(const VertexState &oldVertex, const RefCountedLinearizedTrackState track, double cov) const
VertexTrack< 5 >::RefCountedRefittedTrackState RefCountedRefittedTrackState
std::vector< RefCountedLinearizedTrackState > LTC
CachingVertex< 5 > merge(const CachingVertex< 5 > &vertex) const
CachingVertex< 5 > add(const CachingVertex< 5 > &oldVertex, const RefCountedVertexTrack track) const override
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
VertexState positionUpdate(const VertexState &oldVertex, const RefCountedLinearizedTrackState linearizedTrack, const float weight, int sign) const
GsfVertexSmoother(bool limit, const GsfVertexMerger *merger)
std::pair< double, double > VtxTrkChi2Pair
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
std::pair< RefCountedRefittedTrackState, double > TrackWeightPair
GsfVertexUpdator theUpdator
TrackChi2Pair vertexAndTrackUpdate(const VertexState &oldVertex, const RefCountedVertexTrack track, const GlobalPoint &referencePosition) const
GsfVertexWeightCalculator theWeightCalculator
KalmanVertexUpdator< 5 > kalmanVertexUpdator
std::pair< RefCountedRefittedTrackState, VtxTrkChi2Pair > TrackChi2Pair
std::vector< VertexState > components() const
KalmanVertexTrackUpdator< 5 > theVertexTrackUpdator
double priorVertexChi2(const VertexState priorVertex, const VertexState fittedVertex) const
std::vector< VertexState > VSC
VertexState meanVertex(const VertexState &vertexA, const VertexState &vertexB) const
TrackChi2Pair assembleTrackComponents(const std::vector< RefittedTrackComponent > &trackComponents, const GlobalPoint &referencePosition) const
std::pair< TrackWeightPair, VtxTrkChi2Pair > RefittedTrackComponent
RefittedTrackComponent createNewComponent(const VertexState &oldVertex, const RefCountedLinearizedTrackState linTrack, float weight) const
DeepCopyPointerByClone< GsfVertexMerger > theMerger
CachingVertex< 5 > smooth(const CachingVertex< 5 > &vertex) const override
GsfVertexMerger * clone() const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
VertexTrack< 5 >::AlgebraicSymMatrixOO AlgebraicSymMatrixOO
float trackWeight(const reco::Vertex &sv, const reco::TransientTrack &track)