Error in EventActionClass

You don’t have to do that by modifying the physics list. In your macro, you can turn individual processes on and off with /process/inactivate <name> (this works after /run/initialize).

but in this way I’ve to turn off lots of processes because I only want processes through which proton interacts depending upon the energy

You could create your own private physics list containing only the specific processes you want. Lots and lots of examples do that; have you looked at any of them?

That procedure is not recommended, because the G4 experts are much less likely to be able to help you with physics problems if you’re not using standard physics.

Ask yourself this question – are you really wanting only certain processes to happen (which means you’re not simulating reality), or are you wanting to only count certain processes?

If it’s the latter, then you can use the G4StepPoint->GetProcessDefinedStep() function to find out which process limited the step and was the interaction, and you can then limit what you put into your N-tuple based on that information.