Hola
It can be confusing and I often wonder what a Martian arriving would make of it. So I'll take a deep breath and have a go:
I suspect the "main dude with the particularly special hat" was the Archbishop or a visiting bishop. The hat is called a Mitre.
The gang of white robe people with green sashes of whom your friend the priest was one were indeed other priests who were joining in saying the Mass. The white robe is an alb and the green sash is the stole - the symbol of priesthood. The colours change depending on what is being celebrated just to confuse things.
The guys in the red robes (indeed of varying quality) are the tiraboleiros. They are not priests. They are employees of the cathedral. They help at the Mass and take up the collection. 8 of them operate the botafumeiro - the great incensor.
The blue robed guys who make alot of noise calling for silence (silencio por favor) are also not priests or monks. They are members of an organisation called Commanders of the Order of St Michael the Archangel - this is a voluntary organisation like the Knight of St Columba. Really they simply ushers all dressed up.
You can see a picture of them here:
http://johnniewalker-santiago.blogspot. ... grims.html
I assume the yellow mantle is like patrol leader stripes in the Boy Scouts.
And finally, just to show how sad I am for knowing this, there is the Pertiguero - currently he is the small, very portly, red faced wee man who wears another kind of robe and walks in front of the Archbishop with the Mace which he taps on the floor to make way. In England we would know him as the Beadle. Until recently he also wore a wig: