Masses of mesons with charm valence quarks from 2+1+1 flavor twisted mass lattice QCD