205 RefToBaseLess<Track> > TransientTrackMap;
215 unsigned int bsCovSrc[7] = { 0, };
216 double sigmaZ = 0.0, beamWidth = 0.0;
220 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = bsCovSrc[6] = 1;
221 sigmaZ = beamSpot->sigmaZ();
222 beamWidth = beamSpot->BeamWidthX();
227 bsCovSrc[0] = bsCovSrc[1] = 2;
228 bsCovSrc[3] = bsCovSrc[4] = bsCovSrc[5] = 1;
229 sigmaZ = beamSpot->sigmaZ();
233 bsCovSrc[0] = bsCovSrc[1] = bsCovSrc[2] = 2;
245 std::auto_ptr<ConfigurableVertexReconstructor> vertexReco;
246 std::auto_ptr<GhostTrackVertexFinder> vertexRecoGT;
258 TransientTrackMap primariesMap;
262 std::auto_ptr<SecondaryVertexTagInfoCollection>
263 tagInfos(
new SecondaryVertexTagInfoCollection);
265 for(TrackIPTagInfoCollection::const_iterator iterJets =
266 trackIPTagInfos->begin(); iterJets != trackIPTagInfos->end();
269 std::vector<SecondaryVertexTagInfo::IndexedTrackData> trackData;
271 const Vertex &pv = *iterJets->primaryVertex();
273 std::set<TransientTrack> primaries;
277 TransientTrackMap::iterator
pos =
278 primariesMap.lower_bound(*iter);
280 if (pos != primariesMap.end() &&
282 primaries.insert(pos->second);
284 TransientTrack track =
287 primariesMap.insert(pos,
288 std::make_pair(*iter, track));
289 primaries.insert(track);
300 std::vector<std::size_t> indices =
305 const std::vector<TrackIPTagInfo::TrackIPData> &ipData =
306 iterJets->impactParameterData();
310 std::vector<TransientTrack> fitTracks;
311 std::vector<GhostTrackState> gtStates;
312 std::auto_ptr<GhostTrackPrediction> gtPred;
315 *iterJets->ghostTrack()));
317 for(
unsigned int i = 0;
i < indices.size();
i++) {
323 trackData.back().first = indices[
i];
330 trackData.back().second.svStatus =
331 SecondaryVertexTagInfo::TrackData::trackSelected;
335 TransientTrackMap::const_iterator pos =
338 TransientTrack fitTrack;
339 if (pos != primariesMap.end()) {
340 primaries.erase(pos->second);
341 fitTrack = pos->second;
343 fitTrack = trackBuilder->build(trackRef);
344 fitTracks.push_back(fitTrack);
346 trackData.back().second.svStatus =
347 SecondaryVertexTagInfo::TrackData::trackUsedForVertexFit;
352 ipData[indices[
i]].closestToGhostTrack;
353 gtState.linearize(*gtPred,
true,
354 gtPred->lambda(pos));
355 gtState.setWeight(ipData[indices[i]].ghostTrackWeight);
356 gtStates.push_back(gtState);
367 iterJets->ghostTrack()->px(),
368 iterJets->ghostTrack()->py(),
369 iterJets->ghostTrack()->pz()),
372 iterJets->ghostTrack()->chi2(),
373 iterJets->ghostTrack()->ndof()));
377 std::vector<TransientVertex> fittedSVs;
381 fittedSVs = vertexRecoGT->vertices(
384 fittedSVs = vertexReco->vertices(fitTracks);
389 fittedSVs = vertexRecoGT->vertices(
390 pv, *beamSpot, *ghostTrack);
392 fittedSVs = vertexReco->vertices(fitTracks,
400 for(
unsigned int i = 0; i < 7; i++) {
401 unsigned int covSrc = bsCovSrc[
i];
402 for(
unsigned int j = 0;
j < 7;
j++) {
404 if (!covSrc || bsCovSrc[
j] != covSrc)
406 else if (covSrc == 1)
407 v = beamSpot->covariance(i,
j);
416 beamSpot.
isValid() ? beamSpot->dxdz() : 0.,
417 beamSpot.
isValid() ? beamSpot->dydz() : 0.,
421 fittedSVs = vertexRecoGT->vertices(
422 pv, bs, *ghostTrack);
424 fittedSVs = vertexReco->vertices(fitTracks, bs);
428 std::vector<TransientTrack> primaries_(
429 primaries.begin(), primaries.end());
431 fittedSVs = vertexRecoGT->vertices(
432 pv, *beamSpot, primaries_,
435 fittedSVs = vertexReco->vertices(
436 primaries_, fitTracks,
443 std::vector<SecondaryVertex> SVs;
445 std::remove_copy_if(boost::make_transform_iterator(
446 fittedSVs.begin(), svBuilder),
447 boost::make_transform_iterator(
448 fittedSVs.end(), svBuilder),
449 std::back_inserter(SVs),
464 std::vector<SecondaryVertexTagInfo::VertexData> svData;
466 svData.resize(vtxIndices.size());
467 for(
unsigned int idx = 0; idx < vtxIndices.size(); idx++) {
470 svData[idx].vertex = sv;
472 svData[idx].dist3d = sv.
dist3d();
473 svData[idx].direction =
488 if (pos == trackRefs.
end())
490 <<
"Could not find track from secondary "
491 "vertex in original tracks."
495 trackData[
index].second.svStatus =
497 ((
unsigned int)SecondaryVertexTagInfo::TrackData::trackAssociatedToVertex + idx);
505 trackData, svData, SVs.size(),
506 TrackIPTagInfoRef(trackIPTagInfos,
507 iterJets - trackIPTagInfos->begin())));
math::Error< dimension >::type CovarianceMatrix
reco::Vertex::Point convertPos(const GlobalPoint &p)
T getParameter(std::string const &) const
trackRef_iterator tracks_end() const
last iterator over tracks
VertexFilter vertexFilter
Measurement1D dist3d() const
double y() const
y coordinate
const edm::InputTag trackIPTagInfoLabel
reco::Vertex::Error convertError(const GlobalError &ge)
virtual Vector momentum() const
spatial momentum vector
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
const_iterator end() const
Termination of iteration.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const Point & position() const
position
TrackIPTagInfo::SortCriteria sortCriterium
const_iterator begin() const
Initialize an iterator over the RefVector.
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
edm::ParameterSet vtxRecoPSet
double z() const
y coordinate
ConstraintType constraint
Measurement1D dist2d() const
TrackSelector trackSelector
double x() const
x coordinate
std::pair< unsigned int, TrackData > IndexedTrackData
edm::InputTag beamSpotTag
Error error() const
return SMatrix
VertexSorting vertexSorting
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
trackRef_iterator tracks_begin() const
first iterator over tracks
static GhostTrackVertexFinder::FitType getGhostTrackFitType(const std::string &name)
Global3DVector GlobalVector