In vivo fiber photometry is a powerful technique to analyze the dynamics of population neurons during functional study of neuroscience. Here, we introduced a detailed protocol for fiber photometry-based calcium recording in freely moving mice, covering from virus injection, fiber stub insertion, opt