I'm an anaesthetist, but also spend a lot of time in ICU and attend emergencies in ED. I think the most important part of my being able to cope with tragic events is knowing that everyone will die one day. It sounds trite, but for so many people outside the profession with no experience of death, the thought of it is terrifying and the idea that it might happen to their loved one is incomprehensible. I also have a fairly good knowledge of what we can do and what we can't do, to help people who are critically ill - again, this helps me be realistic, whereas to many people "there must be SOMETHING you can do." If there is something we can do, then I will get it done, and my focus is on achieving that; if there isn't, then I will try to ensure the patient has the best death possible in the circumstances.
For many emergencies there are well-publicised, straightforward algorithms, for precisely the reasons described here - it is a stressful situation and you need something obvious and memorable to stick to when there's chaos all around. I often think of Kipling's lines "If you can keep your head when all around you are losing theirs and blaming it on you..." It's important to remember that this isn't my gran/husband/child, this is my patient, and that is how I should be caring for them. I'm not hardened or desensitised, but I am more accustomed to it than the patients and relatives facing this awful situation for the first time.
There are still some cases which are more awful than others, and we do debrief amongst the team afterwards. I am more upset by paediatrics cases now that I am a mother, but even before then they were harder than almost anything else.