  We develop a version of Soft Collinear Effective Theory (SCET) which includes
finite quark masses, as well as Glauber gluons that describe the interaction of
collinear partons with QCD matter. In the framework of this new effective field
theory, labeled SCET$_{\mathrm{M,G}}$, we derive the massive splitting
functions in the vacuum and the QCD medium for the processes $Q\to Qg$, $Q\to
gQ$ and $g\to Q\bar Q$. The numerical effects due to finite quark masses are
sizable and our results are consistent with the traditional approach to parton
energy loss in the soft gluon emission limit. In addition, we present a new
framework for including the medium-induced full splitting functions consistent
with next-to-leading order calculations in QCD for inclusive hadron production.
Finally, we show numerical results for the suppression of $D$- and $B$-mesons
in heavy ion collisions at $\sqrt{s_{\mathrm{NN}}}=5.02$ TeV and 2.76 TeV and
compare to available data from the LHC.
