A component can handle its own event by using the <aura:handler> tag in its markup.
The action attribute of <aura:handler> sets the client-side controller action to
handle the event. For example:
<aura:registerEvent name="sampleComponentEvent" type="c:compEvent"/>
<aura:handler name="sampleComponentEvent" event="c:compEvent"
action="{!c.handleSampleEvent}"/>