How do i use the ClassSelectedEvent

I wanted to make a event that if a player dies of a specific class (for example 4) would be send to somewhere else with the player (of any class) that killed him. I know how to make the tp instance but im unsure on how to find and store the selected players, i believe it has something to do with the Class Selected Event, as on spawn each player is assigned a class (in my game) and with the class selected event i should be able to store that player in a specific variable, not completely sure on how the ClassSelectedEvent works, please help.