I found some hats are given to users that they call it secret hats. Is there any criteria for this or they just throw it to popular users.
PS: I am taking part for the first time so pardon me for my question.
Secret Hats are... secret hats: Nothing in the description let you understand why you gain those hats, not even the description you read when you get them.
If you remember what you did before getting them, you could try guessing what the hat is for. Still, keep in mind that some hats could be not be given immediately. It is like with badges: There is a cron task (to use an expression familiar to us Drupalers) that checks which users meet some criteria, and which don't run every day, or every hour, when the criteria is verified, you get the badge.
Stack Exchange doesn't give a detailed description for those hats, probably because they don't want users do something just for getting them; instead, they want users to get a prize for doing what they normally do.