How do i access Registered Primitives?

Hey there!
I’m fairly new to geant4/c++ in general so forgive me if this is trivial.

im currently repurposing the calorimeter from the extended biasing example GB03 for my own use.
in the example the primitive scorer has a few lines of code reading:
G4VPrimitiveScorer* primitive;
primitive = new G4PSEnergyDeposit(“edep”, j);
det->RegisterPrimitive(primitive);

to my understanding this stores the information of the deposited energy in the calorimeter for each event.
How can i acces this value in my event action and store it into a variable? I have trouble understanding the example in the user guide (p.185) and it seems overly complicated for such a simple task.

thanks in advance!

best regards
Tim