How do I use Hits Collections?

I’m trying to make a calorimeter where I need to record how much energy has been deposited in each individual calorimeter cell during an event, but I’m absolutely stumped as to how to properly implement a hit collection, can’t get it to work. Can somebody explain how it should be done or share a code where it’s clear how it’s done or something? (I’m very new to this)