245 std::unique_ptr<reco::TrackCollection> selTracks_;
246 std::unique_ptr<reco::TrackExtraCollection> selTrackExtras_;
247 std::unique_ptr<TrackingRecHitCollection> selHits_;
248 std::unique_ptr<std::vector<Trajectory> > selTrajs_;
249 std::unique_ptr<std::vector<const Trajectory *> > selTrajPtrs_;
250 std::unique_ptr<TrajTrackAssociationCollection > selTTAss_;
255 std::vector<reco::TrackRef> trackRefs_;
260 using namespace reco;
271 vertexBeamSpot = *hBsp;
275 std::vector<Point>
points;
276 std::vector<float> vterr, vzerr;
281 LogDebug(
"SelectVertex") << points.size() <<
" good pixel vertices";
293 selTracks_ = std::make_unique<TrackCollection>();
296 selTrackExtras_ = std::make_unique<TrackExtraCollection>();
297 selHits_ = std::make_unique<TrackingRecHitCollection>();
304 std::vector<float> mvaVals_(hSrcTrack->size(),-99.f);
309 for (TrackCollection::const_iterator it = hSrcTrack->begin(), ed = hSrcTrack->end(); it != ed; ++it, ++current) {
310 const Track & trk = * it;
313 LogTrace(
"TrackSelection") <<
"ready to check track with pt="<< trk.
pt() ;
317 bool ok =
select(0,vertexBeamSpot, srcHits, trk, points, vterr, vzerr,mvaVal);
320 LogTrace(
"TrackSelection") <<
"track with pt="<< trk.
pt() <<
" NOT selected";
325 LogTrace(
"TrackSelection") <<
"track with pt="<< trk.
pt() <<
" selected";
326 selTracks_->push_back(
Track( trk ) );
330 selTracks_->back().setQuality(TrackBase::loose);
333 selTracks_->back().setQuality(TrackBase::loose);
334 selTracks_->back().setQuality(TrackBase::tight);
336 if (!points.empty()) {
338 selTracks_->back().setQuality(TrackBase::looseSetWithPV);
341 selTracks_->back().setQuality(TrackBase::looseSetWithPV);
342 selTracks_->back().setQuality(TrackBase::highPuritySetWithPV);
353 selTracks_->back().setExtra(
TrackExtraRef( rTrackExtras_, selTrackExtras_->size() - 1) );
357 auto const firstHitIndex = selHits_->size();
359 selHits_->push_back( (*hit)->clone() );
361 tx.
setHits( rHits_, firstHitIndex, selHits_->
size() - firstHitIndex);
365 trackRefs_[current] =
TrackRef(rTracks_, selTracks_->size() - 1);
373 selTrajs_ = std::make_unique<std::vector<Trajectory>>();
375 selTTAss_ = std::make_unique<TrajTrackAssociationCollection>(rTrajectories_, rTracks_);
376 for (
size_t i = 0,
n = hTraj->size();
i <
n; ++
i) {
379 if (match != hTTAss->
end()) {
381 short oldKey =
static_cast<short>(trkRef.
key());
382 if (trackRefs_[oldKey].isNonnull()) {
384 selTTAss_->insert (
Ref< vector<Trajectory> >(rTrajectories_, selTrajs_->size() - 1), trackRefs_[oldKey] );
const edm::RefToBase< TrajectorySeed > & seedRef() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const TrackExtraRef & extra() const
reference to "extra" object
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< bool > keepAllTracks_
bool select(unsigned tsNum, const reco::BeamSpot &vertexBeamSpot, const TrackingRecHitCollection &recHits, const reco::Track &tk, const std::vector< Point > &points, std::vector< float > &vterr, std::vector< float > &vzerr, double mvaVal) const
return class, or -1 if rejected
bool copyTrajectories_
copy also trajectories and trajectory->track associations
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< Track > TrackCollection
collection of Tracks
bool innerOk() const
return true if the innermost hit is valid
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
key_type key() const
Accessor for product key.
const math::XYZPoint & outerPosition() const
position of the outermost hit
edm::EDGetTokenT< TrackingRecHitCollection > hSrc_
edm::EDGetTokenT< std::vector< Trajectory > > srcTraj_
edm::EDGetTokenT< reco::VertexCollection > vertices_
const math::XYZPoint & innerPosition() const
position of the innermost hit
edm::EDGetTokenT< reco::BeamSpot > beamspot_
std::vector< bool > setQualityBit_
do I have to set a quality bit?
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
double pt() const
track transverse momentum
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
RefProd< PROD > getRefBeforePut()
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
void selectVertices(unsigned int tsNum, const reco::VertexCollection &vtxs, std::vector< Point > &points, std::vector< float > &vterr, std::vector< float > &vzerr) const
T const * product() const
bool outerOk() const
return true if the outermost hit is valid
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
std::vector< reco::TrackBase::TrackQuality > qualityToSet_
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTass_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
const TrackResiduals & residuals() const
get the residuals
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::EDGetTokenT< reco::TrackCollection > src_
source collection label
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
void processMVA(edm::Event &evt, const edm::EventSetup &es, const reco::BeamSpot &beamspot, const reco::VertexCollection &vertices, int selIndex, std::vector< float > &mvaVals_, bool writeIt=false) const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.