The loudest event statistic: general formulation, properties and applications