What's happy about it? Halloween - or as it was originally known - SAMHAIN. Was the Celtic New Year Festival.
The trick-or-treat usage in the US and Canada id a perversion of the old Scottish tradition of "guising".
In that tradition, the bairns (that would be children to non-Scots) dressed up in what were (hopefully!) terrifying costumes and visited the surrounding homes. On gaining admission to a house, the weans would have to "Tell a tale, dae a dance or sing a sang at least". When evry child had performed, they were rewarded with sweets or fruit, then they moved on to the next house.
This, in itself, was a perversion of older rites when the young men of the area would wear clothing which hid their identities (from supernatural entities) and patrol the locality to ensure that the spirits, ghosts and ghouls were kept in the spirit world.