Add live histogram generation code to detector