20 std::unique_ptr < double[] > deriv(
new double[3*NTRK+3]);
22 std::vector< std::array<double,6> > pmom(NTRK);
23 double dm2dpx, dm2dpy, dm2dpz, ee,
pt,
px,
py,
pz, cth;
27 for(
int it=0;
it<NTRK;
it++){
33 pmom[
it][2] =
pz =
pt * cth;
39 ptot[3] += pmom[
it][3];
43 for(
int it = 0;
it < NTRK; ++
it) {
51 dm2dpx = (ptot[3] / ee *
px - ptot[0]) * 2.;
52 dm2dpy = (ptot[3] / ee *
py - ptot[1]) * 2.;
53 dm2dpz = (ptot[3] / ee *
pz - ptot[2]) * 2.;
54 deriv[
it*3 + 0] = dm2dpz * ((-
pt) * (cth * cth + 1.));
55 deriv[
it*3 + 1] = -dm2dpx *
py + dm2dpy *
px;
58 deriv[
it*3 + 0] = deriv[
it*3 + 1] = deriv[
it*3 + 2] = 0.;
63 for(
int i=0;
i<NTRK*3;
i++){
65 for(
int j=0; j<NTRK*3; j++){
69 if(std::isnan(
tmp)) {
tmp=0.;}
70 if(std::isinf(
tmp)) {
tmp=0.;}
73 std::feclearexcept(FE_ALL_EXCEPT);
74 if(covM2<1.
e-10)covM2=1.e-10;
76 (*MASS) = (ptot[3]-ptot[2])*(ptot[3]+ptot[2])-ptot[1]*ptot[1]-ptot[0]*ptot[0];
77 if((*MASS)<1.e-10) (*MASS) = 1.e-10;
78 (*MASS) = sqrt(*MASS);
79 (*sigM) = sqrt(covM2) / 2. / (*MASS);
84 double *ams,
double *deriv,
double BMAG,
double *
dm,
double *sigm)
88 double constB, dm2dpx, dm2dpy, dm2dpz, ee,
pt,
px,
py,
pz, cth;
104 for (i__ = 1; i__ <= ntrk; ++i__) {
105 if (
list[i__] == 1) {
107 pt = std::abs(parfs[i3 + 3]);
109 cth = 1. /
tan(parfs[i3 + 1]);
116 ptot[3] += sqrt(
px*
px +
py*
py +
pz*
pz + ams[i__]*ams[i__]);
121 for (i__ = 1; i__ <= ntrk; ++i__) {
123 if (
list[i__] == 1) {
124 pt = std::abs(parfs[i3+3]);
126 cth = 1. /
tan(parfs[i3+1]);
131 dm2dpx = (ptot[3] / ee *
px - ptot[0]) * 2.;
132 dm2dpy = (ptot[3] / ee *
py - ptot[1]) * 2.;
133 dm2dpz = (ptot[3] / ee *
pz - ptot[2]) * 2.;
134 deriv[i3 + 1] = dm2dpz * ((-
pt) * (cth * cth + 1.));
135 deriv[i3 + 2] = -dm2dpx *
py + dm2dpy *
px;
136 deriv[i3 + 3] = (-dm2dpx *
px - dm2dpy*
py - dm2dpz*
pz)/ parfs[i3+3];
154 double covarm2=ptot[3];
156 (*dm) = (ptot[3]-ptot[2])*(ptot[3]+ptot[2])-ptot[1]*ptot[1]-ptot[0]*ptot[0];
157 if((*
dm)<1.e-6) (*
dm) = 1.e-6;
159 (*sigm) = sqrt(covarm2) / 2. / (*dm);