The way I see it is this: the doctrine of double effect requires that the good effect must outweigh the bad effect. So in choosing whether or not to divert the tram, we must choose in such a way that of the two effects that our choice will have, the good one will outweigh the bad one. If we choose to do nothing, 5 people die and 1 is spared. If we choose to flip the switch, 1 person dies and 5 are spared.
Our decision should only be limited to making sure the good effect outweighs the bad effect. It is not our job to punish criminals for their misdeeds - that is the rightful function of the State and of God. In addition, the State may only punish a criminal for his crimes with a just trial, so if we choose to punish him ourselves, it would be an affront to justice. And also, it is not our job to presume on the state of a person’s soul, whether they’re likely to go to heaven or not at a particular point in time - that judgement belongs to God alone.
Furthermore, we Catholics do not relativise the value of life. That is to say, we don’t say that the value of an embryo’s life is 0.1, that of a foetus is 0.3, that of a criminal is 0.5, that of a woman is 0.8, that of a man is 1.0, that of an accountant is 1.2, that of a priest is 1.5, that of a cardinal is 2.0 etc. Each one is in possession of one life and a singular right to it, equivalent to 1.0.
So, if I understand correctly, it will always be better to save five lives than to save one life, regardless of who these lives may belong to. Once we do that, our job is done. We’ve done our bit. The rest, including the meting out of justice, is up to God and the State. Not us.
Where the choice is between one of two lives, then the result will always be the same. A life is a life is a life is a life. One life saved, one life lost. You have to use other means to decide in which option the good effect outweighs the bad. So, if one of the men has a family and the other doesn’t, the good effect would be greater if you chose to save the man with the family because he will continue to be able to support them. The value of the lives of the two men are exactly equivalent, but the good effect of choosing to save the one with family is greater because you not only save one life but also prevent hardship to the man’s family. Lastly, you sin gravely if you allow malice to enter your decision-making. You must intend the good effect - the saving of the life of the one person, and must not intend the bad effect - the death of the other.