Well the Samhain connection was the pseudo-religious connection.. but apparently it goes back even further as some type of end-of-the-harvest festival. depending on who you listen to, the candy/gifts and costumes were supposed to fend off bad spirits or confuse them so they couldn't get you..."Hey beelzebub, weren't you supposed to be posessing some guy named Jim Smith right now?"..."Yeah, but when I went over, all I saw was a pirate chasing around a scantily-clad nurse and Catwoman. No Jim Smith.. he's an accountant, but all I saw was a pirate.. Ah well, I'll just skip him and move on down the list.." - makes all the sense in the world.
And sadly, the visit by the "ghost busters" next door was social...