Custom hits reverting to G4VHits at end of event

I have implemented a custom hit class (very similar to example B4c hit class), but the hits are being stored as the default G4Vhits. In sensitive detector, I create a new hit CustomHit, add a bit of data, and add it to my G4THitsCollection. I need the hits at the end of event for a bit of post processing, but when I open up the hits collection in EndofEvenAction, the hit collection has reverted to G4VHitsCollection and all the hits to G4VHits. How do I get Geant to start using my custom hits class? A lot of my code for hits storing is very similar to example B4c, but with a single hits collection instead of 2 and I only add hits to the collection if energy is deposited. Thanks for the help!

You have to cast the hits to yours - see, for example, B4cEventAction.cc:

 63   auto hitsCollection 
 64     = static_cast<B4cCalorHitsCollection*>(
 65         event->GetHCofThisEvent()->GetHC(hcID));