The pitch here is the angle theta made by the rafter with the horizontal.

tan(theta) = rise / run = o/a

So, theta = pitch = arctan(o/a)

Example, if rise = 2 meters, and run = 12 meters,

pitch = arctan(2/12) = arctan(0.1666667) = 9.46 degrees.

----------------

If only the depth ,(I assume you mean the total length of the rafter starting from its intersection with the run), and the run are known, then

cos(theta) = run / depth = a/d

Then, pitch = arccos(a/d).