The transient phase of a ductile beam under impact loading. Some issues about rigid-plastic analysis and first extension to masonry structures