Layoffs are difficult experiences for those involved.
On an individual level, anyone affected will start asking the question:" Why me?!"
Each individual knows it's own efforts, extra hours they invested in a project, overall performance and everything they have done for the specified amount of time they worked for a company.
A company, when faced with difficulties such as a decrease in profit, changes, and the necessity to cut on budget, they will not take aside each individual analyzing everything they had achieved.
Companies are business. If they need to shut off entire buildings, or projects, they will look at it on a high scale and that might involve anyone that happens to be part of that budget cut.
My point is, jobs are not personal relationships! Are business!
I am not saying a situation like this is a walk in the park, nor that you should be immune to this.
If you get passed the mentality that this has nothing to do with you doing something wrong or not being good enough, and you understand that is part of a system that happens on regular basis everywhere(ex. Some companies getting entirely out of business) ,maybe will give you a sense of reality and more power to focus on your next steps without blaming yourself.