score:2
Latvia and Denmark are both in the Schengen area, so no matter which passport you have, Riga is where it will be checked. After you pass though the Schengen outer border in Riga, immigration authorities won't care whether you go into the city or take a connecting intra-Schengen flight (or both).
For a flight connection on a single ticket, on a single airline, through that airline's own main hub, you can definitely expect that your baggage will be checked through. You should be getting boarding passes for both legs of the flight when you check in at St. Petersburg, too. So when you return from the city to the airport you can proceed directly to the security check.
If you need to customs declare your checked baggage, that will happen in Copenhagen.