  Riemannian geometry is a particular case of Hamiltonian mechanics: the orbits
of the hamiltonian $H=\frac{1}{2}g^{ij}p_{i}p_{j}$ are the geodesics. Given a
symplectic manifold (\Gamma,\omega), a hamiltonian $H:\Gamma\to\mathbb{R}$ and
a Lagrangian sub-manifold $M\subset\Gamma$ we find a generalization of the
notion of curvature. The particular case
$H=\frac{1}{2}g^{ij}\left[p_{i}-A_{i}\right]\left[p_{j}-A_{j}\right]+\phi $ of
a particle moving in a gravitational, electromagnetic and scalar fields is
studied in more detail. The integral of the generalized Ricci tensor w.r.t. the
Boltzmann weight reduces to the action principle
$\int\left[R+\frac{1}{4}F_{ik}F_{jl}g^{kl}g^{ij}-g^{ij}\partial_{i}\phi\partial_{j}\phi\right]e^{-\phi}\sqrt{g}d^{n}q$
for the scalar, vector and tensor fields.
