As a melee fighter, heavy cavalry would have depended on armor to block melee weapons once they got in range, and that alone would justify its use.
As far as effectiveness against firearms the best I've ever found is that quality armor of the time was somewhat effective against small arms and muskets at range, though muskets could easily penetrate at close range.
While I haven't been able to find exact distances, I would expect this also gave Heavy Cavalry a range where musket fire was ineffective and they would be able to close before infantry could reload.
Rifles of the period had longer range and took longer to reload, which would indicate they were more effective against armor though it may have been a wash due to longer reload times, but I can't conform that.
Rifles and rifle companies were also far less common at the time so the decision to wear armor was likely based more on fighting musket armed soldiers as that was the more common opponent.
history.stackexchange.com/users/1573/Ryathal
Just to add a note about cannons: fragmentation is a very common source of injury --
be it wood splinters, bone, rocks, or shrapnel from the shell --
link, graphic images of wounds .
This could have impacted the desire to wear armour.
However, wikipedia and Body Armor:
Cuirass and Helmet seem to indicate that fragmentation/shrapnel was not a factor at all in wearing armour.
history.stackexchange.com/users/103/Sardathrion - against SE abuse
Without getting too involved in a discussion of terminal ballistics, the Napoleonic period armour certainly offered some protection against firearms, but it was only effective up to a point.
This picture shows a a French cavalry cuirass (a breastplate worn as body armour) from Waterloo on display in the Musée de l’Armée: A cannonball from a British 9lb cannon can do a lot of damage!
Further down the scale, a simple musket-ball could also kill an armoured cavalryman at that time.
This is the cuirass of Lieutenant Colonel Achambault: Looking at the state of his cuirass, you probably won't be surprised to learn that he was killed while leading the 9th Cuirassiers during the Franco-Prussian War in 1870.
Now, I've also seen plenty of cases where Napoleonic period armour shows dents from musket balls that didn't penetrate.
In those cases it most definitely saved lives and prevented serious injury.
The guy in this cuirass probably survived this shot: Without the armour, he would certainly have had a much worse day.
history.stackexchange.com/users/24858/sempaiscuba
If this link works, see picture of a Napoleonic era Cuirass (armed cavalryman's breast plate)
with what appear a hole in it made by a cannon ball, apparently on entry and exit: Cuirass hit by cannon ball I doubt the cuirassier wearing it survived.
As for muskets, I have certainly read of how at the battle of Waterloo, when French heavy cavalry, with armoured breast plates like the cuirass above and metal helmets, confronted British infantry, men noticed a distinctive rattling sound of musket balls bouncing off the metal armour, suggesting that it did protect against small arms fire.
However, as far as I know, unlike in the Middle Ages men, were never armoured head to foot nor did horses have armour.
My guess, only, is that armour in this period was particularly although not exclusively for protection against the swords and lances of enemy cavalry.
The latter, attacking from roughly the same height, and keeping their guard up against counter-blows, would most often land blows on the upper part of the cavalryman's body, hence armour being mainly on chest, back and head.
The arms were presumably less protected because they needed to be freer to hold the reins and wield a sword.
history.stackexchange.com/users/19392/Timothy
The early Napoleonic cuirassier cuirasses were intended to withstand three musket shots at close range.
This was never achieved in practice.
Later the official standard was for the cuirass to withstand one musket shot at long range.
Elting, J.R. Swords Around a Throne (1988) p. 230.
The cuirass was effective at stopping long range musket balls, but not those received at shorter ranges.
In the evening after the Battle of Quatre Bras, Colonel Frederick Ponsonby, commander of the British 12th Light Dragoons, examined the corpses of French cuirassiers and was gratified in finding many with musket ball holes in their cuirasses, one with no less than three.
Haythornthwaite, P.J. Napoleonic Cavalry (2001), London, p. 59.
history.stackexchange.com/users/28240/Martin Read
Yes, it did help.
Even now, soldiers use helms and vests.
Only helm, as it was found during the WWI, decreases the number of KIA in troops.
(But increases the number of wounded) http://www.geom.uiuc.edu/~lori/mathed/problems/sloanA307.html M-1 helmet worn in World War II had saved 76,000 American infantrymen from serious injury or death ( https://atwar.blogs.nytimes.com/2009/10/08/a-heads-up-about-helmets/ )
Of course, more armour brought more safety.
But it was expensive, so, used only for more expensive troops, such as heavy cavalry, engineers, grenadiers in some countries.
history.stackexchange.com/users/566/Gangnus
During the Napoleonic wars in Europe, many heavy cavalry units still retain the use of armours, for example, French Carabiniers-à-Cheval below,   How effective were these to protect the cavalryman against enemy fire, like muskets or rifles? Did they effectively reduce the casualties from gunfire, or were they just used to protect against non-firearms attack like swords? Or were they just used for ceremonial/prestige reasons?
Was the Napoleonic era cavalry armour effective against firearms?
history.stackexchange.com
<military><europe><cavalry><napoleonic-wars>
history.stackexchange.com/questions/7270
history.stackexchange.com/users/414/Fitri
Napoleonic army certainly gave some protection. There are examples of armour showing dents where the musket balls didn't penetrate. The cuirass was effective at withstanding long range musket balls. It is generally agreed that Napoleonic era amour did provide some protection against musket or rifle fire, but mainly at long range rather than short range.
It is generally agreed that Napoleonic period armour did provide some protection from musket and rifle fire. The armour used during Napoleon's time was likely effective against long range shots but not so much against short range fire.