President Obama will give his back-to-school speech at Philadelphia's prestigious Masterman School on Tuesday.

Superintendent Arlene Ackerman got a call Thursday telling her that the public magnet school, which educates 1,200 fifth through 12th graders from around the city, would host the president.

"This is really exciting," Ackerman said. "We're thrilled and honored."

The superintendent said she didn't know why the White House had chosen Philadelphia, but she had a theory.

"We made some pretty fantastic gains this year," Ackerman said of the district's state test scores. "We've had eight straight years of gains."

For the first time, more than half the district's students are performing at grade level in reading and math and more than half the 265 city schools met state standards.

Ackerman said she also believed Philadelphia had been chosen because of her Renaissance schools initiative.

This month, 13 failing schools were reconstituted - either as charters or district-run schools with longer school days and years and more supports. Obama has called for 5,000 struggling schools around the country to be closed.

The city's schools are no stranger to dignitaries.

Last year, Michelle Obama, Treasury Secretary Timothy F. Geithner, and Agriculture Secretary Tom Vilsack visited the Fairhill School in North Philadelphia to promote healthy eating. Education Secretary Arne Duncan visited Mastery Charter School-Shoemaker in West Philadelphia and McDaniel Elementary in South Philadelphia.

And when Obama gave his first back-to-school speech last year, Health and Human Services Secretary Kathleen Sebelius watched the telecast with students at Thurgood Marshall School in Olney.

When last year's education pep talk was announced, critics said they feared the president would press a partisan agenda. Some parents and schools in the region opted not to allow their students to hear Obama's remarks.

Masterman, at 17th and Spring Garden Streets, is consistently Pennsylvania's top performer in 11th-grade math and reading scores. It's also typically ranked in U.S. News and World Report's top 100 high schools.

The school opened in 1958 and is named for Julia Reynolds Masterman, who helped establish the first Home and School Council in Philadelphia and was its first president.

Spots in the school are highly coveted; some parents go so far as to ask politicians to write letters of support for their children to win admission. Students must have high PSSA scores, excellent grades, and good behavior to enroll in Masterman.

The children of many of the city's movers and shakers attend the school. Mayor Nutter's daughter, Olivia, is a 10th grader there.

Actors Kevin Bacon and Will Smith attended the school, as did concert violinist Leila Josefowicz.

Obama's speech will be streamed live on the White House's website. The event is invitation-only.

Contact staff writer Kristen Graham at 215-854-5146 or kgraham@phillynews.com.