#include <GsfVertexUpdator.h>
Vertex updator for the Gaussian Sum vertex filter. (c.f. Th.Speer & R. Fruewirth, Comp.Phys.Comm 174, 935 (2006) )
Definition at line 14 of file GsfVertexUpdator.h.
typedef std::vector<RefCountedLinearizedTrackState> GsfVertexUpdator::LTC [private] |
Definition at line 51 of file GsfVertexUpdator.h.
typedef VertexTrack<5>::RefCountedLinearizedTrackState GsfVertexUpdator::RefCountedLinearizedTrackState |
Definition at line 19 of file GsfVertexUpdator.h.
Reimplemented from VertexUpdator< 5 >.
Definition at line 18 of file GsfVertexUpdator.h.
typedef std::pair<VertexState, double> GsfVertexUpdator::VertexChi2Pair [private] |
Definition at line 54 of file GsfVertexUpdator.h.
typedef std::pair<VertexState, WeightChi2Pair> GsfVertexUpdator::VertexComponent [private] |
Definition at line 53 of file GsfVertexUpdator.h.
typedef std::vector<VertexState> GsfVertexUpdator::VSC [private] |
Definition at line 50 of file GsfVertexUpdator.h.
typedef std::pair<double, double> GsfVertexUpdator::WeightChi2Pair [private] |
Definition at line 52 of file GsfVertexUpdator.h.
GsfVertexUpdator::GsfVertexUpdator | ( | bool | limit = false , |
const GsfVertexMerger * | merger = 0 |
||
) |
Definition at line 6 of file GsfVertexUpdator.cc.
References GsfVertexMerger::clone(), limitComponents, and theMerger.
Referenced by clone().
: limitComponents (limit) { if (limitComponents) theMerger = merger->clone(); }
CachingVertex< 5 > GsfVertexUpdator::add | ( | const CachingVertex< 5 > & | oldVertex, |
const RefCountedVertexTrack | track | ||
) | const |
Method to add a track to an existing CachingVertex An invalid vertex is returned in case of problems during the update.
Definition at line 13 of file GsfVertexUpdator.cc.
References KalmanVertexUpdator< N >::add(), assembleVertexComponents(), VertexState::components(), createNewComponent(), CachingVertex< N >::hasPrior(), kalmanVertexUpdator, limitComponents, CachingVertex< N >::priorError(), CachingVertex< N >::priorPosition(), theMerger, CachingVertex< N >::totalChiSquared(), CachingVertex< N >::tracks(), CachingVertex< N >::vertexState(), VertexState::weight(), and VertexState::weightTimesPosition().
Referenced by GsfVertexSmoother::smooth().
{ VSC prevVtxComponents = oldVertex.vertexState().components(); // cout << "GsfVertexUpdator::Add new Track with " // << track->linearizedTrack()->components().size() << " components to vertex of " // << prevVtxComponents.size() << " components.\n"; if (prevVtxComponents.empty()) { throw VertexException ("GsfVertexUpdator::(Previous) Vertex to update has no components"); } LTC ltComponents = track->linearizedTrack()->components(); if (ltComponents.empty()) { throw VertexException ("GsfVertexUpdator::Track to add to vertex has no components"); } if ((ltComponents.size()==1) && (prevVtxComponents.size()==1)) return kalmanVertexUpdator.add(oldVertex, track); float trackWeight = track->weight(); std::vector<VertexComponent> newVertexComponents; newVertexComponents.reserve(prevVtxComponents.size()*ltComponents.size()); // for (LTC::iterator trackCompIter = ltComponents.begin(); // trackCompIter != ltComponents.end(); trackCompIter++ ) { // cout <<(**trackCompIter).state().globalPosition()<<endl; // } for (VSC::iterator vertexCompIter = prevVtxComponents.begin(); vertexCompIter != prevVtxComponents.end(); vertexCompIter++ ) { for (LTC::iterator trackCompIter = ltComponents.begin(); trackCompIter != ltComponents.end(); trackCompIter++ ) { newVertexComponents.push_back( createNewComponent(*vertexCompIter, *trackCompIter, trackWeight, +1)); // return invalid vertex in case one of the updated vertex-components is invalid if (!newVertexComponents.back().first.isValid()) return CachingVertex<5>(); } } // cout << "updator components: "<<newVertexComponents.size()<<endl; // Update tracks vector std::vector<RefCountedVertexTrack> newVertexTracks = oldVertex.tracks(); newVertexTracks.push_back(track); // cout << "a \n "; // Assemble VertexStates and compute Chi**2 VertexChi2Pair vertexChi2Pair = assembleVertexComponents(newVertexComponents); // cout << "b \n "; VertexState newVertexState = vertexChi2Pair.first; // cout << "c \n "; double chi2 = oldVertex.totalChiSquared() + vertexChi2Pair.second; // Merge: if (limitComponents) newVertexState = theMerger->merge(newVertexState); if (oldVertex.hasPrior()) { return CachingVertex<5>(oldVertex.priorPosition(), oldVertex.priorError(), newVertexState.weightTimesPosition(), newVertexState.weight(), newVertexTracks, chi2); } else { return CachingVertex<5>(newVertexState, newVertexTracks, chi2); } }
GsfVertexUpdator::VertexChi2Pair GsfVertexUpdator::assembleVertexComponents | ( | const std::vector< VertexComponent > & | newVertexComponents | ) | const [private] |
Definition at line 134 of file GsfVertexUpdator.cc.
References CommonMethods::weight().
Referenced by add().
{ VSC vertexComponents; vertexComponents.reserve(newVertexComponents.size()); //renormalize weights // cout << "assemble "<<newVertexComponents.size()<<endl; double totalWeight = 0.; double totalChi2 = 0.; for (std::vector<VertexComponent>::const_iterator iter = newVertexComponents.begin(); iter != newVertexComponents.end(); iter ++) { totalWeight += iter->second.first; } // cout << "totalWeight "<<totalWeight<<endl; if (totalWeight<DBL_MIN) { edm::LogWarning("GsfVertexUpdator") << "Updated Vertex has total weight of 0. " <<"The track is probably very far away."; return VertexChi2Pair( VertexState(), 0.); } for (std::vector<VertexComponent>::const_iterator iter = newVertexComponents.begin(); iter != newVertexComponents.end(); iter ++) { double weight = iter->second.first/totalWeight; if (iter->second.first>DBL_MIN) { vertexComponents.push_back(VertexState(iter->first.weightTimesPosition(), iter->first.weight(), weight)); totalChi2 += iter->second.second * weight; } } // cout << "totalChi2 "<<totalChi2<<endl; // cout << "vertexComponents "<<vertexComponents.size()<<endl; if (vertexComponents.empty()){ edm::LogWarning("GsfVertexUpdator") << "No Vertex State left after reweighting."; return VertexChi2Pair( VertexState(), 0.); } return VertexChi2Pair( VertexState( new BasicMultiVertexState( vertexComponents)), totalChi2); }
VertexUpdator<5>* GsfVertexUpdator::clone | ( | void | ) | const [inline, virtual] |
Clone method
Implements VertexUpdator< 5 >.
Definition at line 42 of file GsfVertexUpdator.h.
References GsfVertexUpdator().
{ return new GsfVertexUpdator(* this); }
GsfVertexUpdator::VertexComponent GsfVertexUpdator::createNewComponent | ( | const VertexState & | oldVertex, |
const RefCountedLinearizedTrackState | linTrack, | ||
float | weight, | ||
int | sign | ||
) | const [private] |
Where one component of the previous vertex gets updated with one component of the track.
Definition at line 104 of file GsfVertexUpdator.cc.
References abs, GsfVertexWeightCalculator::calculate(), KalmanVertexUpdator< N >::chi2Increment(), VertexState::isValid(), kalmanVertexUpdator, KalmanVertexUpdator< N >::positionUpdate(), and theWeightCalculator.
Referenced by add().
{ if(abs(sign) != 1) throw VertexException ("GsfVertexUpdator::sign not equal to 1."); if(sign == -1) throw VertexException("GsfVertexUpdator::sign of -1 not yet implemented."); // Weight of the component in the mixture (non-normalized) double weightInMixture = theWeightCalculator.calculate(oldVertex, linTrack, 1.E9); if (weightInMixture < 0.) return VertexComponent(VertexState(), WeightChi2Pair(0.,0.)); // position estimate of the component VertexState newVertex = kalmanVertexUpdator.positionUpdate(oldVertex, linTrack, weight, sign); if (!newVertex.isValid()) return VertexComponent(newVertex, WeightChi2Pair(0.,0.)); //Chi**2 contribution of the component std::pair <bool, double> chi2P = kalmanVertexUpdator.chi2Increment(oldVertex, newVertex, linTrack, weight); if (!chi2P.first) return VertexComponent(VertexState(), WeightChi2Pair(0.,0.)); // cout << "Update: "<<oldVertex.position()<<" "<<newVertex.position()<<" "<<chi2 // <<" "<<linTrack->weightInMixture()<<" "<<weightInMixture<<endl; return VertexComponent(newVertex, WeightChi2Pair(weightInMixture, chi2P.second)); }
CachingVertex< 5 > GsfVertexUpdator::remove | ( | const CachingVertex< 5 > & | oldVertex, |
const RefCountedVertexTrack | track | ||
) | const |
Method removing already used VertexTrack from existing CachingVertex This method is not yet implemented.
Definition at line 90 of file GsfVertexUpdator.cc.
{ throw VertexException("GsfVertexUpdator::Remove Methode not yet done"); // return CachingVertex<5>(); }
KalmanVertexUpdator<5> GsfVertexUpdator::kalmanVertexUpdator [private] |
Definition at line 64 of file GsfVertexUpdator.h.
Referenced by add(), and createNewComponent().
bool GsfVertexUpdator::limitComponents [private] |
Definition at line 62 of file GsfVertexUpdator.h.
Referenced by add(), and GsfVertexUpdator().
Definition at line 63 of file GsfVertexUpdator.h.
Referenced by add(), and GsfVertexUpdator().
Definition at line 65 of file GsfVertexUpdator.h.
Referenced by createNewComponent().