I initially looked for some plugins but I didn't find anything to achieve as your requirements.
Initially I used to create a separate job and detect the branch there and than only build another jobs as downstream.
This is what I have done and achieved it successfully. The feature is already available in Jenkins and we don't have to install any plugin for it.
I think, the image bellow will make every thing clear.

So if we want to trigger the job only when the changes is pushed or merged to TEST branch we do this.
The easiest solution of all. No script , no plugins. Click on the advance button to add refspec which is hidden by default while adding the reposiotory url in Source Code Management Section
For full information read my blog on it