10 #include <boost/iterator/transform_iterator.hpp>
51 struct RefToBaseLess :
public std::binary_function<edm::RefToBase<T>,
57 return r1.
id() < r2.
id() ||
77 CONSTRAINT_PV_PRIMARIES_IN_FIT
80 static ConstraintType getConstraintType(
const std::string &
name);
100 return CONSTRAINT_NONE;
101 else if (name ==
"BeamSpot")
102 return CONSTRAINT_BEAMSPOT;
103 else if (name ==
"BeamSpot+PVPosition")
104 return CONSTRAINT_PV_BEAMSPOT_SIZE;
105 else if (name ==
"BeamSpotZ+PVErrorScaledXY")
106 return CONSTRAINT_PV_BS_Z_ERRORS_SCALED;
107 else if (name ==
"PVErrorScaled")
108 return CONSTRAINT_PV_ERROR_SCALED;
109 else if (name ==
"BeamSpot+PVTracksInFit")
110 return CONSTRAINT_PV_PRIMARIES_IN_FIT;
113 <<
"SecondaryVertexProducer: ``constraint'' parameter "
114 "value \"" << name <<
"\" not understood."
121 if (name ==
"AlwaysWithGhostTrack")
123 else if (name ==
"SingleTracksWithGhostTrack")
125 else if (name ==
"RefitGhostTrackWithVertices")
129 <<
"SecondaryVertexProducer: ``fitType'' "
130 "parameter value \"" << name <<
"\" for "
131 "GhostTrackVertexFinder settings not "
132 "understood." << std::endl;
137 trackIPTagInfoLabel(params.getParameter<edm::InputTag>(
"trackIPTagInfos")),
138 sortCriterium(TrackSorting::
getCriterium(params.getParameter<std::string>(
"trackSort"))),
140 constraint(getConstraintType(params.getParameter<std::string>(
"constraint"))),
141 constraintScaling(1.0),
142 vtxRecoPSet(params.getParameter<edm::
ParameterSet>(
"vertexReco")),
143 useGhostTrack(vtxRecoPSet.getParameter<std::string>(
"finder") ==
"gtvr"),
144 withPVError(params.getParameter<bool>(
"usePVError")),
145 minTrackWeight(params.getParameter<double>(
"minimumTrackWeight")),
146 vertexFilter(params.getParameter<edm::
ParameterSet>(
"vertexCuts")),
147 vertexSorting(params.getParameter<edm::
ParameterSet>(
"vertexSelection"))
159 produces<SecondaryVertexTagInfoCollection>();
168 public std::unary_function<const Vertex&, SecondaryVertex> {
173 pv(pv), direction(direction),
174 withPVError(withPVError) {}
185 public std::unary_function<const SecondaryVertex&, bool> {
189 filter(filter), pv(pv), direction(direction) {}
192 {
return !
filter(pv, sv, direction); }
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;
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
reco::TrackIPTagInfo::SortCriteria getCriterium(const std::string &name)
trackRef_iterator tracks_end() const
last iterator over tracks
static ConstraintType getConstraintType(const std::string &name)
VertexFilter vertexFilter
Measurement1D dist3d() const
#define DEFINE_FWK_MODULE(type)
double y() const
y coordinate
SecondaryVertexProducer(const edm::ParameterSet ¶ms)
const edm::InputTag trackIPTagInfoLabel
reco::Vertex::Error convertError(const GlobalError &ge)
virtual Vector momentum() const
spatial momentum vector
virtual void produce(edm::Event &event, const edm::EventSetup &es)
void setWeight(double weight)
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
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Measurement1D dist2d() const
TrackSelector trackSelector
double x() const
x coordinate
std::pair< unsigned int, TrackData > IndexedTrackData
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
edm::InputTag beamSpotTag
bool linearize(const GhostTrackPrediction &pred, bool initial=false, double lambda=0.)
Error error() const
return SMatrix
~SecondaryVertexProducer()
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
tuple trackSelector
Tracks selection.