Doubly charmed baryon masses and quark wave functions in baryons