Let $G^+$ be the group of real points of a possibly disconnected linear reductive algebraic group defined over $\mathbb{R}$ which is generated by the real points of a connected component $G^\prime$ . Let $K$ be a maximal compact subgroup of the group of real points of the identity component of this algebraic group. We characterize the space of maps $\pi\mapsto \mathrm{tr}(\pi(f))$ , where $\pi$ is an irreducible tempered representation of $G^+$ and $f$ varies over the space of smooth, compactly supported functions on $G^\prime$ which are left and right $K$ -finite. This work is motivated by applications to the twisted Arthur-Selberg trace formula