Really, it's not the Castle Doctrine legality that is of concern here.
Nobody thinks, I hope, that the young man was some form of burglar, or actually engaged in a sexual assault against the young lady. The father's best defense is that he can say that he did not know what was going on, and it seems that the court is going to have to believe him, unless the prosecutor can provide some evidence to the contrary. Naturally, if (for example) they find out that the father knew the young man before (not currently in evidence), or that he had good reason to know the sex acts were consensual (imagine the young lady saying something Yes, Harry, I love you, DO ME, DO ME NOW!!).
The problem for me with this thread is that a lot of posters seem to think it's a good idea to attack young men whom you find in your daughter's bedroom even if you know they're not out to rape her.
In my view, if you see a person having sex with your 17-year-old daughter, then the proper response is to close the door and get out, unless you have indication that the act is violent. Though the law may permit it it in your locality, it doesn't seem moral to me to use lethal force just because you think 'this looks suspicious' (and generally when two people are having sex, it's rather obvious if it is a rape).
If you actually know that the person is not a rapist and is just your daughter's classmate doing what young men in that age, and still go after the young man with a steel pipe, then that's just deranged.