I have some close family friends in the Cody area. Whenever they see someone with 'bear bells' on their person or pack, they call them "dinner bells"...because that is about all they are good for. The family friends make their living going into the mountains (guiding, etc) and insist all of their clients carry bear spray. The intent is that the client can stall the bear until they get there with the shotgun. They know what they are doing, have been doing it for over 30 years, are very cautious, and have had their fair share of bear encounters. Most end with them shouting and the bear sauntering off. But...they have their handy dandy Mossberg when they are shouting. They also have 'bear dogs' in camp that will wake them up if anything 'bearish' comes within smelling distance.
The people I know who have had direct encounters with bear insist on carrying a firearm. 12ga pump with 00buck/slug is great. Round #1 and #2 are 00 buck for a deterrent. #3 and #4 are slugs because, at that point, the sting isn't stopping it and so it is time to end the encounter. A 9mm will bounce off the front of the skull. Most factory 9mm loads are too soft and will mushroom on the thickened skull. A traditional self defense round is meant for a softer target. It will inadequately penetrate the hide and will definitely not go through the skull, sternum, or shoulder of a bear thus you will not impact any vitals. They are the 4-legged tanks of North America. Either bump up in caliber and/or use the hardest bullet you can find. A month ago, I spent a week in the Washakie wilderness (active Grizzly country). I wanted to carry a .45 mag with hardened lead bullets (lead/antimonium alloy). They were very 'hot' hand loads and the intent was to punch a hole through the skull, out the back, and possibly down the length of the body (assuming a frontal charge). I did not care about mushrooming...I just wanted to get past the hide and bone. But, I left it at home and wished I had it on several occasions (didn't see anything...just got a funny feeling a few times).
Taking a firearm is your decision. Are you more concerned about having the responsibility of a firearm in a federal park or the possibility of a bear attacking you or someone in your family. At minimum, I would give each member of your family a can of bear spray and make sure they know how to use it. A whistle is a good idea, too. Recent news articles are proof of the activity and agitation of the bear population within Yellowstone. Statistically, Yellowstone averages one bear encounter with injury per year (source unknown...I just remember it). This year is highly atypical with two deaths and neither victim was not doing anything stupid. Personally, I would read up on the laws governing firearms use in the park and carry accordingly. If you discharge within the park, you will be put under a microscope. As long as you were following park rules (read up on them) and have proof that you were actively being charged then you will likely be fine (i.e. don't tie bologna to your pack and run through the woods, keep food in approved containers, burn everything to knock down the smell, douse any juice/pop spill with plenty of water, keep no food...not even toothpaste, flowery deodorant, or gum...in your tent, etc). Remember...a bear can out-sprint a horse and climb trees. On a charge, they go through small trees, not around them. If something goes down, I would rather be alive and scrutinized.
Also be aware, that the other (uninformed) tourists in the park will likely get freaked if they see a firearm on anyone other than a park ranger. You will not need it in populated areas like Old Faithful...but you might want to consider discretion as a distant second criteria to stopping power. My solution was a .45, hardened lead bullet, and a shoulder holster. If something like this had not been readily available to me, I would have carried a 12ga.
The take-away: be logical, responsible, and don't let fear ruin the great times with your family in God's country.
I hope this helps.