2 #include "TMatrixTSym.h"
9 double R =
b *
b - 4 *
a *
c;
14 x_minus = (-
b +
sqrt(fabs(
R))) / (2.0 *
a);
15 x_plus = (-
b -
sqrt(fabs(
R))) / (2.0 *
a);
19 TLorentzVector& nu_minus,
20 const TLorentzVector& A1,
22 double a = (A1.Pz() * A1.Pz()) / (A1.E() * A1.E()) - 1.0;
24 double b = 2.0 * K * A1.Pz() / A1.E();
25 double c = K * K - A1.Pt() * A1.Pt();
26 double z_plus(0), z_minus(0);
28 nu_plus = TLorentzVector(-A1.Px(), -A1.Py(), z_plus,
sqrt(z_plus * z_plus + A1.Pt() * A1.Pt()));
29 nu_minus = TLorentzVector(-A1.Px(), -A1.Py(), z_minus,
sqrt(z_minus * z_minus + A1.Pt() * A1.Pt()));
33 TLorentzVector& nu_minus,
34 const TLorentzVector& A1,
37 zmin(-999),
min(9999), prev(9999);
39 TLorentzVector nu,
tau;
40 for (
int i = 0;
i <= (
int)(rmax - rmin) /
step;
i++) {
41 nu.SetPxPyPzE(-A1.Px(), -A1.Py(), z,
sqrt(z * z + A1.Pt() * A1.Pt()));
44 if (m2 - mtau2 < 0 && prev - mtau2 >= 0)
46 if (m2 - mtau2 > 0 && prev - mtau2 <= 0)
55 if (z1 != -999 &&
z2 != -999) {
56 nu_plus = TLorentzVector(-A1.Px(), -A1.Py(), z1,
sqrt(z1 * z1 + A1.Pt() * A1.Pt()));
57 nu_minus = TLorentzVector(-A1.Px(), -A1.Py(),
z2,
sqrt(
z2 *
z2 + A1.Pt() * A1.Pt()));
59 nu_plus = TLorentzVector(-A1.Px(), -A1.Py(),
zmin,
sqrt(
zmin *
zmin + A1.Pt() * A1.Pt()));
60 nu_minus = TLorentzVector(-A1.Px(), -A1.Py(),
zmin,
sqrt(
zmin *
zmin + A1.Pt() * A1.Pt()));
65 const TLorentzVector& A1,
66 TLorentzVector& Tau_plus,
67 TLorentzVector& Tau_minus,
68 TLorentzVector& nu_plus,
69 TLorentzVector& nu_minus,
72 TLorentzVector A1rot = A1;
73 double phi(TauDir.Phi()),
theta(TauDir.Theta());
75 A1rot.RotateY(-
theta);
81 nu_plus.RotateY(
theta);
83 Tau_plus = A1 + nu_plus;
85 nu_minus.RotateY(
theta);
86 nu_minus.RotateZ(phi);
87 Tau_minus = A1 + nu_minus;
89 Tau_plus = A1rot + nu_plus;
90 Tau_minus = A1rot + nu_minus;
99 TVector3 a1v(a1.Vect());
101 a1v *= 1 / a1v.Mag();
103 double dphitheta = acos(a1v.Dot(
tau) / (a1v.Mag() *
tau.Mag()));
104 if (thetaGJMaxvar < dphitheta ||
scale < 0) {
107 double a = (thetaGJMaxvar / dphitheta) - (1 -
scale);
108 double b = 1 - (thetaGJMaxvar / dphitheta) + (1 -
scale);
110 <<
"SetTauDirectionatThetaGJMax before GF " << thetaGJMaxvar <<
" dot "
111 << acos(a1v.Dot(
tau) / (a1v.Mag() *
tau.Mag())) <<
" a1 phi " << a1v.Phi() <<
" tau phi " <<
tau.Phi()
112 <<
" a1 theta " << a1v.Theta() <<
" tau theta " <<
tau.Theta();
119 <<
"SetTauDirectionatThetaGJMax GF " << thetaGJMaxvar <<
" dot " << acos(a1v.Dot(
tau) / (a1v.Mag() *
tau.Mag()))
120 <<
" phi " << phi <<
" theta " <<
theta;
133 TLorentzVector&
tau) {
134 TLorentzVector lorentzA1 = a1.
p4();
136 TVector3 tauFlghtDir =
sv -
pv;
137 TLorentzVector nuGuess;
139 TVector3 startingtauFlghtDir = tauFlghtDir.Unit();
140 if (ambiguity ==
zero) {
141 double theta = tauFlghtDir.Theta();
142 double phi = tauFlghtDir.Phi();
146 TLorentzVector
tau1,
tau2, nu1, nu2;
149 if (ambiguity ==
plus) {
153 if (ambiguity ==
minus) {
157 if (ambiguity ==
zero) {
170 TMatrixTSym<double> pvCov = a1.
vertexCov();
172 for (
int j = 0;
j <=
i;
j++) {
174 Cov(
i,
j) = pvCov(
i,
j);
180 v = 10 * par(
i) * par(
i);
189 TVectorT<double> outpar(3);
190 TVector3
res(inpar(0), inpar(1), inpar(2));
191 TVector3 Uz(
sin(inpar(4)) *
cos(inpar(3)),
sin(inpar(4)) *
sin(inpar(3)),
cos(inpar(4)));