  The software alignment of planar tracking detectors using samples of charged
particle trajectories may lead to global detector distortions that affect
vertex and momentum resolution. We present an alignment procedure that
constrains such distortions by making use of samples of decay vertices
reconstructed from two or more trajectories and putting constraints on their
invariant mass. We illustrate the method by using a sample of invariant-mass
constrained vertices from D^0 --> K^- pi^+ decays to remove a curvature bias in
the LHCb spectrometer.
