add event cleaning and move ntuple reader out of analysis code