A Bayesian on–off analysis of cosmic ray data