added histogram and S/N calculation