Adding tracks to the stack

I need to add new tracks to the stack when some events happen during the simulation (e.g. when a particle enters a specific detector).

I would expect that I can somehow interact with G4StackingManager from within UserSteppingAction, but I could not find any example on how this is done.

What is the correct way to do this?

Thank you