10 #include "Riostream.h"
11 #include "RooAbsReal.h"
12 #include "RooAbsCategory.h"
16 using namespace TMath;
21 const char *name,
const char *title,
37 RooAbsPdf(name, title),
38 mzz(
"mzz",
"mzz", this, _mzz),
39 m1(
"m1",
"m1", this, _m1),
40 m2(
"m2",
"m2", this, _m2),
41 h1(
"h1",
"h1", this, _h1),
42 h2(
"h2",
"h2", this, _h2),
43 hs(
"hs",
"hs", this, _hs),
44 Phi(
"Phi",
"Phi", this, _Phi),
45 Phi1(
"Phi1",
"Phi1", this, _Phi1),
46 g1Val(
"g1Val",
"g1Val", this, _g1Val),
47 g2Val(
"g2Val",
"g2Val", this, _g2Val),
48 R1Val(
"R1Val",
"R1Val", this, _R1Val),
49 R2Val(
"R2Val",
"R2Val", this, _R2Val),
50 aParam(
"aParam",
"aParam", this, _aParam),
51 mZ(
"mZ",
"mZ", this, _mZ),
52 gamZ(
"gamZ",
"gamZ", this, _gamZ),
58 RooAbsPdf(other, name),
59 mzz(
"mzz", this, other.mzz),
60 m1(
"m1", this, other.m1),
61 m2(
"m2", this, other.m2),
62 h1(
"h1", this, other.h1),
63 h2(
"h2", this, other.h2),
64 hs(
"hs", this, other.hs),
65 Phi(
"Phi", this, other.Phi),
66 Phi1(
"Phi1", this, other.Phi1),
67 g1Val(
"g1Val", this, other.g1Val),
68 g2Val(
"g2Val", this, other.g2Val),
69 R1Val(
"R1Val", this, other.R1Val),
70 R2Val(
"R2Val", this, other.R2Val),
71 aParam(
"aParam", this, other.aParam),
72 mZ(
"mZ", this, other.mZ),
73 gamZ(
"gamZ", this, other.gamZ),
74 ZZ4fOrdering(other.ZZ4fOrdering)
83 if (
mZ < 90.) isZZ =
false;
87 if( (
m1+
m2) >
mzz )
return 1e-9;
89 double nanval = sqrt((1 - TMath::Power(
m1 -
m2,2)/TMath::Power(
mzz,2))*(1 - TMath::Power(
m1 +
m2,2)/TMath::Power(
mzz,2)));
90 if (nanval != nanval)
return 1e-9;
96 Double_t betaValSquared = (1.-(pow(
m1-
m2,2)/pow(
mzz,2)))*(1.-(pow(
m1+
m2,2)/pow(
mzz,2)));
97 Double_t betaVal = sqrt(betaValSquared);
99 Double_t term1Coeff = (pow(
m1,3))/( (pow(
m1,2)-pow(
mZ,2))*(pow(
m1,2)-pow(
mZ,2))+pow(
mZ,2)*pow(
gamZ,2) );
100 Double_t term2Coeff = (pow(
m2,3))/( (pow(
m2,2)-pow(
mZ,2))*(pow(
m2,2)-pow(
mZ,2))+pow(
mZ,2)*pow(
gamZ,2) );
112 Double_t f00Real = TMath::Power(
mzz,-1)*
g1Val*( sqrt(x*x-1) )*(
m1*
m1-
m2*
m2);
113 Double_t f00Imag = 0.;
115 Double_t fppReal = 0.;
118 Double_t fmmReal = 0.;
119 Double_t fmmImag = -1. * fppImag;
122 Double_t fp0Real =
m1*
g1Val * ( sqrt(x*x-1) );
123 Double_t fp0Imag = Power(
mzz,-2.)*Power(
m2,3)*
g2Val * ( - 1./2. )
125 + Power(
mzz,-2.)*Power(
m1,4)*Power(
m2,-1)*
g2Val * ( - 1./2. )
130 Double_t f0pReal =
m2*
g1Val * ( - sqrt(x*x-1) );
131 Double_t f0pImag = Power(
mzz,-2.)*Power(
m1,-1)*Power(
m2,4)*
g2Val * ( 1./2. )
132 + Power(
mzz,-2.)*
m1*Power(
m2,2)*
g2Val * ( - 1 - 2*(x*x-1) )
133 + Power(
mzz,-2.)*Power(
m1,3)*
g2Val * ( 1./2. )
134 + Power(
m1,-1)*Power(
m2,2)*
g2Val * ( - 1./2. )
137 Double_t f0mReal =
m2*
g1Val * ( - sqrt(x*x-1) );
138 Double_t f0mImag = Power(
mzz,-2.)*Power(
m1,-1)*Power(
m2,4)*
g2Val * ( - 1./2. )
139 + Power(
mzz,-2.)*
m1*Power(
m2,2)*
g2Val * ( 1 + 2*(x*x-1) )
140 + Power(
mzz,-2.)*Power(
m1,3)*
g2Val * ( - 1./2. )
141 + Power(
m1,-1)*Power(
m2,2)*
g2Val * ( 1./2. )
144 Double_t fm0Real =
m1*
g1Val * ( sqrt(x*x-1) );
145 Double_t fm0Imag = Power(
mzz,-2.)*Power(
m2,3)*
g2Val * ( 1./2. )
147 + Power(
mzz,-2.)*Power(
m1,4)*Power(
m2,-1)*
g2Val * ( 1./2. )
151 Double_t f00 = f00Imag*f00Imag + f00Real*f00Real;
152 Double_t fpp = fppImag*fppImag + fppReal*fppReal;
153 Double_t fmm = fmmImag*fmmImag + fmmReal*fmmReal;
154 Double_t fp0 = fp0Imag*fp0Imag + fp0Real*fp0Real;
155 Double_t f0p = f0pImag*f0pImag + f0pReal*f0pReal;
156 Double_t fm0 = fm0Imag*fm0Imag + fm0Real*fm0Real;
157 Double_t f0m = f0mImag*f0mImag + f0mReal*f0mReal;
159 Double_t phi00=atan2(f00Imag,f00Real);
160 Double_t phipp=atan2(fppImag,fppReal)-phi00;
161 Double_t phimm=atan2(fmmImag,fmmReal)-phi00;
162 Double_t phip0=atan2(fp0Imag,fp0Real)-phi00;
163 Double_t phi0p=atan2(f0pImag,f0pReal)-phi00;
164 Double_t phim0=atan2(fm0Imag,fm0Real)-phi00;
165 Double_t phi0m=atan2(f0mImag,f0mReal)-phi00;
169 value += -(f00*(-1 + TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*(-1 + TMath::Power(hs_,2)))/8.;
170 value += -(fmm*(-1 + TMath::Power(hs_,2))*(1 + TMath::Power(
h1,2) - 2*
h1*
R1Val)*(1 + TMath::Power(
h2,2) - 2*
h2*
R2Val))/32.;
171 value += -(fpp*(-1 + TMath::Power(hs_,2))*(1 + TMath::Power(
h1,2) + 2*
h1*
R1Val)*(1 + TMath::Power(
h2,2) + 2*
h2*
R2Val))/32.;
173 value += -(fp0*(-1 + TMath::Power(
h2,2))*(1 + TMath::Power(hs_,2))*(1 + TMath::Power(
h1,2) + 2*
h1*
R1Val))/32.;
174 value += -(f0m*(-1 + TMath::Power(
h1,2))*(1 + TMath::Power(hs_,2))*(1 + TMath::Power(
h2,2) - 2*
h2*
R2Val))/32.;
175 value += -(f0p*(-1 + TMath::Power(
h1,2))*(1 + TMath::Power(hs_,2))*(1 + TMath::Power(
h2,2) + 2*
h2*
R2Val))/32.;
176 value += -(fm0*(-1 + TMath::Power(
h2,2))*(1 + TMath::Power(hs_,2))*(1 + TMath::Power(
h1,2) - 2*
h1*
R1Val))/32.;
178 value += -(Sqrt(f00)*Sqrt(fmm)*Sqrt(1 - TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*(-1 + TMath::Power(hs_,2))*(
h1 -
R1Val)*(
h2 -
R2Val)*Cos(
Phi - phimm))/8.;
179 value += -(Sqrt(f00)*Sqrt(fpp)*Sqrt(1 - TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*(-1 + TMath::Power(hs_,2))*(
h1 +
R1Val)*(
h2 +
R2Val)*Cos(
Phi + phipp))/8.;
180 value += (Sqrt(f00)*Sqrt(fp0)*Sqrt(1 - TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h1 +
R1Val)*Cos(
Phi1 - phip0))/8.;
181 value += -(Sqrt(f00)*Sqrt(f0m)*(-1 + TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h2 -
R2Val)*Cos(
Phi - phi0m +
Phi1))/8.;
182 value += -(Sqrt(f00)*Sqrt(f0p)*(-1 + TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h2 +
R2Val)*Cos(
Phi + phi0p +
Phi1))/8.;
183 value += (Sqrt(f00)*Sqrt(fm0)*Sqrt(1 - TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h1 -
R1Val)*Cos(
Phi1 + phim0))/8.;
185 value += -(Sqrt(fmm)*Sqrt(fpp)*(-1 + TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*(-1 + TMath::Power(hs_,2))*Cos(2*
Phi - phimm + phipp))/16.;
186 value += -(Sqrt(fmm)*Sqrt(fp0)*(-1 + TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h2 -
R2Val)*Cos(
Phi -
Phi1 - phimm + phip0))/16.;
187 value += (Sqrt(f0m)*Sqrt(fmm)*Sqrt(1 - TMath::Power(
h1,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h1 -
R1Val)*(1 + TMath::Power(
h2,2) - 2*
h2*
R2Val)*Cos(phi0m -
Phi1 - phimm))/16.;
188 value += (Sqrt(f0p)*Sqrt(fmm)*Sqrt(1 - TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h1 -
R1Val)*Cos(2*
Phi + phi0p +
Phi1 - phimm))/16.;
189 value += -(Sqrt(fm0)*Sqrt(fmm)*Sqrt(1 - TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(1 + TMath::Power(
h1,2) - 2*
h1*
R1Val)*(
h2 -
R2Val)*Cos(
Phi +
Phi1 + phim0 - phimm))/16.;
190 value += -(Sqrt(fp0)*Sqrt(fpp)*Sqrt(1 - TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(1 + TMath::Power(
h1,2) + 2*
h1*
R1Val)*(
h2 +
R2Val)*Cos(
Phi +
Phi1 - phip0 + phipp))/16.;
191 value += (Sqrt(f0m)*Sqrt(fpp)*Sqrt(1 - TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h1 +
R1Val)*Cos(2*
Phi - phi0m +
Phi1 + phipp))/16.;
192 value += (Sqrt(f0p)*Sqrt(fpp)*Sqrt(1 - TMath::Power(
h1,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h1 +
R1Val)*(1 + TMath::Power(
h2,2) + 2*
h2*
R2Val)*Cos(phi0p +
Phi1 - phipp))/16.;
193 value += -(Sqrt(fm0)*Sqrt(fpp)*(-1 + TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*hs_*Sqrt(1 - TMath::Power(hs_,2))*(
h2 +
R2Val)*Cos(
Phi -
Phi1 - phim0 + phipp))/16.;
195 value += -(Sqrt(f0m)*Sqrt(fp0)*Sqrt(1 - TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*
196 (1 + TMath::Power(hs_,2))*(
h1 +
R1Val)*(
h2 -
R2Val)*Cos(
Phi - phi0m + phip0))/16.;
197 value += -(Sqrt(f0p)*Sqrt(fp0)*Sqrt(1 - TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*
199 Cos(
Phi + phi0p + 2*
Phi1 - phip0))/16.;
200 value += -(Sqrt(fm0)*Sqrt(fp0)*(-1 + TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*
201 (-1 + TMath::Power(hs_,2))*Cos(2*
Phi1 + phim0 - phip0))/16.;
202 value += -(Sqrt(f0m)*Sqrt(f0p)*(-1 + TMath::Power(
h1,2))*(-1 + TMath::Power(
h2,2))*
203 (-1 + TMath::Power(hs_,2))*Cos(2*
Phi - phi0m + phi0p + 2*
Phi1))/16.;
204 value += -(Sqrt(f0m)*Sqrt(fm0)*Sqrt(1 - TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*
206 Cos(
Phi - phi0m + 2*
Phi1 + phim0))/16.;
207 value += -(Sqrt(f0p)*Sqrt(fm0)*Sqrt(1 - TMath::Power(
h1,2))*Sqrt(1 - TMath::Power(
h2,2))*
208 (1 + TMath::Power(hs_,2))*(
h1 -
R1Val)*(
h2 +
R2Val)*Cos(
Phi + phi0p - phim0))/16.;
210 return value*term1Coeff*term2Coeff*betaVal;
215 if (matchArgs(allVars, analVars, RooArgSet(*
hs.absArg(), *
h1.absArg(), *
h2.absArg(), *
Phi.absArg(), *
Phi1.absArg())))
return 6;
216 if (matchArgs(allVars, analVars,
hs,
h1,
h2,
Phi))
return 5;
217 if (matchArgs(allVars, analVars,
hs,
h1,
h2,
Phi1))
return 4;
218 if (matchArgs(allVars, analVars,
hs,
h1,
Phi,
Phi1))
return 3;
219 if (matchArgs(allVars, analVars,
hs,
h2,
Phi,
Phi1))
return 2;
220 if (matchArgs(allVars, analVars,
h1,
h2,
Phi,
Phi1))
return 1;
226 if (
mZ < 90.) isZZ =
false;
231 if ((
m1+
m2) >
mzz)
return 1e-9;
233 double nanval = sqrt((1 - TMath::Power(
m1 -
m2, 2)/TMath::Power(
mzz, 2))*(1 - TMath::Power(
m1 +
m2, 2)/TMath::Power(
mzz, 2)));
234 if (nanval != nanval)
return 1e-9;
240 Double_t betaValSquared = (1.-(pow(
m1-
m2, 2)/pow(
mzz, 2)))*(1.-(pow(
m1+
m2, 2)/pow(
mzz, 2)));
241 Double_t betaVal = sqrt(betaValSquared);
243 Double_t term1Coeff = (pow(
m1, 3))/((pow(
m1, 2)-pow(
mZ, 2))*(pow(
m1, 2)-pow(
mZ, 2))+pow(
mZ, 2)*pow(
gamZ, 2));
244 Double_t term2Coeff = (pow(
m2, 3))/((pow(
m2, 2)-pow(
mZ, 2))*(pow(
m2, 2)-pow(
mZ, 2))+pow(
mZ, 2)*pow(
gamZ, 2));
257 Double_t f00Imag = 0.;
259 Double_t fppReal = 0.;
262 Double_t fmmReal = 0.;
263 Double_t fmmImag = -1. * fppImag;
266 Double_t fp0Real =
m1*
g1Val * (sqrt(x*x-1));
267 Double_t fp0Imag = Power(
mzz, -2.)*Power(
m2, 3)*
g2Val * (-1./2.)
269 + Power(
mzz, -2.)*Power(
m1, 4)*Power(
m2, -1)*
g2Val * (-1./2.)
274 Double_t f0pReal =
m2*
g1Val * (-sqrt(x*x-1));
275 Double_t f0pImag = Power(
mzz, -2.)*Power(
m1, -1)*Power(
m2, 4)*
g2Val * (1./2.)
276 + Power(
mzz, -2.)*
m1*Power(
m2, 2)*
g2Val * (-1 - 2*(x*x-1))
277 + Power(
mzz, -2.)*Power(
m1, 3)*
g2Val * (1./2.)
278 + Power(
m1, -1)*Power(
m2, 2)*
g2Val * (-1./2.)
281 Double_t f0mReal =
m2*
g1Val * (-sqrt(x*x-1));
282 Double_t f0mImag = Power(
mzz, -2.)*Power(
m1, -1)*Power(
m2, 4)*
g2Val * (-1./2.)
283 + Power(
mzz, -2.)*
m1*Power(
m2, 2)*
g2Val * (1 + 2*(x*x-1))
284 + Power(
mzz, -2.)*Power(
m1, 3)*
g2Val * (-1./2.)
285 + Power(
m1, -1)*Power(
m2, 2)*
g2Val * (1./2.)
288 Double_t fm0Real =
m1*
g1Val * (sqrt(x*x-1));
289 Double_t fm0Imag = Power(
mzz, -2.)*Power(
m2, 3)*
g2Val * (1./2.)
291 + Power(
mzz, -2.)*Power(
m1, 4)*Power(
m2, -1)*
g2Val * (1./2.)
295 Double_t f00 = f00Imag*f00Imag + f00Real*f00Real;
296 Double_t fpp = fppImag*fppImag + fppReal*fppReal;
297 Double_t fmm = fmmImag*fmmImag + fmmReal*fmmReal;
298 Double_t fp0 = fp0Imag*fp0Imag + fp0Real*fp0Real;
299 Double_t f0p = f0pImag*f0pImag + f0pReal*f0pReal;
300 Double_t fm0 = fm0Imag*fm0Imag + fm0Real*fm0Real;
301 Double_t f0m = f0mImag*f0mImag + f0mReal*f0mReal;
303 Double_t phi00=atan2(f00Imag, f00Real);
304 Double_t phipp=atan2(fppImag, fppReal)-phi00;
305 Double_t phimm=atan2(fmmImag, fmmReal)-phi00;
306 Double_t phip0=atan2(fp0Imag, fp0Real)-phi00;
307 Double_t phi0p=atan2(f0pImag, f0pReal)-phi00;
308 Double_t phim0=atan2(fm0Imag, fm0Real)-phi00;
309 Double_t phi0m=atan2(f0mImag, f0mReal)-phi00;
320 (32.*f00*TMath::Power(Pi(), 2))/27.;
322 (32.*fpp*TMath::Power(Pi(), 2))/27.;
324 (32.*fmm*TMath::Power(Pi(), 2))/27.;
326 (32.*fp0*TMath::Power(Pi(), 2))/27.;
328 (32.*f0m*TMath::Power(Pi(), 2))/27.;
330 (32.*f0p*TMath::Power(Pi(), 2))/27.;
332 (32.*fm0*TMath::Power(Pi(), 2))/27.;
333 return term1Coeff*term2Coeff*betaVal*integral;
356 (8*Sqrt(fm0)*Sqrt(fp0)*Pi()*Cos(2.*
Phi1 + phim0 - phip0))/27.;
357 return term1Coeff*term2Coeff*betaVal*integral;
379 (Sqrt(f00)*Sqrt(fmm)*TMath::Power(TMath::Pi(), 3)*
R1Val*
R2Val*Cos(
Phi - phimm))/12.;
381 (Sqrt(f00)*Sqrt(fpp)*TMath::Power(TMath::Pi(), 3)*
R1Val*
R2Val*Cos(
Phi + phipp))/12.;
383 (8*Sqrt(fmm)*Sqrt(fpp)*TMath::Pi()*Cos(2*
Phi - phimm + phipp))/27.;
385 (Sqrt(f0m)*Sqrt(fp0)*TMath::Power(Pi(), 3)*
R1Val*
R2Val*
386 Cos(
Phi - phi0m + phip0))/12.;
388 (Sqrt(f0p)*Sqrt(fm0)*TMath::Power(Pi(), 3)*
R1Val*
R2Val*
389 Cos(
Phi + phi0p - phim0))/12.;
390 return term1Coeff*term2Coeff*betaVal*integral;
398 (-8*f00*(-1 + TMath::Power(
h2, 2))*TMath::Power(TMath::Pi(), 2))/9.;
400 (4*fmm*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h2, 2) - 2*
h2*
R2Val))/9.;
402 (4*fpp*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h2, 2) + 2*
h2*
R2Val))/9.;
404 (-8*fp0*(-1 + TMath::Power(
h2, 2))*TMath::Power(TMath::Pi(), 2))/9.;
406 (4*f0m*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h2, 2) - 2*
h2*
R2Val))/9.;
408 (4*f0p*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h2, 2) + 2*
h2*
R2Val))/9.;
410 (-8*fm0*(-1 + TMath::Power(
h2, 2))*TMath::Power(TMath::Pi(), 2))/9.;
411 return term1Coeff*term2Coeff*betaVal*integral;
418 (-8*f00*(-1 + TMath::Power(
h1, 2))*TMath::Power(TMath::Pi(), 2))/9.;
420 (4*fmm*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h1, 2) - 2*
h1*
R1Val))/9.;
422 (4*fpp*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h1, 2) + 2*
h1*
R1Val))/9.;
424 (4*fp0*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h1, 2) + 2*
h1*
R1Val))/9.;
426 (-8*f0m*(-1 + TMath::Power(
h1, 2))*TMath::Power(TMath::Pi(), 2))/9.;
428 (-8*f0p*(-1 + TMath::Power(
h1, 2))*TMath::Power(TMath::Pi(), 2))/9.;
430 (4*fm0*TMath::Power(TMath::Pi(), 2)*(1 + TMath::Power(
h1, 2) - 2*
h1*
R1Val))/9.;
431 return term1Coeff*term2Coeff*betaVal*integral;
439 (-8*f00*(-1 + TMath::Power(hs_, 2))*TMath::Power(TMath::Pi(), 2))/9.;
441 (-8*fmm*(-1 + TMath::Power(hs_, 2))*TMath::Power(TMath::Pi(), 2))/9.;
443 (-8*fpp*(-1 + TMath::Power(hs_, 2))*TMath::Power(TMath::Pi(), 2))/9.;
445 (4.*fp0*TMath::Power(Pi(), 2)*(1. + TMath::Power(hs_, 2)))/9.;
447 (4.*f0m*TMath::Power(Pi(), 2)*(1. + TMath::Power(hs_, 2)))/9.;
449 (4.*f0p*TMath::Power(Pi(), 2)*(1. + TMath::Power(hs_, 2)))/9.;
451 (4.*fm0*TMath::Power(Pi(), 2)*(1. + TMath::Power(hs_, 2)))/9.;
452 return term1Coeff*term2Coeff*betaVal*integral;