  Using fully relativistic GEANT4 simulation tool kit, the transport of
energetic electrons generated in solar flares was Monte-Carlo simulated, and
resultant bremsstrahlung gamma-ray spectra were calculated. The solar
atmosphere was approximated by 10 vertically-stacked zones. The simulation took
into account two important physical processes,that the bremsstrahlung photons
emitted by precipitating relativistic electrons are strongly forward beamed
toward the photosphere, and that the majority of these gamma-rays must be
Compton back-scattered by the solar atmosphere in order to reach the observer.
Then, the Compton degradation was found to make the observable gamma-ray
spectra much softer than is predicted by simple analytic calculations. The
gamma-ray signals were found to be enhanced by several conditions, including a
broad pitch-angle distribution of the electrons, a near-limb flare longitude,
and a significant tilt in the magnetic field lines if the flare longitude is
rather small. These results successfully explain several important flare
properties observed in the hard X-ray to gamma-ray range, including in
particular those obtained with Yohkoh. A comparison of the Yohkoh spectrum from
a GOES X3.7 class limb flare on 1998 November 22, with a simulation assuming a
broad electron pitch-angle distribution, suggests that gamma-rays from this
particular solar flare were a mixture of direct bremsstrahlung photons and
their Comptonization.
