For lycopene, yes: cooked with oil is best.
Lycopene is the red pigment in tomatoes and an antioxidant that researchers have studied for heart and prostate health. In raw tomatoes, much of it is locked inside the plant's cell walls. Cooking breaks those walls down and changes the lycopene into forms the body absorbs more easily. Studies have found that tomato sauce and paste deliver more absorbable lycopene than the same amount of fresh tomato.
Lycopene dissolves in fat, so adding olive oil helps even more. A classic marinara is, by this measure, a smart way to eat tomatoes.
Raw tomatoes win in other ways. They keep more vitamin C, which breaks down with heat, and they're full of water and fiber.
The practical answer is to eat both. Enjoy fresh tomatoes in salads in summer, and cooked sauces, soups and roasted tomatoes the rest of the year.