  We calculate the $\mathcal O(\alpha_s^2)$ corrections to the primary massive
quark jet functions in Soft-Collinear Effective Theory (SCET). They are an
important ingredient in factorized predictions for inclusive jet mass cross
sections initiated by massive quarks emerging from a hard interaction with
smooth quark mass dependence. Due to the effects coming from the secondary
production of massive quark-antiquark pairs there are two options to define the
SCET jet function, which we call universal and mass mode jet functions. They
are related to whether or not a soft mass mode (zero) bin subtraction is
applied for the secondary massive quark contributions and differ in particular
concerning the infrared behavior for vanishing quark mass. We advocate that a
useful alternative to the common zero-bin subtraction concept is to define the
SCET jet functions through subtractions related to collinear-soft matrix
elements. This avoids the need to impose additional power counting arguments as
required for zero-bin subtractions. We demonstrate how the two SCET jet
function definitions may be used in the context of two recently developed
factorization approaches to treat secondary massive quark effects. We clarify
the relation between these approaches and in which way they are equivalent. Our
two-loop calculation involves interesting technical subtleties related to
spurious rapidity divergences and infrared regularization in the presence of
massive quarks.
