43 std::pair<std::unique_ptr<PFCandToVertexAssMap>, std::unique_ptr<VertexToPFCandAssMap>>
51 vector<VertexRef> vtxColl_help;
55 for (
unsigned i = 0;
i < pfCandH->size();
i++) {
63 TrackRef PFCtrackref = candref->trackRef();
65 if (PFCtrackref.
isNull()) {
70 pfcand2vertex->insert(vtxColl_help.at(0), make_pair(candref,
quality));
71 vertex2pfcand->insert(candref, make_pair(vtxColl_help.at(0),
quality));
86 int step = assocVtx.second;
92 pfcand2vertex->insert(assocVtx.first, make_pair(candref,
quality));
93 vertex2pfcand->insert(candref, make_pair(assocVtx.first,
quality));
139 assomap_ite != pfcvertexassInput->
end();
149 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++) {
150 pfcandref = pfccoll[pfccoll_ite].first;
151 int quality = pfccoll[pfccoll_ite].second;
156 double man_pT = pfcandref->pt();
158 ptsum += man_pT * man_pT;
161 vertexptsumvector.push_back(make_pair(assomap_vertexref, ptsum));
164 while (!vertexptsumvector.empty()) {
166 float highestpT = 0.;
167 int highestpT_index = 0;
169 for (
unsigned int vtxptsumvec_ite = 0; vtxptsumvec_ite < vertexptsumvector.size(); vtxptsumvec_ite++) {
170 if (vertexptsumvector[vtxptsumvec_ite].
second > highestpT) {
171 vertexref_highestpT = vertexptsumvector[vtxptsumvec_ite].first;
172 highestpT = vertexptsumvector[vtxptsumvec_ite].second;
173 highestpT_index = vtxptsumvec_ite;
179 assomap_ite != pfcvertexassInput->
end();
186 if (assomap_vertexref == vertexref_highestpT)
187 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++)
188 pfcvertexassOutput->insert(assomap_vertexref, pfccoll[pfccoll_ite]);
191 vertexptsumvector.erase(vertexptsumvector.begin() + highestpT_index);
194 return pfcvertexassOutput;
T getParameter(std::string const &) const
void GetInputCollections(edm::Event &, const edm::EventSetup &) override
int input_MaxNumAssociations_
void setBeamSpot(const reco::BeamSpot &beamSpot)
int DefineQuality(int, int, double)
std::pair< reco::VertexRef, PFCandQualityPair > VertexPfcQuality
VertexStepPair FindAssociation(const reco::TrackRef &, const std::vector< reco::VertexRef > &, edm::ESHandle< MagneticField >, edm::ESHandle< GlobalTrackingGeometry >, edm::Handle< reco::BeamSpot >, int)
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > token_TrackingGeometry_
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::ESHandle< GlobalTrackingGeometry > trackingGeometryH
std::pair< reco::VertexRef, int > VertexStepPair
key_type key() const
Accessor for product key.
std::vector< VertexPtsumPair > VertexPtsumVector
const_iterator end() const
last iterator over the map (read only)
U second(std::pair< T, U > const &p)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_bField_
virtual void GetInputCollections(edm::Event &, const edm::EventSetup &)
edm::AssociationMap< edm::OneToManyWithQuality< reco::VertexCollection, reco::PFCandidateCollection, int > > PFCandToVertexAssMap
edm::AssociationMap< edm::OneToManyWithQuality< reco::PFCandidateCollection, reco::VertexCollection, int > > VertexToPFCandAssMap
bool isNull() const
Checks for null.
edm::Handle< reco::BeamSpot > beamspotH
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
std::vector< reco::VertexRef > CreateVertexVector(edm::Handle< reco::VertexCollection >)
std::vector< PFCandQualityPair > PFCandQualityPairVector
std::unique_ptr< PFCandToVertexAssMap > CreatePFCandToVertexMap(edm::Handle< reco::PFCandidateCollection >)
edm::ESHandle< MagneticField > bFieldH
std::unique_ptr< VertexToPFCandAssMap > CreateVertexToPFCandMap(edm::Handle< reco::PFCandidateCollection >)
void EraseVertex(std::vector< reco::VertexRef > &, reco::VertexRef)
const_iterator begin() const
first iterator over the map (read only)
void setTrackingGeometry(const edm::ESHandle< GlobalTrackingGeometry > &tg)
edm::EDGetTokenT< reco::VertexCollection > token_VertexCollection_
edm::Handle< reco::VertexCollection > vtxcollH
PFCand_AssoMapAlgos(const edm::ParameterSet &, edm::ConsumesCollector &&)
std::unique_ptr< PFCandToVertexAssMap > SortPFCandAssociationMap(PFCandToVertexAssMap *, edm::EDProductGetter const *getter)
edm::EDGetTokenT< reco::BeamSpot > token_BeamSpot_
std::pair< std::unique_ptr< PFCandToVertexAssMap >, std::unique_ptr< VertexToPFCandAssMap > > createMappings(edm::Handle< reco::PFCandidateCollection > pfCandH)