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;
56 for (
const auto& vtx : *vertices) {
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;
123 result.push_back(&(*tk));
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_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
std::vector< Track > TrackCollection
collection of Tracks
reco::TransientTrack build(const reco::Track *p) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
key_type key() const
Accessor for product key.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< Vertex > VertexCollection
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
bool getData(T &iHolder) const
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
tuple key
prepare the HTCondor submission files and eventually submit them
unsigned int vertexIndex_
trackRef_iterator tracks_end() const
last iterator over tracks
bool get(ProductID const &oid, Handle< PROD > &result) const
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
const reco::Vertex * findClosestVertex(const reco::TrackCollection &leptonTracks, const reco::VertexCollection *vertices, const edm::EventSetup &setup) const
T const * product() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
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