A characterization of graphs with disjoint total dominating sets