The giants outside Dana Smith’s office in Shaver Lake, Calif., are spindly like the neck of a brachiosaurus, so tall that he has to throw back his head to see all the way to the top. They are 10 majestic ponderosa pines that grew 200 feet over about 250 years, a regal presence that lured Smith to the spot where he runs a business renting vacation cottages a few miles south of Yosemite National Park.

The trees are also dead, marked with bright spray paint by state contractors, destined for a date with a chain saw. They are victims of a massacre, a five-year drought — the longest and worst in state history — that has wiped out 102 million trees in the Sierra Nevada Mountains.

But this ecological tragedy has a silver lining. California is in the middle of a $50 million effort to get rid of tens of thousands of dead trees that threaten roads, power lines and homes. Loggers from across the country are flocking to the state in search of a huge payday from tree-removal companies under contract with the state and a few private firms.

“They’re coming from Iowa, Texas, Florida and Pennsylvania,” Smith said. “They tend to be young, people in really good shape — climbing trees, using chain saws six or seven days a week. It’s been rather fascinating. It’s been quite an experience.”

For this new gold rush, workers need a place to lay their heads, and for a few months last year, they filled Smith’s rental properties, studios to eight-bedroom luxury cottages that rent for $75 to $800 per night.