File indexing completed on 2024-04-06 12:01:09
0001 #ifndef CommonTools_RecoAlgos_TrackWithVertexSelector_H
0002 #define CommonTools_RecoAlgos_TrackWithVertexSelector_H
0003
0004
0005
0006
0007
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/Utilities/interface/InputTag.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/ConsumesCollector.h"
0012 #include "DataFormats/Common/interface/ValueMap.h"
0013 #include "DataFormats/TrackReco/interface/Track.h"
0014 #include "DataFormats/VertexReco/interface/Vertex.h"
0015 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0016
0017 class TrackWithVertexSelector {
0018 public:
0019 explicit TrackWithVertexSelector(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
0020 : TrackWithVertexSelector(iConfig, iC) {}
0021 explicit TrackWithVertexSelector(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC);
0022 ~TrackWithVertexSelector();
0023
0024 void init(const edm::Event &event, const edm::EventSetup &) { init(event); }
0025 void init(const edm::Event &event);
0026
0027 bool operator()(const reco::Track &t) const;
0028 bool operator()(const reco::Track &t, const edm::Event &iEvent) {
0029 init(iEvent);
0030 return (*this)(t);
0031 }
0032
0033 bool operator()(const reco::TrackRef &t) const;
0034 bool operator()(const reco::TrackRef &t, const edm::Event &iEvent) {
0035 init(iEvent);
0036 return (*this)(t);
0037 }
0038 bool testTrack(const reco::Track &t) const;
0039 bool testVertices(const reco::Track &t, const reco::VertexCollection &vtxs) const;
0040
0041 bool testTrack(const reco::TrackRef &t) const;
0042 bool testVertices(const reco::TrackRef &t, const reco::VertexCollection &vtxs) const;
0043
0044 private:
0045 uint32_t numberOfValidHits_;
0046 uint32_t numberOfValidPixelHits_;
0047 uint32_t numberOfLostHits_;
0048 double normalizedChi2_;
0049 double ptMin_, ptMax_, etaMin_, etaMax_;
0050 double dzMax_, d0Max_;
0051 double ptErrorCut_;
0052 std::string quality_;
0053
0054 uint32_t nVertices_;
0055 edm::EDGetTokenT<reco::VertexCollection> vertexToken_;
0056 edm::EDGetTokenT<edm::ValueMap<float> > timesToken_, timeResosToken_;
0057 bool vtxFallback_;
0058 double zetaVtx_, rhoVtx_, nSigmaDtVertex_;
0059
0060 reco::VertexCollection const *vcoll_ = nullptr;
0061 edm::ValueMap<float> const *timescoll_ = nullptr;
0062 edm::ValueMap<float> const *timeresoscoll_ = nullptr;
0063 typedef math::XYZPoint Point;
0064 };
0065
0066 #endif