Masses of the doubly heavy tetraquarks in a constituent quark model