@@ -290,7 +290,6 @@ void AllTracksterToSimTracksterAssociatorsByLCsProducer::produce(edm::StreamID,
290290 unsigned int layerClusterId = layerClustersIds[i];
291291 const auto & layerCluster = layerClusters[layerClusterId];
292292 float simFraction = 1 .f / simTrackster.vertex_multiplicity (i);
293- float squaredSimFraction = simFraction * simFraction;
294293 float squaredLayerClusterEnergy = layerCluster.energy () * layerCluster.energy ();
295294 float simSharedEnergy = layerCluster.energy () * simFraction;
296295 float invLayerClusterEnergy = 1 .f / layerCluster.energy ();
@@ -300,10 +299,18 @@ void AllTracksterToSimTracksterAssociatorsByLCsProducer::produce(edm::StreamID,
300299 float recoSharedEnergy = recoTracksterElement.sharedEnergy ();
301300 edm::Ref<std::vector<ticl::Trackster>> recoTracksterRef (recoTrackstersHandle, recoTracksterIndex);
302301 float sharedEnergy = std::min (recoSharedEnergy, simSharedEnergy);
303- float recoFraction = recoSharedEnergy * invLayerClusterEnergy;
304- float score = invDenominator *
305- std::min (squaredSimFraction, (simFraction - recoFraction) * (simFraction - recoFraction)) *
306- squaredLayerClusterEnergy;
302+ float recoFraction =
303+ recoSharedEnergy *
304+ invLayerClusterEnergy; // Either zero or one when no sharing of rechits between tracksters
305+ /* SimToReco score logic:
306+ - simFraction = 0 && recoFraction >= 0 : trackster contains non-sim associated elements : ignore in simToReco
307+ - simFraction > 0 && recoFraction == 0 : simhits not present in reco trackster : penalty in score by simFraction*E
308+ - simFraction == 1 && recoFraction == 1 : good association
309+ - 1 > simFraction > recoFraction > 0 : we are missing some sim energy, penalty in score by the missing part : (simFraction-recoFraction)*E
310+ - 1 > recoFraction > simFraction > 0 : consider as good association, as there is enough reco to cover the sim
311+ */
312+ float simMinusRecoFraction = std::max (0 .f , simFraction - recoFraction);
313+ float score = invDenominator * simMinusRecoFraction * simMinusRecoFraction * squaredLayerClusterEnergy;
307314 simTracksterToTracksterMap->insert (tracksterIndex, recoTracksterIndex, sharedEnergy, score);
308315 }
309316 }
0 commit comments