  We geometrically describe optimal control problems in terms of Morse families
in the Hamiltonian framework. These geometric structures allow us to recover
the classical first order necessary conditions for optimality and the starting
point to run an integrability algorithm. Moreover the integrability algorithm
is adapted to optimal control problems in such a way that the trajectories
originated by discontinuous controls are also obtained. From the Hamiltonian
viewpoint we obtain the equations of motion for optimal control problems in the
Lagrangian formalism by means of a proper Lagrangian submanifold. Singular
optimal control problems and overdetermined ones are also studied along the
paper.
