The high energy astrophysics, specifically the gamma-ray astrophysics, studies the processes that cannot be caused by hot matter but by other mechanisms colled non thermaland processes, which involve matter with energies above ~ 1 MeV. There are currently a number of instruments able to detect this radiation, such as AGILE and Fermi satellites or Cherenkov telescopes like MAGIC at the Earth's surface. In this thesis we studied two main types of systems that, as it has been observed or theoretically predicted, can produce gamma radiation : young stellar objects and high-mass X-ray binaries. Young stellar objects are found in regions of star formation, which are the cradles where new stars are being formed. The star-forming regions a...