Preheat the oven to 200ºC/400ºF/gas 6. Put the tomatoes on a large baking tray, and season with sea salt and black pepper. Scatter over the unpeeled garlic cloves, thyme sprigs and bay leaves, then transfer to the oven and roast for 25 minutes, or until the tomato skins are burnished and split.
Let the tomatoes cool for a minute or two, then pull them off the vines and place in a frying pan with a splash of red wine vinegar and a pinch more salt and pepper.
Squeeze the garlic into the pan, discarding the skins. Squash with a spoon and simmer for 15 minutes, or until you have a thick, strawberry-red sauce with an almost creamy consistency. Remove and discard the thyme sprigs and bay.
Meanwhile, cook the rigatoni in a pan of boiling salted water according to the packet instructions. Drain, reserving a mugful of starchy cooking water.
Toss the pasta into the sauce, loosening with a little reserved cooking water, if needed.
Drizzle over a good lug of extra virgin olive oil, finely grate over the ricotta and pick over the basil leaves (if using).