A new approach to obtain a spread-out Bragg peak (SOBP) using the MINUIT fit is presented. The SOBP has been adopted in proton therapy in order to irradiate a proton beam equally over the tumor along the beam direction. In principle, an SOBP can be easily obtained by using several Bragg peaks from different beam energies, since the position of the peak varies with the energy. However, this is not practical in real medical situations, because the beam energy is fixed by the accelerator. Thus, a modulation method has been employed to obtain an SOBP, where the position of Bragg peak is controlled by a modulator with varying thickness. In this study, we use the GEANT4 package to simulate a generic proton therapy apparatus. A modulator with thickness control is assumed in the proton therapy setup and a set of Bragg peaks is obtained from the GEANT4 simulation. Assuming that the position and the size of the tumor are known, we first determine which Bragg peaks should be used in the fit. Then a MINUIT fit is applied to calculate the weights of each Bragg peak in order to maximize the flatness of the SOBP while minimizing the dose in the normal tissue area, thus maximizing the dose in the tumor. The fit has turned out to be very robust and converges quickly. Since the MINUIT is a small size library and the proposed SOBP fit shows stable behavior, this method can be readily applied to the real therapy.