Role of barrier on spin orientation in nucleus-nucleus collisions