can you give more explanation in Rtabmap.cpp in Bayes filter update when you select the highest hypothesis, you search for the highest hypothesis by you move in reverse order on posterior array
and save the highest in lc-id in hypothesis.first and the highest properties in hypothesis.second.
but after the for loop
// With the virtual place, use sum of LC probabilities (1 - virtual place hypothesis).
hypothesis.second = 1-posterior.begin()->second;
The first hypothesis is the "no loop closure hypothesis" with id "-1". It is the probability that the current location is a new location. The value "1-posterior.begin()->second" is then the probability of a loop closure (or the sum of all loop closure hypotheses).
In another words like in the related paper (section III-D): "When p(St|Lt) has been updated and normalized, the highest loop closure hypothesis St = i of p(St|Lt) is accepted if the new location hypothesis p(St = −1|Lt) is lower than the loop closure threshold Tloop (set between 0 and 1)." In the code, it is implemented as if the "sum of loop closure hypotheses is over Tloop", we select the highest loop closure hypothesis.
So yes the "hypothesis.second = iter->second;" is not used. Looks like it comes from an old test where only the value of the highest hypothesis was used used to compare with Tloop...