Reactive magnetron sputtering of TiN: Analysis of the deposition process