How to achieve properly DoF when aiming down sights

Hello, has anyone ever achieved the effect of DoF while using a weapon?

I’m using an auto-focus that adjusts the focal region distance using traces, but my weapon gets blurred as the background behind the focus.

How could I get my weapon not blurred?