Methods for precise photoelectron counting with photomultipliers