Study of magnetic and optical transitions in MFe2O4 (M=Co, Zn, Fe, Mn) with spinel structure