How to detect if a raycast ray stop hitting an object

Hi, I need a way to understand in c# when a ray stop hitting an object.

RaycastHit boostHit;
		Vector3 bottom = transform.TransformDirection (Vector3.down);
		
		bool prevFinishLane = finishLane;
		
		if (Physics.Raycast (transform.position, bottom, out boostHit)) {
			
			if (boostHit.collider.tag == "Start") {
				finishLane = true;
			} else {
				finishLane = false;
			}
			
			if (boostHit.collider.tag == "Boost") {

				GetComponent<AudioSource>().PlayOneShot (boostSound);
				GameManager.Instance.SetCheckedBoost (GameManager.Instance.GetCheckedBoost () + 1);
				Debug.Log ("Boosts: " + GameManager.Instance.GetCheckedBoost ());

				if (boostTimer == 0.0F) {
					boost = true;
					maxSpeed = GameManager.Instance.GetBoost ();
					accel = 20.0F;
				}
			}

//			if (boostHit.collider.tag == "Brackes") {
//
//				prevSpeed = speed;
//
//				GetComponent<AudioSource>().PlayOneShot (brackesSound);
//				if (decelTimer == 0.0F) {
//					brakeDecel = true;
//					decel = 40.0F;
//				}
//			}
		}
		else {
			finishLane = false;
		}

That’s why in this way the boost collider returns a lot of fires. I need that the event returns only one impulse per passage. (Boost). So I thought to detect when tha ray leaves the object instead of when the ray hits the object…
But I can’t code that…

Thanks Guys!!
It works great!

Here it is the complete solution:

public bool boost;
public boot gotBoost;
public float boostTimer;

// Other Speed, Audio and Accel Vars

void Start () {

	boost = false;
	gotBoost = false;
	boostTimer = 0.0F;

	// Other Speed add ACcel Assignment
}

void FixedUpdate () {

	RaycastHit boostHit;
	Vector3 bottom = transform.TransformDirection (Vector3.down);

	if (Physics.Raycast (transform.position, bottom, out boostHit)) {

		if (boostHit.collider.tag == "Boost")
		{
			if(!gotBoost)
			{
				gotBoost = true;     
				GetComponent<AudioSource>().PlayOneShot (boostSound);
				GameManager.Instance.SetCheckedBoost (GameManager.Instance.GetCheckedBoost () + 1); // Update from the GameManager the count of the taken boosts
				Debug.Log ("Boosts: " + GameManager.Instance.GetCheckedBoost ()); // Print in console the taken boosts
					
				if (boostTimer == 0.0F) 
				{
						boost = true;
						maxSpeed = GameManager.Instance.GetBoost (); // Get from the GameManager the current ship’s max speed
						accel = 20.0F;
				}
			}
			else {
				gotBoost = false;
			}

		}
	}

	if (boost)
	{
		boostTimer += Time.deltaTime;
		if(boostTimer >= 5.0f)
		{
			boost = false;
			boostTimer = 0.0F;
				
			maxSpeed = defaultMaxSpeed;
			accel = defaultAccel;
			decel = defaultDecel;
		}
	}
}

See ya soon!