fixed a whole bunch of stuff, tied reference event selection to histogram building - still some bug in hist.generation