Two-dimensional tetragonal and hexagonal lattices of transition metal carbides MC (M = Ti, Zr, Hf): Observation of two nodal loops and strong light-harvesting ability