Slice each tomato into 8 wedges and discard the seeds. Put the tomato wedges and garlic into a 9 by 13-inch roasting pan. Drizzle with 1 tablespoon of olive oil and sprinkle with salt and a few turns of pepper. Roast in the oven, uncovered, for 40 minutes.
Drain the beans into a large colander in the sink. Cook the pasta according to the directions on the package. Drain the pasta into the colander containing the beans, so the hot pasta water will warm the beans. Return drained pasta and beans to the pasta pot.
When the tomatoes are done, pick out the garlic cloves, squeeze the garlic out of the skin into a small bowl and mash with a fork. Pour the roasted tomatoes into the pasta pot, add the garlic, the remaining 1 tablespoon of olive oil, the basil and additional salt and pepper, to taste. Toss to combine. Serve topped with the Parmesan.