Optimally depth-resolved photospheric inversions using the iterative OLA method and tool for optimal spectral line selection