1. Hearing
If you know how the part is supposed to sound (either because you've heard it before, or because you can read music sufficiently well to hear the melody in your head), then you can obviously notice when the sound you play does not match. It can be a problem if you are playing in a very loud ensemble and can't really hear yourself (think 3rd trumpet in a big band's fff).
This helps you tell if you are hitting right or not, but you realize that you played wrong only after having already started to play the tone. Bummer.
2. Feeling
After a lot of practice, your lips' muscle memory just knows the right feeling for a given tone and loudness. Unfortunately this changes with instrument and mouthpiece. And possibly in what shape you are that day.
3. Cheating
If you are in a gig situation and are afraid to miss that high Ab start tone, it helps to sing it in your head before. But how do you know the pitch? You can play a low Ab softly, but that's not very discrete and does not sound professional at all. What you can do instead is blowing air through your trumpet (no sound) then suddenly throw your tongue to the bottom of the mouthpiece. Depending on which valves are pressed, you can hear the lowest tone with that fingering (that is low C down to low F#). Try to do this tongue trick while fingering C to F# up and down, and you will understand what I mean.
I would say you need both hearing and feeling. If you are practicing and still do not know if you played the correct notes or not, I'd consider:
- listening to recordings of the part,
- play one octave down to learn the melody,
- playing with a tuner,
- playing the part on another instrument where you know that you get the tones right.