Merge request1231into root6branch

This is a snapshot of pull request 1231, but intended for the ROOT 6 branch instead of the main 7_0_X branch.
This will fix the compilation error in RecoVertex/BeamSpotProducer.  It may be a long wait until pull request 1231 is pulled into a main release.  I tried picking out just the minimal change for the compilation error, but that was not straightforward.