Metal–semiconductor heterojunctions in T-shaped carbon nanotubes