9 template <
unsigned int N>
12 const std::vector<RefCountedVertexTrack>& tks,
14 : theVertexState(
pos, posErr),
15 theChiSquared(totalChiSq),
17 theNDFAvailable(
false),
19 theCovMapAvailable(
false),
27 template <
unsigned int N>
31 const std::vector<RefCountedVertexTrack>& tks,
33 : theVertexState(
pos,
time, posTimeErr),
34 theChiSquared(totalChiSq),
36 theNDFAvailable(
false),
38 theCovMapAvailable(
false),
46 template <
unsigned int N>
49 const std::vector<RefCountedVertexTrack>& tks,
51 : theVertexState(
pos, posWeight),
52 theChiSquared(totalChiSq),
54 theNDFAvailable(
false),
56 theCovMapAvailable(
false),
62 template <
unsigned int N>
66 const std::vector<RefCountedVertexTrack>& tks,
68 : theVertexState(
pos,
time, posTimeWeight),
69 theChiSquared(totalChiSq),
71 theNDFAvailable(
false),
73 theCovMapAvailable(
false),
79 template <
unsigned int N>
82 const std::vector<RefCountedVertexTrack>& tks,
84 : theVertexState(weightTimesPosition, posWeight),
85 theChiSquared(totalChiSq),
87 theNDFAvailable(
false),
89 theCovMapAvailable(
false),
95 template <
unsigned int N>
98 const std::vector<RefCountedVertexTrack>& tks,
100 : theVertexState(weightTimesPosition, posWeight),
101 theChiSquared(totalChiSq),
103 theNDFAvailable(
false),
105 theCovMapAvailable(
false),
110 template <
unsigned int N>
112 const std::vector<RefCountedVertexTrack>& tks,
114 : theVertexState(aVertexState),
115 theChiSquared(totalChiSq),
117 theNDFAvailable(
false),
119 theCovMapAvailable(
false),
122 vertexIs4D(aVertexState.is4D()) {}
124 template <
unsigned int N>
126 const std::vector<RefCountedVertexTrack>& tks,
129 : theVertexState(aVertexState),
130 theChiSquared(totalChiSq),
132 theNDFAvailable(
false),
135 theCovMapAvailable(
true),
138 vertexIs4D(aVertexState.is4D()) {
143 template <
unsigned int N>
146 const std::vector<RefCountedVertexTrack>& tks,
148 : theVertexState(aVertexState),
149 theChiSquared(totalChiSq),
151 theNDFAvailable(
false),
153 theCovMapAvailable(
false),
154 thePriorVertexState(priorVertexState),
157 vertexIs4D(priorVertexState.is4D() && aVertexState.is4D()) {}
160 template <
unsigned int N>
165 const std::vector<RefCountedVertexTrack>& tks,
167 : theVertexState(
pos, posErr),
168 theChiSquared(totalChiSq),
170 theNDFAvailable(
false),
172 theCovMapAvailable(
false),
173 thePriorVertexState(priorPos, priorErr),
179 template <
unsigned int N>
181 const double priorTime,
186 const std::vector<RefCountedVertexTrack>& tks,
188 : theVertexState(
pos,
time, posErr),
189 theChiSquared(totalChiSq),
191 theNDFAvailable(
false),
193 theCovMapAvailable(
false),
194 thePriorVertexState(priorPos, priorTime, priorErr),
200 template <
unsigned int N>
205 const std::vector<RefCountedVertexTrack>& tks,
207 : theVertexState(
pos, posWeight),
208 theChiSquared(totalChiSq),
210 theNDFAvailable(
false),
212 theCovMapAvailable(
false),
213 thePriorVertexState(priorPos, priorErr),
219 template <
unsigned int N>
221 const double priorTime,
226 const std::vector<RefCountedVertexTrack>& tks,
228 : theVertexState(
pos, priorTime, posWeight),
229 theChiSquared(totalChiSq),
231 theNDFAvailable(
false),
233 theCovMapAvailable(
false),
234 thePriorVertexState(priorPos, priorTime, priorErr),
240 template <
unsigned int N>
245 const std::vector<RefCountedVertexTrack>& tks,
247 : theVertexState(weightTimesPosition, posWeight),
248 theChiSquared(totalChiSq),
250 theNDFAvailable(
false),
252 theCovMapAvailable(
false),
253 thePriorVertexState(priorPos, priorErr),
258 template <
unsigned int N>
263 const std::vector<RefCountedVertexTrack>& tks,
265 : theVertexState(weightTimesPosition, posWeight),
266 theChiSquared(totalChiSq),
268 theNDFAvailable(
false),
270 theCovMapAvailable(
false),
271 thePriorVertexState(priorPos, priorErr),
275 template <
unsigned int N>
278 const std::vector<RefCountedVertexTrack>& tks,
281 : theVertexState(aVertexState),
282 theChiSquared(totalChiSq),
284 theNDFAvailable(
false),
287 theCovMapAvailable(
true),
288 thePriorVertexState(priorVertexState),
291 vertexIs4D(priorVertexState.is4D() && aVertexState.is4D()) {
296 template <
unsigned int N>
300 theNDFAvailable(
false),
302 theCovMapAvailable(
false),
307 template <
unsigned int N>
309 return theVertexState.position();
312 template <
unsigned int N>
314 return theVertexState.time();
317 template <
unsigned int N>
319 return theVertexState.error();
322 template <
unsigned int N>
324 return theVertexState.error4D();
327 template <
unsigned int N>
329 return theVertexState.weight();
332 template <
unsigned int N>
334 return theVertexState.weight4D();
337 template <
unsigned int N>
339 return theVertexState.weightTimesPosition();
342 template <
unsigned int N>
344 return theVertexState.weightTimesPosition4D();
347 template <
unsigned int N>
349 if (!theNDFAvailable)
354 template <
unsigned int N>
357 for (
typename std::vector<RefCountedVertexTrack>::const_iterator itk = theTracks.begin(); itk != theTracks.end();
359 theNDF += (**itk).weight();
362 const double adjust = (vertexIs4D ? 4 : 3);
365 theNDFAvailable =
true;
368 template <
unsigned int N>
371 if (!tkToTkCovarianceIsAvailable()) {
372 throw VertexException(
"CachingVertex::TkTkCovariance requested before been calculated");
386 if (
it != theCovMap.end()) {
388 typename TrackMap::const_iterator nit = tm.find(tr2);
389 if (nit != tm.end()) {
391 return (ROOT::Math::Transpose(nit->second));
393 return (nit->second);
395 throw VertexException(
"CachingVertex::requested TkTkCovariance does not exist");
398 throw VertexException(
"CachingVertex::requested TkTkCovariance does not exist");
403 template <
unsigned int N>
409 typedef std::map<reco::TransientTrack, float> TransientTrackToFloatMap;
412 std::vector<reco::TransientTrack> ttVect;
413 ttVect.reserve(theTracks.size());
414 std::vector<reco::TransientTrack> refTTVect;
415 TransientTrackToFloatMap theWeightMap;
419 for (
typename std::vector<RefCountedVertexTrack>::const_iterator
i = theTracks.begin();
i != theTracks.end(); ++
i) {
424 ttVect.push_back(
t1);
426 theWeightMap[
t1] = (**i).weight();
429 if (theCovMapAvailable) {
430 for (
typename std::vector<RefCountedVertexTrack>::const_iterator
j = (
i + 1);
j != theTracks.end(); ++
j) {
432 ttCovMap[
t1][
t2] = tkToTkCovariance(*
i, *
j);
435 if ((**i).refittedStateAvailable()) {
436 refTTVect.push_back((**i).refittedState()->transientTrack());
441 tv =
TransientVertex(priorVertexState(), vertexState(), ttVect, totalChiSquared(), degreesOfFreedom());
443 tv =
TransientVertex(vertexState(), ttVect, totalChiSquared(), degreesOfFreedom());
446 if (theCovMapAvailable)
448 if (!refTTVect.empty())
GlobalError error4D() const
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
GlobalWeight weight4D() const
TrackToTrackMap theCovMap
std::map< reco::TransientTrack, TTmap > TTtoTTmap
TransientTrackToFloatMap weightMap() const
AlgebraicVector3 weightTimesPosition() const
ROOT::Math::SVector< double, 4 > AlgebraicVector4
AlgebraicMatrix33 tkToTkCovariance(const reco::TransientTrack &t1, const reco::TransientTrack &t2) const
ROOT::Math::SMatrix< double, N - 2, N - 2, ROOT::Math::MatRepStd< double, N - 2, N - 2 > > AlgebraicMatrixMM
AlgebraicMatrixMM tkToTkCovariance(const RefCountedVertexTrack t1, const RefCountedVertexTrack t2) const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
float degreesOfFreedom() const
std::map< RefCountedVertexTrack, AlgebraicMatrixMM > TrackMap
GlobalPoint position() const
GlobalError error() const
AlgebraicVector4 weightTimesPosition4D() const
GlobalWeight weight() const
std::vector< reco::TransientTrack > const & refittedTracks() const