@@ -189,6 +189,7 @@ struct EmcalCorrectionTask {
189189 int runNumber{0 };
190190
191191 static constexpr float TrackNotOnEMCal = -900 .f;
192+ static constexpr int kMaxMatchesPerCluster = 20 ; // Maximum number of tracks to match per cluster
192193
193194 void init (InitContext const &)
194195 {
@@ -462,7 +463,6 @@ struct EmcalCorrectionTask {
462463 mHistManager .fill (HIST (" hCollisionType" ), 1 );
463464 math_utils::Point3D<float > vertexPos = {col.posX (), col.posY (), col.posZ ()};
464465
465- std::vector<std::vector<int >> clusterToTrackIndexMap;
466466 MatchResult indexMapPair;
467467 std::vector<int64_t > trackGlobalIndex;
468468 doTrackMatching<CollEventSels::filtered_iterator>(col, tracks, indexMapPair, trackGlobalIndex);
@@ -599,12 +599,10 @@ struct EmcalCorrectionTask {
599599 mHistManager .fill (HIST (" hCollisionType" ), 1 );
600600 math_utils::Point3D<float > vertexPos = {col.posX (), col.posY (), col.posZ ()};
601601
602- std::vector<std::vector<int >> clusterToTrackIndexMap;
603602 MatchResult indexMapPair;
604603 std::vector<int64_t > trackGlobalIndex;
605604 doTrackMatching<CollEventSels::filtered_iterator>(col, tracks, indexMapPair, trackGlobalIndex);
606605
607- std::vector<std::vector<int >> clusterToSecondaryIndexMap;
608606 MatchResult indexMapPairSecondary;
609607 std::vector<int64_t > secondaryGlobalIndex;
610608 doSecondaryTrackMatching<CollEventSels::filtered_iterator>(col, v0legs, indexMapPairSecondary, secondaryGlobalIndex, tracks);
@@ -774,7 +772,6 @@ struct EmcalCorrectionTask {
774772 mHistManager .fill (HIST (" hCollisionType" ), 1 );
775773 math_utils::Point3D<float > vertexPos = {col.posX (), col.posY (), col.posZ ()};
776774
777- std::vector<std::vector<int >> clusterToTrackIndexMap;
778775 MatchResult indexMapPair;
779776 std::vector<int64_t > trackGlobalIndex;
780777 doTrackMatching<CollEventSels::filtered_iterator>(col, tracks, indexMapPair, trackGlobalIndex);
@@ -943,12 +940,10 @@ struct EmcalCorrectionTask {
943940 mHistManager .fill (HIST (" hCollisionType" ), 1 );
944941 math_utils::Point3D<float > vertexPos = {col.posX (), col.posY (), col.posZ ()};
945942
946- std::vector<std::vector<int >> clusterToTrackIndexMap;
947943 MatchResult indexMapPair;
948944 std::vector<int64_t > trackGlobalIndex;
949945 doTrackMatching<CollEventSels::filtered_iterator>(col, tracks, indexMapPair, trackGlobalIndex);
950946
951- std::vector<std::vector<int >> clusterToSecondaryIndexMap;
952947 MatchResult indexMapPairSecondary;
953948 std::vector<int64_t > secondaryGlobalIndex;
954949 doSecondaryTrackMatching<CollEventSels::filtered_iterator>(col, v0legs, indexMapPairSecondary, secondaryGlobalIndex, tracks);
@@ -1304,7 +1299,7 @@ struct EmcalCorrectionTask {
13041299 trackGlobalIndex.reserve (nTracksInCol);
13051300 fillTrackInfo<decltype (groupedTracks)>(groupedTracks, trackPhi, trackEta, trackGlobalIndex);
13061301
1307- indexMapPair = matchTracksToCluster (mClusterPhi , mClusterEta , trackPhi, trackEta, maxMatchingDistance, 20 );
1302+ indexMapPair = matchTracksToCluster (mClusterPhi , mClusterEta , trackPhi, trackEta, maxMatchingDistance, kMaxMatchesPerCluster );
13081303 }
13091304
13101305 template <typename Collision>
@@ -1321,8 +1316,10 @@ struct EmcalCorrectionTask {
13211316
13221317 float trackEtaEmcal = 0 .f ;
13231318 float trackPhiEmcal = 0 .f ;
1324- // fillTrackInfo<decltype(groupedTracks)>(groupedTracks, trackPhi, trackEta, trackGlobalIndex);
13251319 for (const auto & leg : groupedV0Legs) {
1320+ if (leg.trackId () < 0 || leg.trackId () > tracks.size ()) {
1321+ continue ;
1322+ }
13261323 auto track = tracks.iteratorAt (leg.trackId ());
13271324 trackEtaEmcal = track.trackEtaEmcal ();
13281325 trackPhiEmcal = track.trackPhiEmcal ();
@@ -1338,7 +1335,7 @@ struct EmcalCorrectionTask {
13381335 trackEta.emplace_back (trackEtaEmcal);
13391336 trackGlobalIndex.emplace_back (track.globalIndex ());
13401337 }
1341- indexMapPair = matchTracksToCluster (mClusterPhi , mClusterEta , trackPhi, trackEta, maxMatchingDistance, 20 );
1338+ indexMapPair = matchTracksToCluster (mClusterPhi , mClusterEta , trackPhi, trackEta, maxMatchingDistance, kMaxMatchesPerCluster );
13421339 }
13431340
13441341 template <typename Tracks>
0 commit comments