The purpose of this work was to investigate by Monte Carlo method the adjustment of photon beams delivered by the medical LINear ACcelerator (LINAC) Elekta Synergy MLCi2. This study presents an optimization of the Gaussian distribution parameters of the accelerated electrons before the target simulated by two Monte Carlo codes and for three beams. The photon (X-ray) beam is produced by the interaction of accelerated electrons with the LINAC target. The electrons are accelerated by a potential difference created between the anode and the cathode of the gun and directed towards the target. In the Monte Carlo simulation, it is necessary to setup the spectrum parameters of the generated electrons to simulate the X-ray dose distribution. In this study, we modeled the LINAC geometry for photon beams 18MV and 6MV in cases Flattened (FF) and Flattening-Filter-Free (FFF). The Monte Carlo simulations are based on G4Linac_MT and GATE codes. The results of the optimized configurations determined after more than 20 tests for each beam energy show a very good agreement with the experimental measurements for different irradiation fields for the depth (PDD) and lateral (Profile) dose distribution. In all Monte Carlo calculations performed in this study, the statistical uncertainty is less than 2%. The results were also in very good agreement in terms of γ-index analysis, for the 3%/3mm and 2%/2mm criteria.