Zohreh, I'm not sure if this is exactly what you are looking for but there are two things I can think of that might do what you need. First, if you have rules that are already working you should have some info in your ontology that is a result of the rules. Any information that is added to the ontology as a result of inferences from the Reasoner (which includes firing SWRL rules) is highlighted and has a "?" next to it. If you pick some assertion that you know is the result of the rules you want to trace and click on the "?" Protege will show you a trace of the inferencing that the reasoner went through to deduce that assertion which will include the rules that fired.
Another option is to use SQWRL. SQWRL is just like SWRL except SQWRL doesn't assert info into the ontology, it only displays info. So a common trick is to write SQWRL rules where the left hand side is a SWRL rule you want to trace and the right hand side is replaced with a SQWRL select statement.
And in the SQWRL pane you will see a trace for every time this rule fires and what the values of p and a are when it does. You can put as many variables as you want in the select statement, as long as those variables are used in the left hand side of the rule.