22 double R2SMatchedSimRatio,
23 double R2SMatchedRecoRatio,
24 double S2RMatchedSimRatio,
25 double S2RMatchedRecoRatio,
31 R2SMatchedSimRatio_(R2SMatchedSimRatio),
32 R2SMatchedRecoRatio_(R2SMatchedRecoRatio),
33 S2RMatchedSimRatio_(S2RMatchedSimRatio),
34 S2RMatchedRecoRatio_(S2RMatchedRecoRatio),
37 trackRecoToSimAssociation_(trackRecoToSimAssociation),
38 trackSimToRecoAssociation_(trackSimToRecoAssociation) {}
48 std::map<TrackingVertexRef, std::pair<double, std::size_t>>
matches;
50 LogDebug(
"VertexAssociation") <<
"reco::VertexCollection size = " << recoVertexes->size()
51 <<
" ; TrackingVertexCollection size = " << trackingVertexes->size() << std::endl;
54 for (std::size_t recoIndex = 0; recoIndex < recoVertexes->size(); ++recoIndex) {
59 double recoDaughterWeight = 0.;
71 std::vector<std::pair<TrackingParticleRef, double>>
associations = (*trackRecoToSimAssociation_)[*recoDaughter];
82 matches[trackingVertex].second++;
86 recoDaughterWeight +=
recoVertex->trackWeight(*recoDaughter);
89 std::size_t assoIndex = 0;
97 double matchedDaughterWeight =
match->second.first;
98 std::size_t matchedDaughterCounter =
match->second.second;
101 std::size_t simDaughterCounter = 0;
104 simDaughter != trackingVertex->daughterTracks_end();
107 simDaughterCounter++;
110 if (simDaughterCounter < matchedDaughterCounter)
111 simDaughterCounter = matchedDaughterCounter;
117 double quality = (double)matchedDaughterWeight / recoDaughterWeight;
125 LogTrace(
"VertexAssociation") <<
"R2S: INDEX " << assoIndex <<
" ; SimDaughterCounter = " << simDaughterCounter
126 <<
" ; RecoDaughterWeight = " << recoDaughterWeight
127 <<
" ; MatchedDaughterCounter = " << matchedDaughterCounter
128 <<
" ; MatchedDaughterWeight = " << matchedDaughterWeight
135 LogTrace(
"VertexAssociation") <<
"\nRecoToSim OUTPUT COLLECTION: outputCollection.size() = "
136 << outputCollection.
size() << std::endl;
138 return outputCollection;
147 std::map<std::size_t, std::pair<double, std::size_t>>
matches;
150 for (std::size_t simIndex = 0; simIndex < trackingVertexes->size(); ++simIndex) {
155 std::size_t simDaughterCounter = 0;
159 simDaughter != trackingVertex->daughterTracks_end();
167 std::vector<std::pair<reco::TrackBaseRef, double>>
associations = (*trackSimToRecoAssociation_)[*simDaughter];
175 for (std::size_t recoIndex = 0; recoIndex < recoVertexes->size(); ++recoIndex) {
182 if (recoDaughter->id() == recoTrack.
id() && recoDaughter->key() == recoTrack.
key()) {
191 simDaughterCounter++;
194 std::size_t assoIndex = 0;
197 for (
std::map<std::size_t, std::pair<double, std::size_t>>::const_iterator
match =
matches.begin();
202 double matchedDaughterWeight =
match->second.first;
203 std::size_t matchedDaughterCounter =
match->second.second;
205 double recoDaughterWeight = 0.;
213 recoDaughterWeight +=
recoVertex->trackWeight(*recoDaughter);
216 if (recoDaughterWeight < matchedDaughterWeight)
217 recoDaughterWeight = matchedDaughterWeight;
223 double quality = (double)matchedDaughterCounter / simDaughterCounter;
231 LogTrace(
"VertexAssociation") <<
"R2S: INDEX " << assoIndex <<
" ; SimDaughterCounter = " << simDaughterCounter
232 <<
" ; RecoDaughterWeight = " << recoDaughterWeight
233 <<
" ; MatchedDaughterCounter = " << matchedDaughterCounter
234 <<
" ; MatchedDaughterWeight = " << matchedDaughterWeight
241 LogTrace(
"VertexAssociation") <<
"SimToReco OUTPUT COLLECTION: outputCollection.size() = " << outputCollection.
size()
244 return outputCollection;