Getting 1D histos from 2D histo

I’ve found the answer to my question in this post: