69 #include <Math/DistFunc.h>
109 produces<edm::ValueMap<float> >(
"MVAVals");
122 if (copyTrajectories_) {
154 cfg.
existsAs<int32_t>(
"max_minMissHitOutOrIn") ?
155 cfg.
getParameter<int32_t>(
"max_minMissHitOutOrIn") : 99);
157 cfg.
existsAs<
double>(
"max_lostHitFraction") ?
173 edm::LogError(
"MisConfiguration")<<
"vector of size less then 2";
177 if (cfg.
exists(
"qualityBit")) {
179 if (qualityStr !=
"") {
186 "If you set 'keepAllTracks' to true, you must specify which qualityBit to set.\n";
188 "You can't set the quality bit " << cfg.
getParameter<
std::string>(
"qualityBit") <<
" as it is 'undefQuality' or unknown.\n";
199 bool thisMVA =
false;
224 produces<reco::TrackCollection>().setBranchAlias( alias +
"Tracks");
226 produces<reco::TrackExtraCollection>().setBranchAlias( alias +
"TrackExtras");
227 produces<TrackingRecHitCollection>().setBranchAlias( alias +
"RecHits");
229 if (copyTrajectories_) {
230 produces< std::vector<Trajectory> >().setBranchAlias( alias +
"Trajectories");
231 produces< TrajTrackAssociationCollection >().setBranchAlias( alias +
"TrajectoryTrackAssociations");
243 std::auto_ptr<reco::TrackCollection> selTracks_;
244 std::auto_ptr<reco::TrackExtraCollection> selTrackExtras_;
245 std::auto_ptr< TrackingRecHitCollection> selHits_;
246 std::auto_ptr< std::vector<Trajectory> > selTrajs_;
247 std::auto_ptr< std::vector<const Trajectory *> > selTrajPtrs_;
248 std::auto_ptr< TrajTrackAssociationCollection > selTTAss_;
253 std::vector<reco::TrackRef> trackRefs_;
258 using namespace reco;
269 vertexBeamSpot = *hBsp;
273 std::vector<Point> points;
274 std::vector<float> vterr, vzerr;
279 LogDebug(
"SelectVertex") << points.size() <<
" good pixel vertices";
302 std::vector<float> mvaVals_(hSrcTrack->size(),-99.f);
303 processMVA(evt,es,vertexBeamSpot,*(hVtx.product()),0,mvaVals_,
true);
307 for (TrackCollection::const_iterator it = hSrcTrack->begin(), ed = hSrcTrack->end(); it != ed; ++it, ++
current) {
308 const Track & trk = * it;
311 LogTrace(
"TrackSelection") <<
"ready to check track with pt="<< trk.
pt() ;
315 bool ok =
select(0,vertexBeamSpot, srcHits, trk, points, vterr, vzerr,mvaVal);
318 LogTrace(
"TrackSelection") <<
"track with pt="<< trk.
pt() <<
" NOT selected";
323 LogTrace(
"TrackSelection") <<
"track with pt="<< trk.
pt() <<
" selected";
324 selTracks_->push_back(
Track( trk ) );
328 selTracks_->back().setQuality(TrackBase::loose);
331 selTracks_->back().setQuality(TrackBase::loose);
332 selTracks_->back().setQuality(TrackBase::tight);
334 if (!points.empty()) {
336 selTracks_->back().setQuality(TrackBase::looseSetWithPV);
339 selTracks_->back().setQuality(TrackBase::looseSetWithPV);
340 selTracks_->back().setQuality(TrackBase::highPuritySetWithPV);
351 selTracks_->back().setExtra(
TrackExtraRef( rTrackExtras_, selTrackExtras_->size() - 1) );
355 auto const firstHitIndex = selHits_->size();
357 selHits_->push_back( (*hit)->clone() );
359 tx.
setHits( rHits_, firstHitIndex, selHits_->size() - firstHitIndex);
370 selTrajs_ = auto_ptr< vector<Trajectory> >(
new vector<Trajectory>());
373 for (
size_t i = 0,
n = hTraj->size();
i <
n; ++
i) {
376 if (match != hTTAss->end()) {
378 short oldKey =
static_cast<short>(trkRef.
key());
379 if (trackRefs_[oldKey].isNonnull()) {
381 selTTAss_->insert (
Ref< vector<Trajectory> >(rTrajectories_, selTrajs_->size() - 1), trackRefs_[oldKey] );
389 evt.
put(selTrackExtras_);
std::vector< double > chi2n_no1Dmod_par_
T getParameter(std::string const &) const
std::vector< uint32_t > min_nhits_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > chi2n_par_
std::vector< std::vector< double > > d0_par1_
std::vector< double > max_d0NoPV_
std::vector< double > max_z0_
std::vector< uint32_t > min_layers_
Cuts on numbers of layers with hits/3D hits/lost hits.
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::vector< double > max_z0NoPV_
std::vector< bool > useMVA_
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< bool > keepAllTracks_
#define DEFINE_FWK_MODULE(type)
std::vector< uint32_t > min_hits_bypass_
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
double minEta_
eta restrictions
std::vector< Track > TrackCollection
collection of Tracks
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< bool > applyAdaptedPVCuts_
bool innerOk() const
return true if the innermost hit is valid
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
std::vector< double > nSigmaZ_
std::vector< std::string > mvaType_
std::vector< unsigned int > preFilter_
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_
std::vector< uint32_t > min_3Dlayers_
const math::XYZPoint & innerPosition() const
position of the innermost hit
std::vector< uint32_t > max_lostLayers_
std::vector< int32_t > max_lostHitFraction_
edm::EDGetTokenT< reco::BeamSpot > beamspot_
std::vector< double > min_eta_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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.
std::vector< std::vector< double > > dz_par1_
std::vector< std::vector< double > > dz_par2_
std::vector< std::vector< double > > res_par_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
std::vector< double > max_relpterr_
RefProd< PROD > getRefBeforePut()
AnalyticalTrackSelector(const edm::ParameterSet &cfg)
constructor
void run(edm::Event &evt, const edm::EventSetup &es) const override
process one event
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
std::vector< int32_t > vtxNumber_
vertex cuts
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
edm::RefToBase< TrajectorySeed > seedRef() const
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
bool outerOk() const
return true if the outermost hit is valid
virtual ~AnalyticalTrackSelector()
destructor
std::vector< reco::TrackBase::TrackQuality > qualityToSet_
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTass_
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
std::vector< std::string > forestLabel_
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
std::vector< StringCutObjectSelector< reco::Vertex > > vertexCut_
const TrackResiduals & residuals() const
std::vector< bool > applyAbsCutsIfNoPV_
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< int32_t > max_minMissHitOutOrIn_
std::vector< double > min_MVA_
edm::EDGetTokenT< reco::TrackCollection > src_
source collection label
std::vector< std::vector< double > > d0_par2_
std::vector< double > max_d0_
Impact parameter absolute cuts.
std::vector< bool > useMVAonly_
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
tuple size
Write out results.
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
std::vector< double > max_eta_
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
std::vector< GBRForest * > forest_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.