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...