Charm hadroproduction with an impact parameter trigger