Quantifying coherent and incoherent cathodoluminescence in semiconductors and metals