An analysis of stellar populations in globular clusters