Can a generating function be called in a stepping action

I am trying to implement a custom scintillation yield model. To do so I would like convert secondary electrons in the stepping action into optical photons according to a custom yield model. I was wondering if I can and should call a generating function in the stepping action or if there was a better way to go about this?

Thanks in advance!