17 if ( pfCandidate.
charge() != 0 ) {
20 pfCandToVertexAssociation != pfCandToVertexAssociations.
end(); ++pfCandToVertexAssociation ) {
21 typedef std::vector<std::pair<reco::PFCandidateRef, int> > PFCandidateQualityPairVector;
22 const PFCandidateQualityPairVector& pfCandidates_vertex = pfCandToVertexAssociation->val;
23 for ( PFCandidateQualityPairVector::const_iterator pfCandidate_vertex = pfCandidates_vertex.begin();
24 pfCandidate_vertex != pfCandidates_vertex.end(); ++pfCandidate_vertex ) {
25 int pfCandToVertexAssocQuality = pfCandidate_vertex->second;
28 for ( reco::VertexCollection::const_iterator vertex = vertices.begin();
29 vertex != vertices.end(); ++vertex ) {
30 if (
std::abs(pfCandToVertexAssociation->key->position().z() - vertex->position().z()) < dZ ) {
39 return vtxAssociationType;
47 pfCandToVertexAssociation != pfCandToVertexAssociations.
end(); ++pfCandToVertexAssociation ) {
49 typedef std::vector<std::pair<reco::PFCandidateRef, int> > PFCandidateQualityPairVector;
50 const PFCandidateQualityPairVector& pfCandidates_vertex = pfCandToVertexAssociation->val;
51 for ( PFCandidateQualityPairVector::const_iterator pfCandidate_vertex = pfCandidates_vertex.begin();
52 pfCandidate_vertex != pfCandidates_vertex.end(); ++pfCandidate_vertex ) {
53 pfCandToVertexAssociations_reversed.
insert(pfCandidate_vertex->first, std::make_pair(vertex, pfCandidate_vertex->second));
57 return pfCandToVertexAssociations_reversed;
63 int& numWarnings,
int maxWarnings)
65 int vtxAssociationType = 0;
70 if ( pfCandidate->charge() != 0 ) {
71 vtxAssociationType = 1;
72 typedef std::vector<std::pair<reco::VertexRef, int> > VertexQualityPairVector;
73 const VertexQualityPairVector* pfCandidate_associated_vertices =
nullptr;
75 if ( pfCandToVertexAssociation_iter != pfCandToVertexAssociations.
end() ) {
76 pfCandidate_associated_vertices = &pfCandToVertexAssociation_iter->
val;
79 pfCandToVertexAssociation != pfCandToVertexAssociations.
end(); ++pfCandToVertexAssociation ) {
80 if (
deltaR2(pfCandidate->p4(), pfCandToVertexAssociation->
key->p4()) <
dR2Min ) {
81 pfCandidate_associated_vertices = &pfCandToVertexAssociation->val;
85 if ( numWarnings < maxWarnings ) {
87 <<
" The productIDs of PFCandidate and PFCandToVertexAssociationMap passed as function arguments don't match.\n"
88 <<
"NOTE: The return value will be unaffected, but the code will run MUCH slower !!";
92 if ( pfCandidate_associated_vertices ) {
93 for ( VertexQualityPairVector::const_iterator pfCandidate_associated_vertex = pfCandidate_associated_vertices->begin();
94 pfCandidate_associated_vertex != pfCandidate_associated_vertices->end(); ++pfCandidate_associated_vertex ) {
97 for ( reco::VertexCollection::const_iterator vertex = vertices.begin();
98 vertex != vertices.end(); ++vertex ) {
99 if (
std::abs(pfCandidate_associated_vertex->first->position().z() - vertex->position().z()) < dZ ) {
108 return vtxAssociationType;
const_iterator end() const
last iterator over the map (read only)
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< Vertex > VertexCollection
collection of Vertex objects
key_type key() const
Accessor for product key.
virtual int charge() const
electric charge
Abs< T >::type abs(const T &t)
double deltaR2(const T1 &t1, const T2 &t2)
void insert(const key_type &k, const data_type &v)
insert an association
Particle reconstructed by the particle flow algorithm.
const_iterator begin() const
first iterator over the map (read only)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector