My suggestion would be to pick up the first vertex that passes these cuts. The efficiency is close to 100% so I don't expect things to change a lot, but this would be the proper way to select vertices.
Note that the "goodVertices" filter already requires at least one vertex in the event passing this selection. So you should end up with at least one vertex.
I added the cuts you suggested - they didn't change anything in the sample I was testing, so I guess they should be fine. I also renamed the per-hit variables.
Hi Jeremi,
There is typically a loose quality selection applied while selecting "good" vertices. You can find it here:
http://cmslxr.fnal.gov/source/RecoMET/METFilters/python/metFilters_cff.py?v=CMSSW_9_4_2#0044
My suggestion would be to pick up the first vertex that passes these cuts. The efficiency is close to 100% so I don't expect things to change a lot, but this would be the proper way to select vertices.
Note that the "goodVertices" filter already requires at least one vertex in the event passing this selection. So you should end up with at least one vertex.