In this paper we define a \(\mathbf{QP}^1\)-valued class function on the mapping class group \(\mathcal{M}_{g,2}\) of a surface \(\Sigma_{g,2}\) of genus \(g\) with two boundary components. Let \(E\) be a \(\Sigma_{g,2}\) bundle over a pair of pants \(P\). Gluing to \(E\) the product of an annulus and \(P\) along the boundaries of each fiber, we obtain a closed surface bundle over \(P\). We have another closed surface bundle by gluing to \(E\) the product of \(P\) and two disks. The sign of our class function cobounds the 2-cocycle on \(\mathcal{M}_{g,2}\) defined by the difference of the signature of these two surface bundles over \(P\).