RIO DE JANEIRO — The chef de mission of the Canadian Olympic team believes there was a Pan Am effect at work.

The 2015 Pan American Games in Toronto just over a year ago provided not just a boost in bricks and mortar, according to Curt Harnett.

He says the host team's 217 medals, which put Canada second behind the United States in Toronto, was a psychological slingshot for the athletes into Rio.

Canada's Olympic team is bringing home 22 medals — four gold, three silver and 15 bronze — to equal the most medals won at a non-boycotted Summer Games first set at the 1996 Atlanta Olympics.

Harnett was Canada's chef de mission in Toronto and a late replacement for Jean-Luc Brassard in Rio. The former track cyclist felt there was a Pan Am carryover for Canada.

"Canadians rained down pride on our athletes," Harnett said. "It had them stand a little taller and a little more confident.

"They learned that day that Canada had their back. I believe that the momentum . . . carried them on the road to Rio and here on the ground."

The expectations and stresses of competing in front of a home crowd in Toronto was the right dress rehearsal for Rio, says Own The Podium chief executive officer Anne Merklinger

"What happened in Toronto is that many of the top athletes, the medal-potential athletes heading into Rio competed in Toronto," Merklinger said. "They experienced winning in a pressure-packed environment and they performed on demand in what was an important multi-sport Games."

Canada's swimmers won 27 Pan Am medals, including eight gold. A year later in Rio, they won six medals, including one gold, and made 15 finals.

A thread ran between those two performances, according to high-performance director John Atkinson.

"That's where I think we first saw the change in the belief on the team that we can race with anybody," he said.

Penny Oleksiak didn't compete in the Pan Ams as a 15-year-old, but the swimming pool built for those Games made a world of difference in her four-medal performance in Rio.

Canada's flag-bearer said swimming and training at the Pan Am High Performance Centre in Toronto with women who did compete at the Pan Ams made not just her faster, but the relays faster.

Oleksiak, Chantal Van Landeghem, Sandrine Mainville and Michelle Williams all train there. They won a relay bronze on opening day in Rio to kick off Canada's medal haul.

"Training alongside those girls every single day made us all a lot faster," Oleksiak said. "It's a really good pool to train in and it's a really, really nice facility.

"It has the weight room and everything. It has everything you could possibly need for training. I love training there and I hope to be training there for the next few years and hopefully get better."

While track cyclists produced one bronze in women's team pursuit in Rio, the velodrome in Milton, Ont., is expected to generate more hardware four years from now in Tokyo.

"Certainly looking forward to filling that facility with more young people and get them out there with a dream down the road that an Olympic gold medallist came as a result of that facility," Harnett said.