Changing some loops in clusterparamsalgnew to loop as
for (auto & hit : hitlist)
instead of
for (auto hit : hitlist)
since looping by reference avoids copying the hit at each loop.