Partition function in quantum field theory