Compiled macro for pileup calculation