48 std::pair<std::unique_ptr<PFCandToVertexAssMap>, std::unique_ptr<VertexToPFCandAssMap>>
55 vector<VertexRef> vtxColl_help;
58 for(
unsigned i=0;
i<pfCandH->size();
i++ ) {
66 TrackRef PFCtrackref = candref->trackRef();
68 if ( PFCtrackref.
isNull() ){
75 pfcand2vertex->insert( vtxColl_help.at(0), make_pair(candref, quality) );
76 vertex2pfcand->insert( candref, make_pair(vtxColl_help.at(0),
quality) );
87 transtrk.
setES(iSetup);
92 int step = assocVtx.second;
98 pfcand2vertex->insert( assocVtx.first, make_pair(candref, quality) );
99 vertex2pfcand->insert( candref, make_pair(assocVtx.first, quality) );
117 std::unique_ptr<PFCandToVertexAssMap>
127 std::unique_ptr<VertexToPFCandAssMap>
137 std::unique_ptr<PFCandToVertexAssMap>
158 for(
unsigned int pfccoll_ite=0; pfccoll_ite<pfccoll.size(); pfccoll_ite++){
160 pfcandref = pfccoll[pfccoll_ite].first;
161 int quality = pfccoll[pfccoll_ite].second;
163 if ( (quality<=2) && (quality!=-1) )
continue;
165 double man_pT = pfcandref->pt();
166 if(man_pT>0.) ptsum+=man_pT*man_pT;
170 vertexptsumvector.push_back(make_pair(assomap_vertexref,ptsum));
174 while (!vertexptsumvector.empty()){
177 float highestpT = 0.;
178 int highestpT_index = 0;
180 for(
unsigned int vtxptsumvec_ite=0; vtxptsumvec_ite<vertexptsumvector.size(); vtxptsumvec_ite++){
182 if(vertexptsumvector[vtxptsumvec_ite].
second>highestpT){
184 vertexref_highestpT = vertexptsumvector[vtxptsumvec_ite].first;
185 highestpT = vertexptsumvector[vtxptsumvec_ite].second;
186 highestpT_index = vtxptsumvec_ite;
200 if(assomap_vertexref==vertexref_highestpT)
201 for(
unsigned int pfccoll_ite=0; pfccoll_ite<pfccoll.size(); pfccoll_ite++)
202 pfcvertexassOutput->insert(assomap_vertexref,pfccoll[pfccoll_ite]);
206 vertexptsumvector.erase(vertexptsumvector.begin()+highestpT_index);
210 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
edm::AssociationMap< edm::OneToManyWithQuality< reco::PFCandidateCollection, reco::VertexCollection, int > > VertexToPFCandAssMap
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.
edm::AssociationMap< edm::OneToManyWithQuality< reco::VertexCollection, reco::PFCandidateCollection, int > > PFCandToVertexAssMap
std::pair< reco::VertexRef, int > VertexStepPair
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)
std::vector< VertexPtsumPair > VertexPtsumVector
virtual void GetInputCollections(edm::Event &, const edm::EventSetup &)
std::vector< PFCandQualityPair > PFCandQualityPairVector
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 >)
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 &)