Template Function GetLoopLevel