23 useClosestVertex_(
cfg.getParameter<
bool>(
"useClosestVertexToDilepton")),
24 vertexIndex_(
cfg.getParameter<unsigned
int>(
"vertexIndex")) {}
37 std::vector<reco::TransientTrack> tks;
38 for (
const auto&
track : leptonTracks) {
40 tks.push_back(trajectory);
46 aTransVtx = kalman.
vertex(tks);
54 int closestVtxIndex = 0;
64 if ((*vertices).at(closestVtxIndex).isValid()) {
65 return &(
vertices->at(closestVtxIndex));
76 std::vector<unsigned int> thePVkeys;
99 if (tv->isNonnull()) {
101 thePVkeys.push_back(trackRef.
key());
107 std::sort(thePVkeys.begin(), thePVkeys.end());
109 LogDebug(
"AlignmentTrackFromVertexSelector")
110 <<
"after collecting the PV keys: thePVkeys.size()" << thePVkeys.size() << std::endl;
111 for (
const auto&
key : thePVkeys) {
112 LogDebug(
"AlignmentTrackFromVertexSelector") <<
key <<
", ";
114 LogDebug(
"AlignmentTrackFromVertexSelector") << std::endl;
119 for (reco::TrackCollection::const_iterator tk = tc->begin(); tk != tc->end(); ++tk, ++indx) {
121 if (
std::find(thePVkeys.begin(), thePVkeys.end(), trackRef.
key()) != thePVkeys.end()) {
122 LogDebug(
"AlignmentTrackFromVertexSelector") <<
"track index: " << indx <<
"filling result vector" << std::endl;
std::vector< const reco::Track * > Tracks
edm::EDGetTokenT< reco::TrackCollection > diLeptonToken_
AlignmentTrackFromVertexSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
constructor
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbESToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
const reco::Vertex * findClosestVertex(const reco::TrackCollection &leptonTracks, const reco::VertexCollection *vertices, const edm::EventSetup &setup) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< Vertex > VertexCollection
trackRef_iterator tracks_end() const
last iterator over tracks
key_type key() const
Accessor for product key.
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
reco::TransientTrack build(const reco::Track *p) const
unsigned int vertexIndex_
trackRef_iterator tracks_begin() const
first iterator over tracks
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Tracks select(const edm::Handle< reco::TrackCollection > &tc, const edm::Event &evt, const edm::EventSetup &setup) const
select tracks
static std::atomic< unsigned int > counter
~AlignmentTrackFromVertexSelector()
destructor