42 std::pair<std::unique_ptr<PFCandToVertexAssMap>, std::unique_ptr<VertexToPFCandAssMap>>
50 vector<VertexRef> vtxColl_help;
54 for (
unsigned i = 0;
i < pfCandH->size();
i++) {
62 TrackRef PFCtrackref = candref->trackRef();
64 if (PFCtrackref.
isNull()) {
69 pfcand2vertex->insert(vtxColl_help.at(0), make_pair(candref, quality));
70 vertex2pfcand->insert(candref, make_pair(vtxColl_help.at(0),
quality));
73 if (input_MaxNumAssociations_ > 1)
80 transtrk.
setES(iSetup);
84 int step = assocVtx.second;
90 pfcand2vertex->insert(assocVtx.first, make_pair(candref, quality));
91 vertex2pfcand->insert(candref, make_pair(assocVtx.first, quality));
94 if (input_MaxNumAssociations_ > 2)
137 assomap_ite != pfcvertexassInput->
end();
147 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++) {
148 pfcandref = pfccoll[pfccoll_ite].first;
149 int quality = pfccoll[pfccoll_ite].second;
151 if ((quality <= 2) && (quality != -1))
154 double man_pT = pfcandref->pt();
156 ptsum += man_pT * man_pT;
159 vertexptsumvector.push_back(make_pair(assomap_vertexref, ptsum));
162 while (!vertexptsumvector.empty()) {
164 float highestpT = 0.;
165 int highestpT_index = 0;
167 for (
unsigned int vtxptsumvec_ite = 0; vtxptsumvec_ite < vertexptsumvector.size(); vtxptsumvec_ite++) {
168 if (vertexptsumvector[vtxptsumvec_ite].
second > highestpT) {
169 vertexref_highestpT = vertexptsumvector[vtxptsumvec_ite].first;
170 highestpT = vertexptsumvector[vtxptsumvec_ite].second;
171 highestpT_index = vtxptsumvec_ite;
177 assomap_ite != pfcvertexassInput->
end();
184 if (assomap_vertexref == vertexref_highestpT)
185 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++)
186 pfcvertexassOutput->insert(assomap_vertexref, pfccoll[pfccoll_ite]);
189 vertexptsumvector.erase(vertexptsumvector.begin() + highestpT_index);
192 return pfcvertexassOutput;
T getParameter(std::string const &) const
void GetInputCollections(edm::Event &, const edm::EventSetup &) override
int input_MaxNumAssociations_
const_iterator end() const
last iterator over the map (read only)
void setBeamSpot(const reco::BeamSpot &beamSpot)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int DefineQuality(int, int, double)
std::unique_ptr< PFCandToVertexAssMap > CreatePFCandToVertexMap(edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
std::pair< reco::VertexRef, PFCandQualityPair > VertexPfcQuality
std::vector< Vertex > VertexCollection
collection of Vertex objects
key_type key() const
Accessor for product key.
std::pair< reco::VertexRef, int > VertexStepPair
std::vector< VertexPtsumPair > VertexPtsumVector
std::pair< std::unique_ptr< PFCandToVertexAssMap >, std::unique_ptr< VertexToPFCandAssMap > > createMappings(edm::Handle< reco::PFCandidateCollection > pfCandH, const edm::EventSetup &iSetup)
U second(std::pair< T, U > const &p)
VertexStepPair FindAssociation(const reco::TrackRef &, const std::vector< reco::VertexRef > &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, int)
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
edm::Handle< reco::BeamSpot > beamspotH
bool isNull() const
Checks for null.
void setES(const edm::EventSetup &es)
std::vector< reco::VertexRef > CreateVertexVector(edm::Handle< reco::VertexCollection >)
std::vector< PFCandQualityPair > PFCandQualityPairVector
edm::ESHandle< MagneticField > bFieldH
void EraseVertex(std::vector< reco::VertexRef > &, reco::VertexRef)
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)
const_iterator begin() const
first iterator over the map (read only)
edm::EDGetTokenT< reco::BeamSpot > token_BeamSpot_
std::unique_ptr< VertexToPFCandAssMap > CreateVertexToPFCandMap(edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)