The LHCb detector is a single-arm forward spectrometer designed for the efficient reconstruction decays of $c$- and $b$-hadrons. For Run II (2015-2018) LHCb has introduced a novel real-time detector alignment and calibration strategy. Data collected at the start of the fill are processed in a few minutes and used to update the alignment, while the calibration
constants are evaluated for each run. The available timing budget allows the events to be processed using the best performing reconstruction in the trigger, which fully includes particle identification selection criteria. This approach greatly increases the efficiency, in particular for the selection of charm and strange hadron decays.