7 limitComponents (limit)
16 std::vector<RefCountedVertexTrack>
tracks = vertex.
tracks();
17 int numberOfTracks = tracks.size();
18 if (numberOfTracks<1)
return vertex;
21 GlobalPoint priorVertexPosition = tracks[0]->linearizedTrack()->linearizationPoint();
25 std::vector<RefCountedVertexTrack> initialTracks;
26 CachingVertex<5> fitVertex(priorVertexPosition,priorVertexError,initialTracks,0);
35 std::vector<CachingVertex<5> > ascendingFittedVertices;
36 ascendingFittedVertices.reserve(numberOfTracks);
37 ascendingFittedVertices.push_back(fitVertex);
40 for (std::vector<RefCountedVertexTrack>::const_iterator
i = tracks.begin();
41 i != (tracks.end()-1); ++
i) {
44 ascendingFittedVertices.push_back(fitVertex);
48 priorVertexPosition = tracks[0]->linearizedTrack()->linearizationPoint();
50 fitVertex =
CachingVertex<5>(priorVertexPosition,priorVertexError,initialTracks,0);
53 std::vector<CachingVertex<5> > descendingFittedVertices;
54 descendingFittedVertices.reserve(numberOfTracks);
55 descendingFittedVertices.push_back(fitVertex);
58 for (std::vector<RefCountedVertexTrack>::const_iterator
i = (tracks.end()-1);
59 i != (tracks.begin()); --
i) {
62 descendingFittedVertices.insert(descendingFittedVertices.begin(), fitVertex);
65 std::vector<RefCountedVertexTrack> newTracks;
66 double smoothedChi2 = 0.;
69 for(std::vector<RefCountedVertexTrack>::const_iterator
i = tracks.begin();
70 i != tracks.end();
i++)
72 int indexNumber =
i-tracks.begin();
75 meanVertex(ascendingFittedVertices[indexNumber].vertexState(),
76 descendingFittedVertices[indexNumber].vertexState());
80 smoothedChi2 += thePair.second.second;
82 vertex.
vertexState(), thePair.first, thePair.second.second,
89 newTracks, smoothedChi2);
102 if (prevVtxComponents.empty()) {
104 (
"GsfVertexSmoother::(Previous) Vertex to update has no components");
107 LTC ltComponents = track->linearizedTrack()->components();
108 if (ltComponents.empty()) {
110 (
"GsfVertexSmoother::Track to add to vertex has no components");
114 std::vector<RefittedTrackComponent> newTrackComponents;
115 newTrackComponents.reserve(prevVtxComponents.size()*ltComponents.size());
117 for (VSC::iterator vertexCompIter = prevVtxComponents.begin();
118 vertexCompIter != prevVtxComponents.end(); vertexCompIter++ ) {
120 for (LTC::iterator trackCompIter = ltComponents.begin();
121 trackCompIter != ltComponents.end(); trackCompIter++ ) {
122 newTrackComponents.push_back
136 const std::vector<GsfVertexSmoother::RefittedTrackComponent> & trackComponents,
143 double totalWeight = 0.;
144 double totalVtxChi2 = 0., totalTrkChi2 = 0.;
146 for (std::vector<RefittedTrackComponent>::const_iterator
iter = trackComponents.begin();
147 iter != trackComponents.end(); ++
iter ) {
148 totalWeight +=
iter->first.second;
149 totalVtxChi2 +=
iter->second.first *
iter->first.second ;
150 totalTrkChi2 +=
iter->second.second *
iter->first.second ;
153 totalVtxChi2 /= totalWeight ;
154 totalTrkChi2 /= totalWeight ;
156 std::vector<RefCountedRefittedTrackState> reWeightedRTSC;
157 reWeightedRTSC.reserve(trackComponents.size());
160 for (std::vector<RefittedTrackComponent>::const_iterator
iter = trackComponents.begin();
161 iter != trackComponents.end(); ++
iter ) {
162 if (
iter->second.first!=0) {
163 reWeightedRTSC.push_back(
iter->first.first->stateWithNewWeight(
iter->second.first/totalWeight));
190 linTrack, trackWeight, sign);
208 std::vector<VertexState> vsCompA = vertexA.
components();
209 std::vector<VertexState> vsCompB = vertexB.
components();
210 std::vector<VertexState> finalVS;
211 finalVS.reserve(vsCompA.size()*vsCompB.size());
212 for (std::vector<VertexState>::iterator iA = vsCompA.begin(); iA!= vsCompA.end(); ++iA)
214 for (std::vector<VertexState>::iterator iB = vsCompB.begin(); iB!= vsCompB.end(); ++iB)
217 iB->weight().matrix_new();
219 iB->weightTimesPosition();
220 double newWeightInMixture = iA->weightInMixture() *
221 iB->weightInMixture();
222 finalVS.push_back(
VertexState(newWtP, newWeight, newWeightInMixture) );
225 #ifndef CMS_NO_COMPLEX_RETURNS
237 std::vector<VertexState> priorVertexComp = priorVertex.
components();
238 std::vector<VertexState> fittedVertexComp = fittedVertex.
components();
239 double vetexChi2 = 0.;
240 for (std::vector<VertexState>::iterator pvI = priorVertexComp.begin();
241 pvI!= priorVertexComp.end(); ++pvI)
243 for (std::vector<VertexState>::iterator fvI = fittedVertexComp.begin();
244 fvI!= fittedVertexComp.end(); ++fvI)
246 vetexChi2 += (pvI->weightInMixture())*(fvI->weightInMixture())*
VertexTrackFactory< 5 > theVTFactory
VertexTrack< 5 >::RefCountedRefittedTrackState RefCountedRefittedTrackState
std::vector< RefCountedLinearizedTrackState > LTC
TrackChi2Pair vertexAndTrackUpdate(const VertexState &oldVertex, const RefCountedVertexTrack track, const GlobalPoint &referencePosition) const
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
CachingVertex< 5 > merge(const CachingVertex< 5 > &vertex) const
GsfVertexSmoother(bool limit, const GsfVertexMerger *merger)
VertexState const & vertexState() const
std::pair< double, double > VtxTrkChi2Pair
TrackChi2Pair assembleTrackComponents(const std::vector< RefittedTrackComponent > &trackComponents, const GlobalPoint &referencePosition) const
std::pair< RefCountedRefittedTrackState, double > TrackWeightPair
GsfVertexMerger * clone() const
GsfVertexUpdator theUpdator
double vertexChi2(const VertexState &vertexA, const VertexState &VertexB) const
std::vector< RefCountedVertexTrack > const & tracks() const
virtual CachingVertex< 5 > smooth(const CachingVertex< 5 > &vertex) const
GsfVertexWeightCalculator theWeightCalculator
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
KalmanVertexUpdator< 5 > kalmanVertexUpdator
std::pair< RefCountedRefittedTrackState, VtxTrkChi2Pair > TrackChi2Pair
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
BDpair trackParameterChi2(const RefCountedLinearizedTrackState linTrack, const RefCountedRefittedTrackState refittedTrackState) const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
std::vector< VertexState > components() const
KalmanVertexTrackUpdator< 5 > theVertexTrackUpdator
VertexState meanVertex(const VertexState &vertexA, const VertexState &vertexB) const
double calculate(const VertexState &oldVertex, const RefCountedLinearizedTrackState track, double cov) const
std::vector< VertexState > VSC
RefittedTrackComponent createNewComponent(const VertexState &oldVertex, const RefCountedLinearizedTrackState linTrack, float weight) const
std::pair< TrackWeightPair, VtxTrkChi2Pair > RefittedTrackComponent
VertexState positionUpdate(const VertexState &oldVertex, const RefCountedLinearizedTrackState linearizedTrack, const float weight, int sign) const
VertexState const & priorVertexState() const
float trackWeight(const reco::Vertex &sv, const reco::TransientTrack &track)
GlobalPoint position() const
DeepCopyPointerByClone< GsfVertexMerger > theMerger
CachingVertex< 5 > add(const CachingVertex< 5 > &oldVertex, const RefCountedVertexTrack track) const
double priorVertexChi2(const VertexState priorVertex, const VertexState fittedVertex) const
VertexTrack< 5 >::AlgebraicSymMatrixOO AlgebraicSymMatrixOO