Galactic stellar populations are good tracers of the history of the Milky Way. Their study via Gaia astrometric and photometric data should allow to pinpoint the star formation history (SFH) in the disc and halo in a self-consistent dynamical model. Population synthesis models are efficient tools to measure the SFH from the distribution of the stars in the Hess diagram, thanks to different locations of stars according to their age and metallicity. We present the iterative strategy planned to fit the IMF and the SFH of the thin disk using the BGMFast scheme (del Alcazar et al., see poster) based on approximate bayesian computation (ABC) performed with HPC tools and, at the same time, the attempt to keep the self-consistent dynamical model by fitting the gravitational potential of the Milky Way to the stellar kinematics and densities from Gaia data (Robin et al., 2022)