Iterative fit exiting from local minimum in PV reconstruction
While fixing the bugs in !1090 (merged), I noticed in some rare cases by forcing a minimum number of iterations the PV fit procedure exits the local minimum and diverges, such as for the following seed:
=======> Master
Now running on seed: 1 --> z: -50.078918
Nselected tracks is 54, dz 0.014905 ---> converged 0
Nselected tracks is 54, dz 0.000055 ---> converged 1 (and exits since the check on the minFitIter is not applied)
Saving vertex with z -50.064068, nselected tracks is 54 and beamlinerho2 0.000432
=======> Forcing min 3 iterations
Seed: 1 --> z: -50.078918 x: 0.000000 y: 0.000000
vtxpos_z is now -50.078918, x 0.000000, y 0.000000
Nselected tracks is 54, dz 0.014905 ---> converged 0
vtxpos_z is now -50.064014, x -0.009262, y 0.006104
Nselected tracks is 54, dz 0.000055 ---> converged 1 (doesn't exit since iter<3)
vtxpos_z is now -50.064068, x -0.017332, y 0.011482 ?????!
Nselected tracks is 53, dz 0.050203 ---> converged 0
vtxpos_z is now -50.114269, x -0.023742, y 0.017361
Nselected tracks is 53, dz 0.233359 ---> converged 0
vtxpos_z is now -50.347630, x -0.028076, y 0.026142
Nselected tracks is 53, dz 0.647925 ---> converged 0
vtxpos_z is now -50.995556, x -0.032510, y 0.039464
Nselected tracks is 55, dz 0.733452 ---> converged 0
vtxpos_z is now -51.729008, x -0.036937, y 0.052853
Nselected tracks is 58, dz 0.602432 ---> converged 0
Saving vertex with z -52.331440, nselected tracks is 58 and beamlinerho2 0.005697 ---> quite different from the seed!
Cases like this seem very rare (not changing the overall reco performance), but could mask some problem in the iterative fit procedure