Although luminescence of water lower in energy than the Cerenkov-light threshold during proton and carbon-ion irradiation has been found, the phenomenon has not yet been implemented for Monte Carlo simulations. The results provided by the simulations lead to misunderstandings of the physical phenomenon in optical imaging of water during proton and carbon-ion irradiation. To solve the problems, as well as to clarify the light production of the luminescence of water, we modified a Monte Carlo simulation code to include the light production from the luminescence of water and compared them with the experimental results of luminescence imaging of water. We used GEANT4 for the simulation of emitted light from water during proton and carbon-ion irradiation. We used the light production from the luminescence of water using the scintillation process in GEANT4 while those of Cerenkov light from the secondary electrons and prompt gamma photons in water were also included in the simulation. The modified simulation results showed similar depth profiles to those of the measured data for both proton and carbon-ion. When the light production of 0.1 photons/MeV was used for the luminescence of water in the simulation, the simulated depth profiles showed the best match to those of the measured results for both the proton and carbon-ion compared with those used for smaller and larger numbers of photons/MeV. We could successively obtain the simulated depth profiles that were basically the same as the experimental data by using GEANT4 when we assumed the light production by the luminescence of water. Our results confirmed that the inclusion of the luminescence of water in Monte Carlo simulation is indispensable to calculate the precise light distribution in water during irradiation of proton and carbon-ion.