18 if (prevVtxComponents.empty()) {
19 throw VertexException(
"GsfVertexUpdator::(Previous) Vertex to update has no components");
22 LTC ltComponents = track->linearizedTrack()->components();
23 if (ltComponents.empty()) {
24 throw VertexException(
"GsfVertexUpdator::Track to add to vertex has no components");
27 if ((ltComponents.size() == 1) && (prevVtxComponents.size() == 1))
32 std::vector<VertexComponent> newVertexComponents;
33 newVertexComponents.reserve(prevVtxComponents.size() * ltComponents.size());
40 for (VSC::iterator vertexCompIter = prevVtxComponents.begin(); vertexCompIter != prevVtxComponents.end();
42 for (LTC::iterator trackCompIter = ltComponents.begin(); trackCompIter != ltComponents.end(); trackCompIter++) {
43 newVertexComponents.push_back(
createNewComponent(*vertexCompIter, *trackCompIter, trackWeight, +1));
45 if (!newVertexComponents.back().first.isValid())
53 std::vector<RefCountedVertexTrack> newVertexTracks = oldVertex.
tracks();
54 newVertexTracks.push_back(track);
99 throw VertexException(
"GsfVertexUpdator::sign of -1 not yet implemented.");
103 if (weightInMixture < 0.)
122 const std::vector<GsfVertexUpdator::VertexComponent>& newVertexComponents)
const {
123 VSC vertexComponents;
124 vertexComponents.reserve(newVertexComponents.size());
129 double totalChi2 = 0.;
131 for (std::vector<VertexComponent>::const_iterator iter = newVertexComponents.begin();
132 iter != newVertexComponents.end();
134 totalWeight += iter->second.first;
137 if (totalWeight < DBL_MIN) {
138 edm::LogWarning(
"GsfVertexUpdator") <<
"Updated Vertex has total weight of 0. " 139 <<
"The track is probably very far away.";
143 for (std::vector<VertexComponent>::const_iterator iter = newVertexComponents.begin();
144 iter != newVertexComponents.end();
147 if (iter->second.first > DBL_MIN) {
148 vertexComponents.push_back(
VertexState(iter->first.weightTimesPosition(), iter->first.weight(),
weight));
149 totalChi2 += iter->second.second *
weight;
155 if (vertexComponents.empty()) {
156 edm::LogWarning(
"GsfVertexUpdator") <<
"No Vertex State left after reweighting.";
std::pair< bool, double > chi2Increment(const VertexState &oldVertex, const VertexState &newVertexState, const RefCountedLinearizedTrackState linearizedTrack, float weight) const
std::vector< RefCountedVertexTrack > tracks() const
CachingVertex< 5 > merge(const CachingVertex< 5 > &vertex) const
GsfVertexWeightCalculator theWeightCalculator
std::vector< VertexState > VSC
VertexState const & vertexState() const
CachingVertex< N > add(const CachingVertex< N > &oldVertex, const RefCountedVertexTrack track) const override
GsfVertexMerger * clone() const
KalmanVertexUpdator< 5 > kalmanVertexUpdator
GlobalError priorError() const
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
CachingVertex< 5 > remove(const CachingVertex< 5 > &oldVertex, const RefCountedVertexTrack track) const override
AlgebraicVector3 weightTimesPosition() const
GsfVertexUpdator(bool limit=false, const GsfVertexMerger *merger=0)
float totalChiSquared() const
Abs< T >::type abs(const T &t)
std::vector< VertexState > components() const
double calculate(const VertexState &oldVertex, const RefCountedLinearizedTrackState track, double cov) const
GlobalWeight weight() const
VertexState positionUpdate(const VertexState &oldVertex, const RefCountedLinearizedTrackState linearizedTrack, const float weight, int sign) const
VertexChi2Pair assembleVertexComponents(const std::vector< VertexComponent > &newVertexComponents) const
bool isValid() const
Make the ReferenceCountingProxy method to check validity public.
DeepCopyPointerByClone< GsfVertexMerger > theMerger
VertexComponent createNewComponent(const VertexState &oldVertex, const RefCountedLinearizedTrackState linTrack, float weight, int sign) const
std::pair< VertexState, double > VertexChi2Pair
std::pair< double, double > WeightChi2Pair
CachingVertex< 5 > add(const CachingVertex< 5 > &oldVertex, const RefCountedVertexTrack track) const override
std::vector< RefCountedLinearizedTrackState > LTC
GlobalPoint priorPosition() const
float trackWeight(const reco::Vertex &sv, const reco::TransientTrack &track)
std::pair< VertexState, WeightChi2Pair > VertexComponent