function in = InCylinder(rn,radius,BoxLength1, BoxLength2)
%function in = InCylinder(rn,radius,BoxLength1, BoxLength2)
%Check if coordinate is inside cylinder.
if ((rn(1)^2+rn(2)^2)>radius^2| rn(3)<BoxLength1)
   in= 0;
elseif rn(3)>BoxLength2
   in= 0;
else
   in = 1;
end
