Sometimes i cant get a hard on

Patient: Good day i am 24 yrs old and i have had about three times now problem getting hard right before sex, and at times i get hard but it will go away. the first time it was two days back to back this was sometime in july or august….the other time was the 9th of this month, after my partner and i had a romantic evening and wanted some intimate time.Im afraid and embarassed because i am a young man and i dont want to lose my relationship for something i cannot explain or do not understand.. i usually have a very good sex drive. the last time i went to the doctor to check out the problem i was Rx BECOMPLEX Capsules. i do smoke marajuana and at time a tobacco type cigerrette called “beedie” i have just recently started jogging. are these signs that i am becoming impotent i dont understand what is happening and desperatley need some help or answers