Halloween from Thanksgiving?

Factual Q: My wife is reading “A Tree Grows in Brooklyn” (set in the early 1900s) in which it describes kids in costume collecting free, broken candies from stores and returning to eat the Thanksgiving feast. (a) Is this factual, and (b) might this have been the precursor to Halloween? (Maybe today’s Halloween stems from the beauty of advertising?) - Jinx

According to Wikipedia: