Seismic assessment of masonry structures through an energy-based approach