Here is some advice from the JaguarForum.com, where more tips and fixes are available.
My 2013 XJ developed a vibration, the vehicle went into the dealer and after a couple of visits they decided the problem was the roof and that the vibration was travelling down the pillars.
They decided the fixed glass panel in the panoramic roof was the cause of the problem. Subsequently the panel was cut out – only then was the real problem identified – roof corrosion. The car was then sent to Stourbridge plant in order to ‘treat’ the corrosion. A couple of days later they informed me that the corrosion is so extensive it cannot be treated and therefore the whole roof pod has got to be replaced. So, an 18-month-old has had a whole new roof pod replaced due to excessive corrosion.