Since a lot of people are upvoting this (and some downvoting of course), it's worth noting that it's not directly answering the OP's stated interests of dinosaurs etc. However, I think it's probably a more useful answer in general for people interested in horned animals.
Not intended to be the only answer on this question!
This doesn't fit neatly into your dinosaur vs mammal dichotomy, given the obvious differences in ecology and biomechanics, but I would suggest looking at horned beetles to think more about the effectiveness of horn weapons in different contexts. In some cases both configurations you describe (among others) are present in the same species and vary widely in the same genus.
One review paper here suggests that behavioral variation can account for the presence/absence of horns across species:
Thus, tunneling likely set the stage for the evolution of one-on-one fighting in tunneling taxa, such as Onthophagus, and the evolution of weaponry, such as horns, that is useful in one-on-one combat and in the blocking of narrow tunnels to prevent other males from accessing the female.6,26 Consistent with this scenario, horn possession is widespread and elaborate in tunneling scarabs, where it appears to have evolved independently several times, yet is virtually absent in any other group of non-tunneling scarabaeine beetles.31
One paper cited in that review presents phylogenetic comparative evidence for this view, in the following figure:
These suggest that the horn morph in question (triceratops-style) is useful in intraspecific sexual competition in a physically constrained context yielding single opponents (tunnels). This is somewhat similar to familiar examples in large mammals that do "single combat" mating competition. Direct confirmatory tests of this hypothesis were performed in separate work. There is some evidence in related beetles that this is particularly in response to an environmental stimulus of high beetle population density, and thus intensified sexual competition.
Thus, intraspecific sexual competition appears to be responsible for horn emergence in most cases. One classic study looked for ecological correlates of evolution of various horn configurations in a phylogenetic context, though the results seem ambiguous to me due to the quite small number of taxa. Nonetheless, the study highlighted a possible tradeoff between head horn presence and flying, and the presence of horns on the head in some ecological contexts. So, elaborate or large horns specialize the organism for fighting rather than for other activities.
One likely hypothesis is that mating competition is severe enough to drive an evolutionary arms race, leading to horn innovations that might yield advantages. Agent-based modeling approaches support this general theory, but no one seems to have directly tested this hypothesis with real beetles.