Preheat the oven to 400 degrees F.
Set a medium oven-safe pot over moderate heat and add bacon. Cook until most of the fat is rendered out and the bacon is crisp. Prepare a plate with paper towels, and using a slotted spoon, remove the bacon from the pot to the plate. Set about a quarter of the bacon aside, for garnish.
Add the onions, garlic and ginger to the pot, and saute until soft and golden. Add the tomato paste and cook until the tomato paste deepens in color, about another minute.
Next add the root beer, cider vinegar, molasses, grainy mustard, red pepper flakes and garam masala. Stir to combine. Then add the beans and bacon, and gently stir so the beans don't lose their shape. Taste for salt and pepper, then pop into the oven, uncovered, until the mixture thickens, about 30 minutes. Remove the beans from the oven, let it cool slightly, and sprinkle with reserved bacon and serve.
Combine the cinnamon sticks, cloves, green cardamom seeds, black cardamom seeds, if using into a spice grinder or coffee grinder and grind until fine. Store the spice mix in an airtight container away from direct sunlight.
Recipe courtesy of Aarti Sequeira