I am not quite sure I am following you. You can use a where condition in the custom query and a macro to construct part of the where condition.
If I understand you correctly, for the event you want to have a relationship and save the Who Name. Basically if you are using the tree and putting the event under the who then you can always get the Who from the parent on the event by using {% Parent.DocumentName |(identity)GlobalAdministrator%}. If you want to store this as a default value when you are creating the event, then you can use macro's or the OnAfterSave Event with custom code.
If I am not understanding your challenge correctly, please elaborate.