Yes, they can both be used for that meaning. The both indicate that, based on evidence, something is clearly true.
However, I would say in my experience that there is a difference in nuance, and they are not always interchangeable as there are other meanings that don't overlap, even when talking about the past. So, nuance first.
It must have rained last night, the road is all wet.
This is completely natural. Must will tend (though not always) to be used in inferences like this where it's highly conclusive. As such, for this example, it fits very well. Had to have is, to me, less strong, and fits better in situations that invite confirmation. For example, if one were to witness a friend having a horse-riding lesson where they were over-mounted and the horse charged off with them, you might say:
That had to be a wild ride!
Now, this is not to say it is unnatural or wrong to say must in the latter case, or had to in the former case. It's a difference of nuance only, and might be used the other way around to express more uncertainty or confidence, or just because someone prefers the sound of one word over another. It's also possible that that nuance is highly dependent on dialect. Looks like can also be used to express less certainty, and I'm pretty sure that's more dialect-independent:
(It) looks like it rained last night, the road is all wet.
And you'll even get people combine that with the others!
Looks like that had to be a wild ride!
Looks like it must have rained last night.
But when expressing obligation in the past, rather than inference, there's a difference that means you can't always mix up must and have to. For events in the past, must is rarely used to express obligation; have to is used. However, that would not use the perfect:
She had to hand in her dissertation this morning, so she's probably on her way home.
That's a statement about an obligation in the past.
She must have handed in her dissertation this morning.
That is most likely a statement of inference, as is:
She has to have handed in her dissertation this morning.
However, that one is less likely, to my mind.
The bottom line on this digression is that you want to be very clear whether you're talking about obligation or inference before switching which modal you use.