Split purity calculation into HF and pt bins. Also allow external compilation.