Dear Ihor,
Yes, you should be able to get that information by creating your own stepping action class, which should be declared as derived from G4UserSteppingAction class. You may find many use cases among the examples (either basic, extended or advanced ones).
Your concrete stepping action class must define a method named UserSteppingAction, which is called at every single step of the simulations, permitting you to access any kind of dynamic variable of interest during the tracking of particles.
Hope this helps,
Miguel