Filling histogram with G4AnalysisManager from sensitive detector

I have been trying to fill a histogram with a energy spectrum of incident neutrons hitting a target.

I have defined a target volume, defined a sensitive detector, defined a primitive scorer (G4PSFlatSurfaceCurrent) with a particle filter, assigned that scorer to the sensitive detector and that sensitive detector to the target volume.

I have instanced G4AnalysisManager at the beginning of the run, and created a 1D histogram and a G4TScoreHistFiller.

At the end of an event, I instance G4AnalysisManager and G4SDManager, get a HCofThisEvent, and assign the values of the primitive scorer’s hit collection to a map, then assign the value of the map to a variable with fills the histogram.

but when I G4cout that variable that fills the histogram at the end, it outputs zeroes only, so one of the necessary steps is broken or missing. If any of you have any insight, I would greatly appreciate it.