Magnetospheric transmission function approach to disentangle primary from secondary cosmic ray fluxes in the penumbra region