Homework exercise: a ball hits a rigid bar I need a hand with the following exercise:

A rigid bar of mass $M$ and length $L$ is hanging vertically from it's upper side, from which it can rotate freely.
A particle of mass $m$ hits the bar will velocity $v$, at a distance $d$ of the upper side of the bar.
After the impact, the bar raises till it makes an angle $\theta$ with the $y$-axis.
Find the distance $d$, if momentum, $\vec p$ is conserved.

From the conservation of momentum, I get that $mv = (m+M)v'$, where $v'$ is the velocity just after the impact. Also, (I believed that angular momentum is conserved, but I'm not 100% sure) from conservation of angular momentum, we get that 
$$
L_\text{initial}=dmv=dmv'+\frac l 2Mv' + \frac {Ml^2}{12} \omega'=L_\text{final}
$$
Where $\frac {M\,l^2}{12}=I_\text{cm}$ is the moment of inertia of the rod (is the final angular momentum set up correctly?). 
From here I don't know what to do, or even if my work so far is correct...
Could someone help me out? Thanks.
E: Assume the ball doesn't stick to the bar after the impact.
 A: Okay what you are going to want to do is to use conservation of angular momentum and then energy.
First,
Li = dmv = Lf = Itotal ωinitial
What's the total moment of inertia?  Just the I of the rod (I'm assuming the projectile doesn't stick).  You can then easily solve for ωinitial.
So from there, you can now just use conservation of energy. 
KEi + Ui = KEf + Uf
In this case you only start with KE, which is just
I ωi2/2.
You end with only gravitational potential, and no KE.  Because you know the rod is uniform, you can treat it like all of its mass is at its center of mass, or just L/2.  If the rod moves through an angle of θ, then the change in the height of the center of mass is going to be L/2(1-cos(θ)). You can easily see this is true by drawing a diagram.  Therefore, if we assume Gravitational potential to be zero initaily, then the Uf = Mg(L/2(1-cos(θ)).  Also, when the rod reaches this point, then KE must equal zero.  You should be able to backtrack through these equations to solve for d.
