How do you turn object to face a particular vector ?

I am trying to solve a train orientation problem

it's on a track I want it to run parallel with track and turn it's forward direction accordingly.

I have posted images on the forum can anybody help

I have had help with the vectors (used ray cast to get hit.normal with rail) then used dot product (hit.normal ,up vector) to get parallel vector the issue is orientating train to this direction vector

To point an object towards a particular vector, use Transform.LookAt, like this:

transform.LookAt( targetDirectionVector );