Since Halloween is my favorite Holiday I've read a lot about it. What I understood from it is that the costumes had two purposes.
1. Try and make deceased family comfortable, make them feel that they still belonged
2. Ward off spirits/ghosts with evil intentions.
If you dressed like beings from the other realm, your own family wouldn't feel weird or ashamed and would appreciate all the effort. And at the same time the evil ones would only try and posses living humans. So if you dressed up like a ghost or a faerie (a being that crossed the realms too) they would leave you alone.
The light of the carved turnips would guide the spirits to their families homes and the "trick or treat" part was actually food aka "treat" you would prepare for your deceased family. If you didn't make them feel comfortable they would get angry and haunt your house (this is the "trick" part). If your ancestors were happy and content they would quietly go back to the other side as other realm closed again. If you made them angry they would resist it and be stuck in our realm and continue to haunt you, your family and house.
I myself do not believe in ghosts but I very much respect how they would honor the deceased and I'm a bit sad that we lost the original celebration and now that it's coming back from the USA it lost so much of it's origin. Seems that most people forgot the main aspect: honor the dead. It doesn't matter if you believe in a heaven or not, what religion you have or whether or not you're an atheist. Everyone has ancestors or maybe friends and family that died. Just thinking about them and respecting them once in a while is a nice thing to do. I'm not saying every country should go out for "trick or treat"-ing or celebrate Halloween as it's being celebrated now and I do believe most countries have a way of honoring the dead so it's all good.
I for one am happy it came back but I'll just celebrate it in honor of the original meaning. I have Celtic blood running through my veins so I might as well honor it a little. So, IF I have time to carve, I'll carve a turnip.