BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtD0ToKKpi0.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of models developed at BES collaboration
5// based on the EvtGen framework. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/BesCopyright
9// Copyright (A) 2006 Ping Rong-Gang @IHEP
10//
11// Module: EvtD0ToKKpi0.cc
12//
13// Description: Model provided by user, see BAM-628
14//
15// Modification history:
16//
17// Liaoyuan Dong Aug. 11, 2022 Module created
18//
19//------------------------------------------------------------------------
23#include "EvtGenBase/EvtPDL.hh"
31#include <stdlib.h>
32#include <iostream>
33#include <fstream>
34#include <vector>
35#include <map>
36#include <string>
37#include <complex>
38#include <vector>
39#include <math.h>
40using namespace std;
41#define PI acos(-1)
42
44
45void EvtD0ToKKpi0::getName(std::string& model_name){
46 model_name="D0ToKKpi0";
47}
48
52
54 checkNArg(2);
55 checkNDaug(3);
56 charm = getArg(0);
57 tagmode = getArg(1);
58 //std::cout << "Initializing EvtD0ToKKpi0: charm= "<<charm<<" tagmode= "<<tagmode<<std::endl;
59
60
61 g_uv.clear();
62 for(int i=0; i<4; i++){
63 for(int j=0; j<4; j++){
64 if(i!=j){
65 g_uv.push_back(0.0);
66 }else if(i<3){
67 g_uv.push_back(-1.0);
68 }else if(i==3){
69 g_uv.push_back(1.0);
70 }
71 }
72 }
73
74 epsilon_uvmn.clear();
75 for(int i=0; i<4; i++){
76 for(int j=0; j<4; j++){
77 for(int k=0; k<4; k++){
78 for(int l=0; l<4; l++){
79 if(i==j || i==k || i==l || j==k || j==l || k==l){
80 epsilon_uvmn.push_back(0.0);
81 }else{
82 if(i==0 && j==1 && k==2 && l==3) epsilon_uvmn.push_back(1.0);
83 if(i==0 && j==1 && k==3 && l==2) epsilon_uvmn.push_back(-1.0);
84 if(i==0 && j==2 && k==1 && l==3) epsilon_uvmn.push_back(-1.0);
85 if(i==0 && j==2 && k==3 && l==1) epsilon_uvmn.push_back(1.0);
86 if(i==0 && j==3 && k==1 && l==2) epsilon_uvmn.push_back(1.0);
87 if(i==0 && j==3 && k==2 && l==1) epsilon_uvmn.push_back(-1.0);
88
89 if(i==1 && j==0 && k==2 && l==3) epsilon_uvmn.push_back(-1.0);
90 if(i==1 && j==0 && k==3 && l==2) epsilon_uvmn.push_back(1.0);
91 if(i==1 && j==2 && k==0 && l==3) epsilon_uvmn.push_back(1.0);
92 if(i==1 && j==2 && k==3 && l==0) epsilon_uvmn.push_back(-1.0);
93 if(i==1 && j==3 && k==0 && l==2) epsilon_uvmn.push_back(-1.0);
94 if(i==1 && j==3 && k==2 && l==0) epsilon_uvmn.push_back(1.0);
95
96 if(i==2 && j==0 && k==1 && l==3) epsilon_uvmn.push_back(1.0);
97 if(i==2 && j==0 && k==3 && l==1) epsilon_uvmn.push_back(-1.0);
98 if(i==2 && j==1 && k==0 && l==3) epsilon_uvmn.push_back(-1.0);
99 if(i==2 && j==1 && k==3 && l==0) epsilon_uvmn.push_back(1.0);
100 if(i==2 && j==3 && k==0 && l==1) epsilon_uvmn.push_back(1.0);
101 if(i==2 && j==3 && k==1 && l==0) epsilon_uvmn.push_back(-1.0);
102
103 if(i==3 && j==0 && k==1 && l==2) epsilon_uvmn.push_back(-1.0);
104 if(i==3 && j==0 && k==2 && l==1) epsilon_uvmn.push_back(1.0);
105 if(i==3 && j==1 && k==0 && l==2) epsilon_uvmn.push_back(1.0);
106 if(i==3 && j==1 && k==2 && l==0) epsilon_uvmn.push_back(-1.0);
107 if(i==3 && j==2 && k==0 && l==1) epsilon_uvmn.push_back(-1.0);
108 if(i==3 && j==2 && k==1 && l==0) epsilon_uvmn.push_back(1.0);
109
110 }
111 }
112 }
113 }
114 }
115
116 _nd = 3;
117 math_pi = 3.1415926;
118 mass_Pion = 0.13957;
119
120 rRes = 3.0*0.197321;
121 rD = 5.0*0.197321;
122 m_Pi = mass_Pion;
123 m2_Pi = m_Pi*m_Pi;
124 m_Pi0 = 0.134977;
125 m2_Pi0 = m_Pi0*m_Pi0;
126 m_Ka = 0.493677;
127 m2_Ka = m_Ka*m_Ka;
128
129 m0_Kst892 = 0.89167;
130 w0_Kst892 = 0.0514;
131
132 m0_Kst1410 = 1.414;
133 w0_Kst1410 = 0.232;
134
135 m0_phi1020 = 1.019461;
136 w0_phi1020 = 0.004249;
137
138 m0_f0980 = 0.965;
139 g1_f0980 = 0.165;
140 g2_f0980 = 4.210;
141
142 m0_K01430 = 1.441;
143 w0_K01430 = 0.193;
144
145 a_lass = 0.113;
146 r_lass = -33.8;
147
148 fitpara.clear();
149 fitpara.push_back(complex<double>(100,0));
150 fitpara.push_back(complex<double>(66.2031*cos(2.5703),66.2031*sin(2.5703)));
151 fitpara.push_back(complex<double>(50.1991*cos(3.34488),50.1991*sin(3.34488)));
152 fitpara.push_back(complex<double>(236.463*cos(-0.541955),236.463*sin(-0.541955)));
153 fitpara.push_back(complex<double>(9389.32*cos(2.1910213),9389.32*sin(2.1910213)));
154
155
156 return;
157}
158
160 setProbMax(1432000000); // 1431906201.4
161}
162
164/*
165 double maxprob = 0.0;
166 for(int ir=0;ir<=60000000;ir++){
167 p->initializePhaseSpace(getNDaug(),getDaugs());
168 for(int i=0; i<_nd; i++){
169 _p4Lab[i]=p->getDaug(i)->getP4Lab();
170 _p4CM[i]=p->getDaug(i)->getP4();
171 }
172 double Prob = AmplitudeSquare(charm, tagmode);
173 if(Prob>maxprob) {
174 maxprob=Prob;
175 std::cout << "Max PDF = " << ir << " prob= " << Prob << std::endl;
176 }
177 }
178 std::cout << "Max!!!!!!!!!!! " << maxprob<< std::endl;
179*/
181 for(int i=0; i<_nd; i++){
182 _p4Lab[i]=p->getDaug(i)->getP4Lab();
183 _p4CM[i]=p->getDaug(i)->getP4();
184 }
185 double prob = AmplitudeSquare(charm, tagmode);
186 setProb(prob);
187 return;
188}
189
190void EvtD0ToKKpi0::setInput(double* kap, double* kam, double* pi0){
191 p4_Kap.clear(); p4_Kam.clear(); p4_Pi0.clear();
192 p4_Kap.push_back(kap[0]); p4_Kam.push_back(kam[0]); p4_Pi0.push_back(pi0[0]);
193 p4_Kap.push_back(kap[1]); p4_Kam.push_back(kam[1]); p4_Pi0.push_back(pi0[1]);
194 p4_Kap.push_back(kap[2]); p4_Kam.push_back(kam[2]); p4_Pi0.push_back(pi0[2]);
195 p4_Kap.push_back(kap[3]); p4_Kam.push_back(kam[3]); p4_Pi0.push_back(pi0[3]);
196}
197
198vector<double> EvtD0ToKKpi0::sum_tensor(vector<double> pa, vector<double> pb) {
199 if(pa.size()!=pb.size()){
200 cout<<"error sum tensor"<<endl;
201 exit(0);
202 }
203 vector<double> temp; temp.clear();
204 for(int i=0; i<pa.size(); i++){
205 double sum = pa[i] + pb[i];
206 temp.push_back(sum);
207 }
208 return temp;
209}
210
211double EvtD0ToKKpi0::contract_11_0(vector<double> pa, vector<double> pb){
212 if(pa.size()!=pb.size() || pa.size()!=4) {
213 cout<<"error contract 11->0"<<endl;
214 exit(0);
215 }
216 double temp = pa[3]*pb[3] - pa[0]*pb[0] - pa[1]*pb[1] - pa[2]*pb[2];
217 return temp;
218
219}
220
221vector<double> EvtD0ToKKpi0::contract_21_1(vector<double> pa, vector<double> pb){
222 if(pa.size()!=16 || pb.size()!=4) {
223 cout<<"error contract 21->1"<<endl;
224 exit(0);
225 }
226 vector<double> temp; temp.clear();
227 for(int i=0; i<4; i++){
228 double sum = 0;
229 for(int j=0; j<4; j++){
230 int idx = i*4+j;
231 sum += pa[idx]*pb[j]*g_uv[4*j+j];
232 }
233 temp.push_back(sum);
234 }
235 return temp;
236
237}
238
239double EvtD0ToKKpi0::contract_22_0(vector<double> pa, vector<double> pb){
240 if(pa.size()!=pb.size() || pa.size()!=16) {
241 cout<<"error contract 22->0"<<endl;
242 exit(0);
243 }
244 double temp = 0;
245 for(int i=0; i<4; i++){
246 for(int j=0; j<4; j++){
247 int idx = i*4+j;
248 temp += pa[idx]*pb[idx]*g_uv[4*i+i]*g_uv[4*j+j];
249 }
250 }
251 return temp;
252
253}
254
255vector<double> EvtD0ToKKpi0::contract_31_2(vector<double> pa, vector<double> pb){
256 if(pa.size()!=64 || pb.size()!=4) {
257 cout<<"error contract 31->2"<<endl;
258 exit(0);
259 }
260 vector<double> temp; temp.clear();
261 for(int i=0; i<16; i++){
262 double sum = 0;
263 for(int j=0; j<4; j++){
264 int idx = i*4+j;
265 sum += pa[idx]*pb[j]*g_uv[4*j+j];
266 }
267 temp.push_back(sum);
268 }
269 return temp;
270
271}
272
273vector<double> EvtD0ToKKpi0::contract_41_3(vector<double> pa, vector<double> pb){
274 if(pa.size()!=256|| pb.size()!=4) {
275 cout<<"error contract 41->3"<<endl;
276 exit(0);
277 }
278 vector<double> temp; temp.clear();
279 for(int i=0; i<64; i++){
280 double sum = 0;
281 for(int j=0; j<4; j++){
282 int idx = i*4+j;
283 sum += pa[idx]*pb[j]*g_uv[4*j+j];
284 }
285 temp.push_back(sum);
286 }
287 return temp;
288
289}
290
291vector<double> EvtD0ToKKpi0::contract_42_2(vector<double> pa, vector<double> pb){
292 if(pa.size()!=256|| pb.size()!=16) {
293 cout<<"error contract 42->2"<<endl;
294 exit(0);
295 }
296 vector<double> temp; temp.clear();
297 for(int i=0; i<16; i++){
298 double sum = 0;
299 for(int j=0; j<4; j++){
300 for(int k=0; k<4; k++){
301 int idxa = i*16+j*4+k;
302 int idxb = j*4+k;
303 sum += pa[idxa] * pb[idxb] * g_uv[4*j+j] * g_uv[4*k+k];
304 }
305 }
306 temp.push_back(sum);
307 }
308
309 return temp;
310
311}
312
313vector<double> EvtD0ToKKpi0::contract_22_2(vector<double> pa, vector<double> pb){
314 if(pa.size()!=16|| pb.size()!=16) {
315 cout<<"error contract 42->2"<<endl;
316 exit(0);
317 }
318 vector<double> temp; temp.clear();
319 for(int i=0; i<4; i++){
320 for(int j=0; j<4; j++){
321 double sum = 0;
322 for(int k=0; k<4; k++){
323 int idxa = i*4+k;
324 int idxb = j*4+k;
325 sum += pa[idxa] * pb[idxb] * g_uv[4*k+k];
326 }
327 temp.push_back(sum);
328 }
329 }
330
331 return temp;
332
333}
334
335/*
336 vector<double> EvtD0ToKKpi0::contract_11_2(vector<double> pa, vector<double> pb){
337 if(pa.size()!=pb.size() || pa.size()!=4) {
338 cout<<"error contract 11->2"<<endl;
339 exit(0);
340 }
341 vector<double> temp; temp.clear();
342 for(int i=0; i<4; i++){
343 for(int j=0; j<4; j++){
344 double prod = pa[i]*pb[j];
345 temp.push_back(prod);
346 }
347 }
348 return temp;
349 }
350
351 vector<double> EvtD0ToKKpi0::contract_22_4(vector<double> pa, vector<double> pb){
352 if(pa.size()!=pb.size() || pa.size()!=16) {
353 cout<<"error contract 22->4"<<endl;
354 exit(0);
355 }
356 vector<double> temp; temp.clear();
357 for(int i=0; i<16; i++){
358 for(int j=0; j<16; j++){
359 double prod = pa[i]*pb[j];
360 temp.push_back(prod);
361 }
362 }
363 return temp;
364 }
365 */
366
367//OrbitalTensors
368vector<double> EvtD0ToKKpi0::OrbitalTensors(vector<double> pa, vector<double> pb, vector<double> pc, double r, int rank)
369{
370
371 if(pa.size()!=4 || pb.size()!=4 || pc.size()!=4) {
372 cout<<"Error: pa, pb, pc"<<endl;
373 exit(0);
374 }
375 if(rank<0){
376 cout<<"Error: L<0 !!!"<<endl;
377 exit(0);
378 }
379
380 // relative momentum
381 vector<double> mr; mr.clear();
382
383 for(int i=0; i<4; i++){
384 double temp = pb[i] - pc[i];
385 mr.push_back(temp);
386 }
387
388 // "Masses" of particles
389 double msa = contract_11_0(pa, pa);
390 double msb = contract_11_0(pb, pb);
391 double msc = contract_11_0(pc, pc);
392
393 // Q^2_abc
394 double top = msa + msb - msc;
395 double Q2abc = top*top/(4.0*msa) - msb;
396
397 // Barrier factors
398 double Q_0 = 0.197321f/r;
399 double Q_02 = Q_0*Q_0;
400 double Q_04 = Q_02*Q_02;
401 // double Q_06 = Q_04*Q_02;
402 // double Q_08 = Q_04*Q_04;
403
404 double Q4abc = Q2abc*Q2abc;
405 // double Q6abc = Q4abc*Q2abc;
406 // double Q8abc = Q4abc*Q4abc;
407
408 double mB1 = sqrt(2.0f/(Q2abc + Q_02));
409 double mB2 = sqrt(13.0f/(Q4abc + (3.0f*Q_02)*Q2abc + 9.0f*Q_04));
410 // mB3 = &sqrt(277.0f/(Q6abc + (6.0f*Q_02)*Q4abc + (45.0f*Q_04)*Q2abc + 225.0f*Q_06));
411 // mB4 = &sqrt(12746.0f/(Q8abc + (10.0f*Q_02)*Q6abc + (135.0f*Q_04)*Q4abc + (1575.0f*Q_06)*Q2abc + 11025.0f*Q_08));
412
413 // Projection Operator 2-rank
414 vector<double> proj_uv; proj_uv.clear();
415 for(int i=0; i<4; i++){
416 for(int j=0; j<4; j++){
417 int idx = i*4 + j;
418 double temp = -g_uv[idx] + pa[i]*pa[j]/msa;
419 proj_uv.push_back(temp);
420 }
421 }
422
423 // Orbital Tensors
424 if(rank==0)
425 {
426 vector<double> t; t.clear();
427 t.push_back(1.0);
428 return t;
429
430 }else if(rank<3)
431 {
432 vector<double> t_u; t_u.clear();
433 vector<double> Bt_u; Bt_u.clear();
434 for(int i=0; i<4; i++){
435 double temp = 0;
436 for(int j=0; j<4; j++){
437 int idx = i*4 + j;
438 temp += -proj_uv[idx]*mr[j]*g_uv[j*4+j];
439 }
440 t_u.push_back(temp);
441 Bt_u.push_back(temp*mB1);
442 }
443 if(rank==1) return Bt_u;
444
445 double t_u2 = contract_11_0(t_u,t_u);
446
447 vector<double> Bt_uv; Bt_uv.clear();
448 for(int i=0; i<4; i++){
449 for(int j=0; j<4; j++){
450 int idx = 4*i + j;
451 double temp = t_u[i]*t_u[j] + (1.0/3.0)*proj_uv[idx]*t_u2;
452 Bt_uv.push_back(temp*mB2);
453 }
454 }
455 if(rank==2) return Bt_uv;
456
457 }else
458 {
459 cout<<"rank>2: please add it by yourself!!!"<<endl;
460 exit(0);
461 }
462
463}
464
465// projection Tensor
466vector<double> EvtD0ToKKpi0::ProjectionTensors(vector<double> pa, int rank)
467{
468
469 if(pa.size()!=4) {
470 cout<<"Error: pa"<<endl;
471 exit(0);
472 }
473 if(rank<0){
474 cout<<"Error: L<0 !!!"<<endl;
475 exit(0);
476 }
477
478 double msa = contract_11_0(pa, pa);
479
480 // Projection Operator 2-rank
481 vector<double> proj_uv; proj_uv.clear();
482 for(int i=0; i<4; i++){
483 for(int j=0; j<4; j++){
484 int idx = i*4 + j;
485 double temp = -g_uv[idx] + pa[i]*pa[j]/msa;
486 proj_uv.push_back(temp);
487 }
488 }
489
490 // Orbital Tensors
491 if(rank==0)
492 {
493 vector<double> t; t.clear();
494 t.push_back(1.0);
495 return t;
496
497 }else if(rank==1)
498 {
499 return proj_uv;
500 }else if(rank==2)
501 {
502 vector<double> proj_uvmn; proj_uvmn.clear();
503 for(int i=0; i<4; i++){
504 for(int j=0; j<4; j++){
505 for(int k=0; k<4; k++){
506 for(int l=0; l<4; l++){
507
508 int idx1_1 = 4*i + k;
509 int idx1_2 = 4*i + l;
510 int idx1_3 = 4*i + j;
511
512 int idx2_1 = 4*j + l;
513 int idx2_2 = 4*j + k;
514 int idx2_3 = 4*k + l;
515
516 double temp = (1.0/2.0)*(proj_uv[idx1_1]*proj_uv[idx2_1] + proj_uv[idx1_2]*proj_uv[idx2_2]) - (1.0/3.0)*proj_uv[idx1_3]*proj_uv[idx2_3];
517 proj_uvmn.push_back(temp);
518 }
519 }
520 }
521 }
522 return proj_uvmn;
523
524 }else
525 {
526 cout<<"rank>2: please add it by yourself!!!"<<endl;
527 exit(0);
528 }
529
530}
531double EvtD0ToKKpi0::fundecaymomentum(double mr2, double m1_2, double m2_2){
532 double mr = sqrt(mr2);
533 double poly = mr2*mr2 + m1_2*m1_2 + m2_2*m2_2 - 2*m1_2*mr2 -2*m2_2*mr2 -2*m1_2*m2_2;
534 double ret = sqrt(poly)/(2*mr);
535 if(poly<0)
536 //if(sqrt(m1_2) +sqrt(m2_2) > mr)
537 ret = 0.0f;
538 return ret;
539}
540
541complex<double> EvtD0ToKKpi0::breitwigner(double mx2, double mr, double wr)
542{
543 double output_x = 0;
544 double output_y = 0;
545
546 double mr2 = mr*mr;
547 double diff = mr2-mx2;
548 double denom = diff*diff + wr*wr*mr2;
549 if (wr<0) {
550 output_x = 0;
551 output_y = 0;
552 }
553 else if (wr<10) {
554 output_x = diff/denom;
555 output_y = wr*mr/denom;
556 }
557 else { /* phase space */
558 output_x = 1;
559 output_y = 0;
560 }
561 complex<double> output(output_x,output_y);
562 return output;
563
564}
565
566/* GS propagator */
567double EvtD0ToKKpi0::h(double m, double q){
568 double h = 2.0/math_pi*q/m*log((m+2.0*q)/(2.0*mass_Pion));
569 return h;
570}
571
572double EvtD0ToKKpi0::dh(double m0, double q0){
573 double dh = h(m0,q0)*(1.0/(8.0*q0*q0)-1.0/(2.0*m0*m0))+1.0/(2.0*math_pi*m0*m0);
574 return dh;
575}
576
577double EvtD0ToKKpi0::f(double m0, double sx, double q0, double q){
578 double m = sqrt(sx);
579 double f = m0*m0/(q0*q0*q0)*(q*q*(h(m,q)-h(m0,q0))+(m0*m0-sx)*q0*q0*dh(m0,q0));
580 return f;
581}
582
583double EvtD0ToKKpi0::d(double m0, double q0){
584 double d = 3.0/math_pi*mass_Pion*mass_Pion/(q0*q0)*log((m0+2.0*q0)/(2.0*mass_Pion)) + m0/(2.0*math_pi*q0) - (mass_Pion*mass_Pion*m0)/(math_pi*q0*q0*q0);
585 return d;
586}
587
588double EvtD0ToKKpi0::fundecaymomentum2(double mr2, double m1_2, double m2_2){
589 double mr = sqrt(mr2);
590 double poly = mr2*mr2 + m1_2*m1_2 + m2_2*m2_2 - 2*m1_2*mr2 -2*m2_2*mr2 -2*m1_2*m2_2;
591 double ret = poly/(4.0f*mr2);
592 if(poly<0)
593 ret = 0.0f;
594 return ret;
595}
596
597double EvtD0ToKKpi0::wid(double mass, double sa, double sb, double sc, double r, int l){
598 double widm = 1.0;
599 double sa0 = mass*mass;
600 double m = sqrt(sa);
601 double q = fundecaymomentum2(sa,sb,sc);
602 double q0 = fundecaymomentum2(sa0,sb,sc);
603 r = r/0.197321;
604 double z = q*r*r;
605 double z0 = q0*r*r;
606 double F = 0.0;
607 if(l == 0) F = 1.0;
608 if(l == 1) F = sqrt((1.0+z0)/(1.0+z));
609 if(l == 2) F = sqrt((9.0+3.0*z0+z0*z0)/(9.0+3.0*z+z*z));
610 if(l == 3) F = sqrt((225.0+45.0*z0+6.0*z0*z0+z0*z0*z0)/(225.0+45.0*z+6.0*z*z+z*z*z));
611 if(l == 4) F = sqrt((11025.0+1575.0*z0+135.0*z0*z0+10.0*z0*z0*z0+z0*z0*z0*z0)/(11025.0+1575.0*z+135.0*z*z+10.0*z*z*z+z*z*z*z));
612 double t = sqrt(q/q0);
613 //printf("sa0 = %f, sb = %f, sc = %f, q = %f, q0 = %0.15f, qq0 = %f, t = %f \n",sa0,sb,sc,q,q0,q/q0,t);
614 uint i=0;
615 for(i=0; i<(2*l+1); i++) {
616 widm *= t;
617 }
618 widm *= (mass/m*F*F);
619 return widm;
620}
621
622/* for rho0, use GS, rho0->pi+ pi-, only angular momentum 1*/
623complex<double> EvtD0ToKKpi0::GS(double mx2, double mr, double wr, double m1_2, double m2_2, double r, int l){
624
625 double mr2 = mr*mr;
626 double q = fundecaymomentum(mx2, m1_2, m2_2);
627 double q0 = fundecaymomentum(mr2, m1_2, m2_2);
628 double numer = 1.0+d(mr,q0)*wr/mr;
629 double denom_real = mr2-mx2+wr*f(mr,mx2,q0,q);
630 double denom_imag = mr*wr*wid(mr,mx2,m1_2,m2_2,r,l);//real-i*imag;
631
632 double denom = denom_real*denom_real+denom_imag*denom_imag;
633 double output_x = denom_real*numer/denom;
634 double output_y = denom_imag*numer/denom;
635
636 complex<double> output(output_x,output_y);
637 return output;
638}
639
640complex<double> EvtD0ToKKpi0::irho(double mr2, double m1_2, double m2_2){
641 double mr = sqrt(mr2);
642 double poly = mr2*mr2 + m1_2*m1_2 + m2_2*m2_2 - 2*m1_2*mr2 - 2*m2_2*mr2 - 2*m1_2*m2_2;
643 double ret_real = 0;
644 double ret_imag = 0;
645 if(poly>=0) {
646 ret_real = 2.0f*sqrt(poly)/(2.0f*mr2);
647 ret_imag = 0;
648 }
649 else {
650 ret_real = 0;
651 ret_imag = 2.0f*sqrt(-1.0f*poly)/(2.0f*mr2);
652 }
653 complex<double> ret(ret_real,ret_imag);
654 return ret;
655}
656
657complex<double> EvtD0ToKKpi0::Flatte(double mx2, double mr, double g1, double g2, double m1a, double m1b, double m2a, double m2b){
658
659 double mr2 = mr*mr;
660 double diff = mr2-mx2;
661 double g22 = g2*g1;
662 complex<double> ps1 = irho(mx2, m1a*m1a, m1b*m1b);
663 complex<double> ps2 = irho(mx2, m2a*m2a, m2b*m2b);
664 complex<double> iws = g1*ps1+g22*ps2; /*mass dependent width */
665
666 double denom_real = diff + iws.imag();
667 double denom_imag = iws.real();
668 double denom = denom_real*denom_real+denom_imag*denom_imag;
669
670 double output_x = denom_real/denom;
671 double output_y = denom_imag/denom;
672
673 complex<double> output(output_x,output_y);
674 return output;
675
676}
677
678complex<double> EvtD0ToKKpi0::RBW(double mx2, double mr, double wr, double m1_2, double m2_2, double r, int l){
679 double mx = sqrt(mx2);
680 double mr2 = mr*mr;
681 double denom_real = mr2-mx2;
682 double denom_imag = 0;
683 if(m1_2>0 && m2_2>0){
684 denom_imag = mr*wr*wid(mr,mx2,m1_2,m2_2,r,l);//real-i*imag;
685 }else{
686 denom_imag = mr*wr;
687 }
688
689 double denom = denom_real*denom_real+denom_imag*denom_imag;
690 double output_x = denom_real/denom;
691 double output_y = denom_imag/denom;
692
693 complex<double> output(output_x,output_y);
694 return output;
695}
696
697complex<double> EvtD0ToKKpi0::KPiSLass(double mx2, double mr, double wr, double a, double r, double R, double phi_R, double phi_F){
698
699 double mx = sqrt(mx2);
700 double mr2 = mr*mr;
701 double q2abc = fundecaymomentum2(mx2, m2_Ka, m2_Pi0);
702 double q02abc = fundecaymomentum2(mr2, m2_Ka, m2_Pi0);
703
704 double qr2 = q2abc/q02abc;
705 if(qr2<0) qr2 = 0;
706 double wid = wr*sqrt(qr2)*(mr/mx);
707
708 double alphaR = atan(mr*wid/(mr2 - mx2));
709 if((mr2 - mx2)<0) alphaR += math_pi;
710
711 double alphaF = atan(2.0*a*sqrt(q2abc)/(2.0 + a*r*q2abc));
712 if((2.0*a*sqrt(q2abc)/(2.0 + a*r*q2abc))<0) alphaF += math_pi;
713
714 double delta_R = phi_R + alphaR;
715 double delta_F = phi_F + alphaF;
716
717 double output_x = R*sin(delta_R)*cos(delta_R+2.0*delta_F) + sin(delta_F)*cos(delta_F);
718 double output_y = R*sin(delta_R)*sin(delta_R+2.0*delta_F) + sin(delta_F)*sin(delta_F);
719
720 complex<double> output(output_x,output_y);
721 return output;
722}
723
724// PiPi-S wave K-Matrix
725double EvtD0ToKKpi0::rho22(double sc){
726 double rho[689] = { 3.70024e-18, 8.52763e-15, 1.87159e-13, 1.3311e-12, 5.61842e-12, 1.75224e-11, 4.48597e-11, 9.99162e-11, 2.00641e-10, 3.71995e-10,
727 6.47093e-10, 1.06886e-09, 1.69124e-09, 2.58031e-09, 3.8168e-09, 5.49601e-09, 7.72996e-09, 1.06509e-08, 1.44078e-08, 1.91741e-08,
728 2.51445e-08, 3.25345e-08, 4.15946e-08, 5.25949e-08, 6.58316e-08, 8.16443e-08, 1.00389e-07, 1.22455e-07, 1.48291e-07, 1.78348e-07,
729 2.1313e-07, 2.53192e-07, 2.99086e-07, 3.51462e-07, 4.10993e-07, 4.78349e-07, 5.54327e-07, 6.3972e-07, 7.35316e-07, 8.42099e-07,
730 9.61004e-07, 1.09295e-06, 1.2391e-06, 1.40051e-06, 1.57824e-06, 1.77367e-06, 1.98805e-06, 2.22257e-06, 2.47877e-06, 2.7581e-06,
731 3.06186e-06, 3.39182e-06, 3.74971e-06, 4.137e-06, 4.5555e-06, 5.00725e-06, 5.4939e-06, 6.01725e-06, 6.57992e-06, 7.18371e-06,
732 7.83044e-06, 8.52301e-06, 9.26342e-06, 1.00535e-05, 1.08967e-05, 1.17953e-05, 1.27514e-05, 1.37679e-05, 1.48482e-05, 1.59943e-05,
733 1.72088e-05, 1.84961e-05, 1.98586e-05, 2.12987e-05, 2.28207e-05, 2.44279e-05, 2.61228e-05, 2.79084e-05, 2.97906e-05, 3.17718e-05,
734 3.38544e-05, 3.60443e-05, 3.8345e-05, 4.07591e-05, 4.32903e-05, 4.59459e-05, 4.87285e-05, 5.16403e-05, 5.46887e-05, 5.7878e-05,
735 6.12111e-05, 6.46908e-05, 6.83274e-05, 7.21231e-05, 7.60817e-05, 8.0208e-05, 8.45102e-05, 8.89919e-05, 9.36544e-05, 9.85082e-05,
736 0.000103559, 0.000108812, 0.000114267, 0.000119938, 0.000125827, 0.00013194, 0.000138278, 0.000144857, 0.000151681, 0.000158752,
737 0.000166074, 0.000173663, 0.000181521, 0.000189652, 0.000198059, 0.000206761, 0.000215761, 0.000225063, 0.00023467, 0.000244599,
738 0.000254855, 0.00026544, 0.000276357, 0.000287629, 0.00029926, 0.000311253, 0.000323609, 0.000336351, 0.000349483, 0.000363009,
739 0.000376926, 0.000391264, 0.000406029, 0.000421225, 0.000436848, 0.000452921, 0.000469458, 0.000486461, 0.00050393, 0.00052187,
740 0.000540322, 0.000559278, 0.000578746, 0.00059872, 0.000619236, 0.0006403, 0.000661911, 0.000684074, 0.000706799, 0.000730127,
741 0.00075405, 0.000778569, 0.000803686, 0.000829443, 0.000855839, 0.000882879, 0.000910561, 0.000938898, 0.000967939, 0.000997674,
742 0.00102811, 0.00105923, 0.0010911, 0.0011237, 0.00115706, 0.00119117, 0.00122601, 0.00126168, 0.00129815, 0.00133543,
743 0.00137351, 0.00141242, 0.00145219, 0.00149283, 0.00153434, 0.0015767, 0.00161995, 0.00166415, 0.00170928, 0.00175534,
744 0.00180232, 0.00185028, 0.00189924, 0.00194919, 0.00200014, 0.00205207, 0.00210503, 0.0021591, 0.00221421, 0.0022704,
745 0.00232766, 0.00238602, 0.00244554, 0.00250619, 0.00256799, 0.0026309, 0.002695, 0.00276033, 0.00282689, 0.00289467,
746 0.00296367, 0.00303389, 0.00310543, 0.0031783, 0.00325244, 0.0033279, 0.0034046, 0.00348275, 0.00356229, 0.00364322,
747 0.00372555, 0.00380924, 0.00389438, 0.00398104, 0.00406914, 0.00415877, 0.00424985, 0.00434235, 0.00443651, 0.00453224,
748 0.00462954, 0.00472848, 0.00482894, 0.00493102, 0.00503483, 0.00514029, 0.00524749, 0.0053563, 0.00546675, 0.00557905,
749 0.0056931, 0.00580901, 0.0059267, 0.00604613, 0.00616735, 0.00629049, 0.00641557, 0.00654254, 0.00667142, 0.00680216,
750 0.00693472, 0.00706946, 0.00720621, 0.00734497, 0.0074858, 0.00762855, 0.00777338, 0.00792036, 0.00806957, 0.00822087,
751 0.00837426, 0.00852982, 0.0086875, 0.00884756, 0.00900991, 0.00917447, 0.00934137, 0.00951052, 0.00968194, 0.0098558,
752 0.010032, 0.0102108, 0.0103919, 0.0105754, 0.0107612, 0.0109496, 0.0111406, 0.0113343, 0.0115305, 0.0117293,
753 0.0119303, 0.0121343, 0.0123409, 0.0125502, 0.0127623, 0.0129771, 0.0131944, 0.0134145, 0.0136376, 0.0138636,
754 0.0140924, 0.0143241, 0.0145587, 0.0147959, 0.0150363, 0.0152797, 0.0155262, 0.0157758, 0.0160283, 0.0162838,
755 0.0165421, 0.016804, 0.0170691, 0.0173374, 0.0176087, 0.0178835, 0.0181612, 0.0184423, 0.0187269, 0.0190149,
756 0.0193063, 0.0196009, 0.0198991, 0.0202003, 0.0205052, 0.0208137, 0.0211259, 0.0214418, 0.0217611, 0.0220841,
757 0.0224105, 0.0227406, 0.0230746, 0.0234125, 0.0237542, 0.0240996, 0.0244486, 0.0248012, 0.025158, 0.0255188,
758 0.0258837, 0.0262527, 0.0266256, 0.0270025, 0.0273833, 0.027768, 0.0281572, 0.0285505, 0.0289483, 0.0293503,
759 0.0297564, 0.0301665, 0.0305808, 0.0309997, 0.0314231, 0.0318511, 0.0322835, 0.0327205, 0.0331616, 0.0336073,
760 0.0340576, 0.0345128, 0.0349727, 0.0354373, 0.0359066, 0.0363807, 0.0368589, 0.0373419, 0.0378302, 0.0383234,
761 0.0388218, 0.0393252, 0.0398336, 0.040347, 0.0408652, 0.041388, 0.0419165, 0.0424502, 0.0429893, 0.0435338,
762 0.0440833, 0.044638, 0.0451976, 0.0457627, 0.0463338, 0.0469103, 0.047492, 0.0480797, 0.0486729, 0.0492716,
763 0.0498757, 0.0504852, 0.0511009, 0.0517229, 0.0523503, 0.0529838, 0.0536231, 0.0542678, 0.054918, 0.0555743,
764 0.0562372, 0.0569065, 0.0575818, 0.0582634, 0.0589511, 0.0596454, 0.0603451, 0.061051, 0.0617635, 0.0624826,
765 0.0632084, 0.0639409, 0.06468, 0.0654254, 0.0661772, 0.0669346, 0.0676994, 0.0684714, 0.0692503, 0.0700354,
766 0.0708285, 0.0716277, 0.0724347, 0.0732479, 0.0740671, 0.0748947, 0.0757299, 0.0765715, 0.0774207, 0.0782771,
767 0.0791407, 0.0800119, 0.0808897, 0.0817743, 0.0826672, 0.0835684, 0.0844769, 0.0853938, 0.0863179, 0.0872493,
768 0.0881882, 0.0891349, 0.090089, 0.0910523, 0.0920236, 0.093002, 0.0939894, 0.094985, 0.0959887, 0.0970003,
769 0.0980191, 0.0990454, 0.100081, 0.101126, 0.10218, 0.103242, 0.104312, 0.105392, 0.10648, 0.107576,
770 0.10868, 0.109793, 0.110916, 0.112048, 0.113188, 0.114339, 0.115498, 0.116666, 0.117843, 0.119028,
771 0.120223, 0.121427, 0.122641, 0.123865, 0.125098, 0.126342, 0.127595, 0.128857, 0.130128, 0.131409,
772 0.132701, 0.134002, 0.135314, 0.136635, 0.137966, 0.139308, 0.14066, 0.142022, 0.143394, 0.144774,
773 0.146166, 0.14757, 0.148985, 0.15041, 0.151845, 0.153291, 0.154749, 0.156215, 0.157694, 0.159182,
774 0.160682, 0.162194, 0.163718, 0.165251, 0.166797, 0.168354, 0.169921, 0.1715, 0.17309, 0.17469,
775 0.176304, 0.177929, 0.179566, 0.181216, 0.182878, 0.184553, 0.186238, 0.187934, 0.189642, 0.191362,
776 0.193096, 0.194842, 0.196602, 0.198374, 0.200158, 0.201954, 0.203764, 0.205586, 0.207421, 0.209266,
777 0.211124, 0.212997, 0.214882, 0.216783, 0.218697, 0.220624, 0.222565, 0.224518, 0.226486, 0.228466,
778 0.230458, 0.232463, 0.234484, 0.23652, 0.238569, 0.240633, 0.242711, 0.244803, 0.246909, 0.249031,
779 0.251165, 0.253313, 0.255475, 0.257649, 0.259841, 0.262051, 0.264274, 0.266514, 0.268768, 0.271036,
780 0.273319, 0.275618, 0.277932, 0.280259, 0.282602, 0.28496, 0.287338, 0.28973, 0.292138, 0.294563,
781 0.297003, 0.299458, 0.30193, 0.304417, 0.306919, 0.309437, 0.311972, 0.314526, 0.317095, 0.319684,
782 0.322289, 0.324911, 0.327551, 0.330205, 0.332876, 0.335567, 0.338271, 0.340993, 0.343736, 0.346496,
783 0.349272, 0.352065, 0.354878, 0.35771, 0.360561, 0.363426, 0.366311, 0.369212, 0.372128, 0.375067,
784 0.378027, 0.381006, 0.384001, 0.387014, 0.39005, 0.393106, 0.396181, 0.399271, 0.402384, 0.405513,
785 0.408661, 0.41183, 0.41502, 0.418233, 0.421462, 0.424709, 0.42798, 0.43127, 0.434583, 0.437914,
786 0.441267, 0.444637, 0.448022, 0.451434, 0.454868, 0.458328, 0.461805, 0.465302, 0.468821, 0.472364,
787 0.475928, 0.47951, 0.483119, 0.486748, 0.490397, 0.494066, 0.497758, 0.501477, 0.505217, 0.508977,
788 0.512762, 0.516567, 0.520394, 0.524247, 0.528125, 0.532027, 0.535947, 0.53989, 0.543852, 0.547844,
789 0.551863, 0.555904, 0.559966, 0.56406, 0.568177, 0.572312, 0.576471, 0.580662, 0.584875, 0.58911,
790 0.593373, 0.597653, 0.601965, 0.606301, 0.610663, 0.615051, 0.619465, 0.623907, 0.62837, 0.632863,
791 0.637383, 0.641924, 0.646494, 0.651091, 0.655708, 0.660356, 0.665027, 0.669732, 0.674464, 0.679227,
792 0.684016, 0.688827, 0.693664, 0.698532, 0.703428, 0.708353, 0.713307, 0.718283, 0.72329, 0.728322,
793 0.733387, 0.738479, 0.743605, 0.748763, 0.753949, 0.759163, 0.764407, 0.769674, 0.774973, 0.780311,
794 0.78567, 0.791057, 0.796476, 0.801922, 0.8074, 0.812919, 0.818466, 0.824044 };
795
796 double m2 = 0.13957*0.13957;
797 double smin = (0.13957*4)*(0.13957*4);
798 double dh = 0.001;
799 int od = (sc - 0.312)/dh;
800 double sc_m = 0.312 + od*dh;
801 double rhouse = 0;
802 if(sc>=0.312 && sc<1){
803 rhouse = ((sc-sc_m)/dh)*(rho[od+1]-rho[od])+rho[od];
804 }else if(sc<0.312 && sc>=smin){
805 rhouse = ((sc - smin)/(0.312-smin))*rho[0];
806 }else if(sc>=1){
807 // rhouse = (1-16*m2/sc)*(1-16*m2/sc)*(1-16*m2/sc)*(1-16*m2/sc)*(1-16*m2/sc);
808 rhouse = sqrt(1-16*m2/sc);
809 }else{
810 rhouse = 0;
811 }
812 return rhouse;
813}
814
815complex<double> EvtD0ToKKpi0::rhoMTX(int i, int j, double s){
816
817 double rhoijx;
818 double rhoijy;
819 double mpi = 0.13957;
820 if(i==j && i==0 ){
821 double m2 = 0.13957*0.13957;
822 if((1-(4*m2)/s)>0){
823 rhoijx = sqrt(1.0f - (4*m2)/s);
824 rhoijy = 0;
825 }else{
826 rhoijy = sqrt((4*m2)/s - 1.0f);
827 rhoijx = 0;
828 }
829 }
830 if(i==j && i==1 ){
831 double m2 = 0.493677*0.493677;
832 if((1-(4*m2)/s)>0){
833 rhoijx = sqrt(1.0f - (4*m2)/s);
834 rhoijy = 0;
835 }else{
836 rhoijy = sqrt((4*m2)/s - 1.0f);
837 rhoijx = 0;
838 }
839 }
840 if(i==j && i==2){
841 rhoijx = rho22(s);
842 rhoijy = 0;
843 }
844 if(i==j && i==3){
845 double m2 = 0.547862*0.547862;
846 if((1-(4*m2)/s)>0){
847 rhoijx = sqrt(1.0f - (4*m2)/s);
848 rhoijy = 0;
849 }else{
850 rhoijy = sqrt((4*m2)/s - 1.0f);
851 rhoijx = 0;
852 }
853 }
854 if(i==j && i==4){
855 double m_1 = 0.547862;
856 double m_2 = 0.95778;
857 double mp2 = (m_1+m_2)*(m_1+m_2);
858 double mm2 = (m_1-m_2)*(m_1-m_2);
859 if((1-mp2/s)>0){
860 rhoijx = sqrt(1.0f - mp2/s);
861 rhoijy = 0;
862 }else{
863 rhoijy = sqrt(mp2/s - 1.0f);
864 rhoijx = 0;
865 }
866 }
867
868 if(i!=j){
869 rhoijx = 0;
870 rhoijy = 0;
871 }
872 complex<double> rhoij(rhoijx,rhoijy);
873 return rhoij;
874
875}
876/* Kij = (sum_a gigj/(ma^2-s) + fij(1-s0)/(s-s0))((s-0.5sampi2)(1-sa0)/(s-sa0)) */
877complex<double> EvtD0ToKKpi0::KMTX(int i, int j, double s){
878
879 double Kijx;
880 double Kijy;
881 double mpi = 0.13957;
882 double m[5] = { 0.65100, 1.20360, 1.55817, 1.21000, 1.82206};
883
884 double g1[5] = { 0.22889,-0.55377, 0.00000,-0.39899,-0.34639};
885 double g2[5] = { 0.94128, 0.55095, 0.00000, 0.39065, 0.31503};
886 double g3[5] = { 0.36856, 0.23888, 0.55639, 0.18340, 0.18681};
887 double g4[5] = { 0.33650, 0.40907, 0.85679, 0.19906,-0.00984};
888 double g5[5] = { 0.18171,-0.17558,-0.79658,-0.00355, 0.22358};
889
890 double f1[5] = { 0.23399, 0.15044,-0.20545, 0.32825, 0.35412};
891
892 double eps = 1e-11;
893
894 double down[5] = { 0,0,0,0,0};
895 double upreal[5] = { 0,0,0,0,0};
896 double upimag[5] = { 0,0,0,0,0};
897
898 for(int k=0; k<5; k++){
899
900 /* down[k] = (m[k]*m[k]-s)*(m[k]*m[k]-s)+eps*eps;
901 upreal[k] = (m[k]*m[k]-s)/down[k];
902 upimag[k] = -1.0f * eps/down[k]; */
903
904 double dm2 = m[k]*m[k]-s;
905 if(fabs(dm2)<eps && dm2<=0) dm2 = -eps;
906 if(fabs(dm2)<eps && dm2>0) dm2 = eps;
907 upreal[k] = 1.0f/dm2;
908 upimag[k] = 0;
909 }
910
911 double tmp1x = g1[i]*g1[j]*upreal[0] + g2[i]*g2[j]*upreal[1] + g3[i]*g3[j]*upreal[2] + g4[i]*g4[j]*upreal[3] + g5[i]*g5[j]*upreal[4];
912 double tmp1y = g1[i]*g1[j]*upimag[0] + g2[i]*g2[j]*upimag[1] + g3[i]*g3[j]*upimag[2] + g4[i]*g4[j]*upimag[3] + g5[i]*g5[j]*upimag[4];
913
914 double tmp2 = 0;
915 if(i==0){
916 tmp2 = f1[j]*(1+3.92637)/(s+3.92637);
917 }
918 if(j==0){
919 tmp2 = f1[i]*(1+3.92637)/(s+3.92637);
920 }
921 double tmp3 = (s-0.5*mpi*mpi)*(1+0.15)/(s+0.15);
922
923 Kijx = (tmp1x+tmp2)*tmp3;
924 Kijy = (tmp1y)*tmp3;
925
926 complex<double> Kij(Kijx,Kijy);
927 return Kij;
928}
929
930complex<double> EvtD0ToKKpi0::IMTX(int i, int j){
931
932 double Iijx;
933 double Iijy;
934 if(i==j){
935 Iijx = 1;
936 Iijy = 0;
937 }else{
938 Iijx = 0;
939 Iijy = 0;
940 }
941 complex<double> Iij(Iijx,Iijy);
942 return Iij;
943
944}
945
946/* F = I - i*K*rho */
947complex<double> EvtD0ToKKpi0::FMTX(double Kijx, double Kijy, double rhojjx, double rhojjy, int i, int j){
948
949 double Fijx;
950 double Fijy;
951
952 double tmpx = rhojjx*Kijx - rhojjy*Kijy;
953 double tmpy = rhojjx*Kijy + rhojjy*Kijx;
954
955 Fijx = IMTX(i,j).real() + tmpy;
956 Fijy = -tmpx;
957
958 complex<double> Fij(Fijx,Fijy);
959 return Fij;
960}
961
962/* inverse for Matrix (I - i*rho*K) using LUP */
963double EvtD0ToKKpi0::FINVMTX(double s, double *FINVx, double *FINVy){
964
965 int P[5] = { 0,1,2,3,4};
966
967 double Fx[5][5];
968 double Fy[5][5];
969
970 double Ux[5][5];
971 double Uy[5][5];
972 double Lx[5][5];
973 double Ly[5][5];
974
975 double UIx[5][5];
976 double UIy[5][5];
977 double LIx[5][5];
978 double LIy[5][5];
979
980 for(int k=0; k<5; k++){
981 double rhokkx = rhoMTX(k,k,s).real();
982 double rhokky = rhoMTX(k,k,s).imag();
983 Ux[k][k] = rhokkx;
984 Uy[k][k] = rhokky;
985 for(int l=k; l<5; l++){
986 double Kklx = KMTX(k,l,s).real();
987 double Kkly = KMTX(k,l,s).imag();
988 Lx[k][l] = Kklx;
989 Ly[k][l] = Kkly;
990 Lx[l][k] = Lx[k][l];
991 Ly[l][k] = Ly[k][l];
992 }
993 }
994
995 for(int k=0; k<5; k++){
996 for(int l=0; l<5; l++){
997 double Fklx = FMTX(Lx[k][l],Ly[k][l],Ux[l][l],Uy[l][l],k,l).real();
998 double Fkly = FMTX(Lx[k][l],Ly[k][l],Ux[l][l],Uy[l][l],k,l).imag();
999 Fx[k][l] = Fklx;
1000 Fy[k][l] = Fkly;
1001 }
1002 }
1003
1004 for(int k=0; k<5; k++){
1005 double tmprM = (Fx[k][k]*Fx[k][k]+Fy[k][k]*Fy[k][k]);
1006 int tmpID = 0;
1007 for(int l=k; l<5; l++){
1008 double tmprF = (Fx[l][k]*Fx[l][k]+Fy[l][k]*Fy[l][k]);
1009 if(tmprM<=tmprF){
1010 tmprM = tmprF;
1011 tmpID = l;
1012 }
1013 }
1014
1015 int tmpP = P[k];
1016 P[k] = P[tmpID];
1017 P[tmpID] = tmpP;
1018
1019 for(int l=0; l<5; l++){
1020
1021 double tmpFx = Fx[k][l];
1022 double tmpFy = Fy[k][l];
1023
1024 Fx[k][l] = Fx[tmpID][l];
1025 Fy[k][l] = Fy[tmpID][l];
1026
1027 Fx[tmpID][l] = tmpFx;
1028 Fy[tmpID][l] = tmpFy;
1029
1030 }
1031
1032 for(int l=k+1; l<5; l++){
1033 double rFkk = Fx[k][k]*Fx[k][k] + Fy[k][k]*Fy[k][k];
1034 double Fxlk = Fx[l][k];
1035 double Fylk = Fy[l][k];
1036 double Fxkk = Fx[k][k];
1037 double Fykk = Fy[k][k];
1038 Fx[l][k] = (Fxlk*Fxkk + Fylk*Fykk)/rFkk;
1039 Fy[l][k] = (Fylk*Fxkk - Fxlk*Fykk)/rFkk;
1040 for(int m=k+1; m<5; m++){
1041 Fx[l][m] = Fx[l][m] - (Fx[l][k]*Fx[k][m] - Fy[l][k]*Fy[k][m]);
1042 Fy[l][m] = Fy[l][m] - (Fx[l][k]*Fy[k][m] + Fy[l][k]*Fx[k][m]);
1043 }
1044 }
1045 }
1046
1047 for(int k=0; k<5; k++){
1048 for(int l=0; l<5 ;l++){
1049 if(k==l){
1050 Lx[k][k] = 1;
1051 Ly[k][k] = 0;
1052 Ux[k][k] = Fx[k][k];
1053 Uy[k][k] = Fy[k][k];
1054 }
1055 if(k>l){
1056 Lx[k][l] = Fx[k][l];
1057 Ly[k][l] = Fy[k][l];
1058 Ux[k][l] = 0;
1059 Uy[k][l] = 0;
1060 }
1061 if(k<l){
1062 Ux[k][l] = Fx[k][l];
1063 Uy[k][l] = Fy[k][l];
1064 Lx[k][l] = 0;
1065 Ly[k][l] = 0;
1066 }
1067 }
1068 }
1069
1070 // calculate Inverse for L and U
1071 for(int k=0; k<5; k++){
1072
1073 LIx[k][k] = 1;
1074 LIy[k][k] = 0;
1075
1076 double rUkk = Ux[k][k]*Ux[k][k] + Uy[k][k]*Uy[k][k];
1077 UIx[k][k] = Ux[k][k]/rUkk;
1078 UIy[k][k] = -1.0f * Uy[k][k]/rUkk ;
1079
1080 for(int l=(k+1); l<5; l++){
1081 LIx[k][l] = 0;
1082 LIy[k][l] = 0;
1083 UIx[l][k] = 0;
1084 UIy[l][k] = 0;
1085 }
1086
1087 for(int l=(k-1); l>=0; l--){ // U-1
1088 double sx = 0;
1089 double c_sx = 0;
1090 double sy = 0;
1091 double c_sy = 0;
1092 for(int m=l+1; m<=k; m++){
1093 sx = sx - c_sx;
1094 double sx_tmp = sx + Ux[l][m]*UIx[m][k] - Uy[l][m]*UIy[m][k];
1095 c_sx = (sx_tmp - sx) - (Ux[l][m]*UIx[m][k] - Uy[l][m]*UIy[m][k]);
1096 sx = sx_tmp;
1097
1098 sy = sy - c_sy;
1099 double sy_tmp = sy + Ux[l][m]*UIy[m][k] + Uy[l][m]*UIx[m][k];
1100 c_sy = (sy_tmp - sy) - (Ux[l][m]*UIy[m][k] + Uy[l][m]*UIx[m][k]);
1101 sy = sy_tmp;
1102 }
1103 UIx[l][k] = -1.0f * (UIx[l][l]*sx - UIy[l][l]*sy);
1104 UIy[l][k] = -1.0f * (UIy[l][l]*sx + UIx[l][l]*sy);
1105 }
1106
1107 for(int l=k+1; l<5; l++){ // L-1
1108 double sx = 0;
1109 double c_sx = 0;
1110 double sy = 0;
1111 double c_sy = 0;
1112 for(int m=k; m<l; m++){
1113 sx = sx - c_sx;
1114 double sx_tmp = sx + Lx[l][m]*LIx[m][k] - Ly[l][m]*LIy[m][k];
1115 c_sx = (sx_tmp - sx) - (Lx[l][m]*LIx[m][k] - Ly[l][m]*LIy[m][k]);
1116 sx = sx_tmp;
1117
1118 sy = sy - c_sy;
1119 double sy_tmp = sy + Lx[l][m]*LIy[m][k] + Ly[l][m]*LIx[m][k];
1120 c_sy = (sy_tmp - sy) - (Lx[l][m]*LIy[m][k] + Ly[l][m]*LIx[m][k]);
1121 sy = sy_tmp;
1122 }
1123 LIx[l][k] = -1.0f * sx;
1124 LIy[l][k] = -1.0f * sy;
1125 }
1126 }
1127
1128 for(int m=0; m<5; m++){
1129 double resX = 0;
1130 double c_resX = 0;
1131 double resY = 0;
1132 double c_resY = 0;
1133 for(int k=0; k<5; k++){
1134 for(int l=0; l<5; l++){
1135 double Plm = 0;
1136 if(P[l] == m) Plm = 1;
1137
1138 resX = resX - c_resX;
1139 double resX_tmp = resX + (UIx[0][k]*LIx[k][l] - UIy[0][k]*LIy[k][l])*Plm;
1140 c_resX = (resX_tmp - resX) - ((UIx[0][k]*LIx[k][l] - UIy[0][k]*LIy[k][l])*Plm);
1141 resX = resX_tmp;
1142
1143 resY = resY - c_resY;
1144 double resY_tmp = resY + (UIx[0][k]*LIy[k][l] + UIy[0][k]*LIx[k][l])*Plm;
1145 c_resY = (resY_tmp - resY) - ((UIx[0][k]*LIy[k][l] + UIy[0][k]*LIx[k][l])*Plm);
1146 resY = resY_tmp;
1147 }
1148 }
1149 FINVx[m] = resX;
1150 FINVy[m] = resY;
1151 }
1152
1153 return 1.0f;
1154
1155}
1156
1157complex<double> EvtD0ToKKpi0::PVTR(int ID, double s){
1158
1159 double VPix;
1160 double VPiy;
1161 double m[5] = { 0.65100, 1.20360, 1.55817, 1.21000, 1.82206};
1162
1163 double eps = 1e-11;
1164
1165 /* double down = (m[ID]*m[ID]-s)*(m[ID]*m[ID]-s)+eps*eps;
1166 double upreal = (m[ID]*m[ID]-s)/down;
1167 double upimag = -1.0f * eps/down; */
1168
1169 double dm2 = m[ID]*m[ID]-s;
1170
1171 if(fabs(dm2)<eps && dm2<=0) dm2 = -eps;
1172 if(fabs(dm2)<eps && dm2>0) dm2 = eps;
1173
1174 VPix = 1.0f/dm2;
1175 VPiy = 0;
1176
1177 complex<double> VPi(VPix,VPiy);
1178 return VPi;
1179}
1180
1181complex<double> EvtD0ToKKpi0::Fvector(double sa, double s0, int l){
1182
1183 double outputx = 0;
1184 double outputy = 0;
1185
1186 double FINVx[5] = {0,0,0,0,0};
1187 double FINVy[5] = {0,0,0,0,0};
1188
1189 double tmpFLAG = FINVMTX(sa,FINVx,FINVy);
1190
1191 if(l<5){
1192 double g[5][5] = {{ 0.22889,-0.55377, 0.00000,-0.39899,-0.34639},
1193 { 0.94128, 0.55095, 0.00000, 0.39065, 0.31503},
1194 { 0.36856, 0.23888, 0.55639, 0.18340, 0.18681},
1195 { 0.33650, 0.40907, 0.85679, 0.19906,-0.00984},
1196 { 0.18171,-0.17558,-0.79658,-0.00355, 0.22358}};
1197 double resx = 0;
1198 double c_resx = 0;
1199 double resy = 0;
1200 double c_resy = 0;
1201 double Plx = PVTR(l,sa).real();
1202 double Ply = PVTR(l,sa).imag();
1203 for(int j=0; j<5; j++){
1204 resx = resx - c_resx;
1205 double resx_tmp = resx + (FINVx[j]*g[l][j]*Plx - FINVy[j]*g[l][j]*Ply);
1206 c_resx = (resx_tmp - resx) - (FINVx[j]*g[l][j]*Plx - FINVy[j]*g[l][j]*Ply);
1207 resx = resx_tmp;
1208
1209 resy = resy - c_resy;
1210 double resy_tmp = resy + (FINVx[j]*g[l][j]*Ply + FINVy[j]*g[l][j]*Plx);
1211 c_resy = (resy_tmp - resy) - (FINVx[j]*g[l][j]*Ply + FINVy[j]*g[l][j]*Plx);
1212 resy = resy_tmp;
1213 }
1214 outputx = resx;
1215 outputy = resy;
1216 }else{
1217 int idx = l-5;
1218 double eps = 1e-11;
1219 double ds = sa-s0;
1220 if(fabs(ds)<eps && ds<=0) ds = -eps;
1221 if(fabs(ds)<eps && ds>0) ds = eps;
1222 double tmp = (1-s0)/ds;
1223 outputx = FINVx[idx]*tmp;
1224 outputy = FINVy[idx]*tmp;
1225 }
1226
1227 complex<double> output(outputx,outputy);
1228 return output;
1229}
1230
1231complex<double> EvtD0ToKKpi0::CalD0Amp(){
1232 return Amp(p4_Kap, p4_Kam, p4_Pi0);
1233}
1234complex<double> EvtD0ToKKpi0::CalDbAmp(){
1235
1236 vector<double> cpKap; cpKap.clear();
1237 vector<double> cpKam; cpKam.clear();
1238 vector<double> cpPi0; cpPi0.clear();
1239
1240 cpKap.push_back(-p4_Kam[0]); cpKam.push_back(-p4_Kap[0]); cpPi0.push_back(-p4_Pi0[0]);
1241 cpKap.push_back(-p4_Kam[1]); cpKam.push_back(-p4_Kap[1]); cpPi0.push_back(-p4_Pi0[1]);
1242 cpKap.push_back(-p4_Kam[2]); cpKam.push_back(-p4_Kap[2]); cpPi0.push_back(-p4_Pi0[2]);
1243 cpKap.push_back( p4_Kam[3]); cpKam.push_back( p4_Kap[3]); cpPi0.push_back( p4_Pi0[3]);
1244
1245 return (-1.0)*Amp(cpKap, cpKam, cpPi0);
1246
1247}
1248
1249complex<double> EvtD0ToKKpi0::Amp(vector<double> Kap, vector<double> Kam, vector<double> Pi0)
1250{
1251
1252 if(fitpara.size()!=5) {
1253 cout<<"Error!!! number of para: "<<fitpara.size()<<endl;
1254 exit(0);
1255 }
1256
1257 vector<double> KapKam; KapKam.clear();
1258 vector<double> KapPi0; KapPi0.clear();
1259 vector<double> KamPi0; KamPi0.clear();
1260
1261 KapKam = sum_tensor(Kap, Kam);
1262 KapPi0 = sum_tensor(Kap, Pi0);
1263 KamPi0 = sum_tensor(Kam, Pi0);
1264
1265 vector<double> D0; D0.clear();
1266 D0 = sum_tensor(KapKam, Pi0);
1267
1268 double M2_KapKam = contract_11_0(KapKam, KapKam);
1269 double M2_KapPi0 = contract_11_0(KapPi0, KapPi0);
1270 double M2_KamPi0 = contract_11_0(KamPi0, KamPi0);
1271
1272 double M2_D0 = contract_11_0(D0, D0);
1273
1274 complex<double> RBW_Kst892_p = RBW(M2_KapPi0, m0_Kst892, w0_Kst892, m2_Ka, m2_Pi0, rRes, 1);
1275 complex<double> RBW_Kst892_m = RBW(M2_KamPi0, m0_Kst892, w0_Kst892, m2_Ka, m2_Pi0, rRes, 1);
1276 complex<double> RBW_Kst1410_m = RBW(M2_KamPi0, m0_Kst1410, w0_Kst1410, m2_Ka, m2_Pi0, rRes, 1);
1277
1278 complex<double> RBW_phi1020 = RBW(M2_KapKam, m0_phi1020, w0_phi1020,-1, -1,-1,-1);
1279
1280 complex<double> KpPi0S_Lass = KPiSLass(M2_KapPi0, m0_K01430, w0_K01430, a_lass, r_lass, 0.187955, 1.82603, -0.10329550);
1281 complex<double> FT_f0980 = Flatte(M2_KapKam, m0_f0980, g1_f0980, g2_f0980, m_Pi, m_Pi, m_Ka, m_Ka);
1282
1283 // X->PP Orbital
1284 vector<double> T1_KapKam; T1_KapKam.clear();
1285 vector<double> T1_KapPi0; T1_KapPi0.clear();
1286 vector<double> T1_KamPi0; T1_KamPi0.clear();
1287
1288 T1_KapKam = OrbitalTensors(KapKam, Kap, Kam, rRes, 1);
1289 T1_KapPi0 = OrbitalTensors(KapPi0, Kap, Pi0, rRes, 1);
1290 T1_KamPi0 = OrbitalTensors(KamPi0, Kam, Pi0, rRes, 1);
1291
1292 vector<double> T2_KapKam; T2_KapKam.clear();
1293
1294 T2_KapKam = OrbitalTensors(KapKam, Kap, Kam, rRes, 2);
1295
1296 // D->XP Orbital
1297 vector<double> T1_KapKamPi0; T1_KapKamPi0.clear();
1298 vector<double> T1_KapPi0Kam; T1_KapPi0Kam.clear();
1299 vector<double> T1_KamPi0Kap; T1_KamPi0Kap.clear();
1300
1301 T1_KapKamPi0 = OrbitalTensors(D0, KapKam, Pi0, rD, 1);
1302 T1_KapPi0Kam = OrbitalTensors(D0, KapPi0, Kam, rD, 1);
1303 T1_KamPi0Kap = OrbitalTensors(D0, KamPi0, Kap, rD, 1);
1304
1305 vector<double> T2_KapKamPi0; T2_KapKamPi0.clear();
1306
1307 T2_KapKamPi0 = OrbitalTensors(D0, KapKam, Pi0, rD, 2);
1308
1309 complex<double> amplitude(0,0);
1310
1311
1312 // D-> VP
1313 double SF_VpPm = contract_11_0(T1_KapPi0Kam, T1_KapPi0);
1314 amplitude += fitpara[0]*(SF_VpPm*RBW_Kst892_p);
1315
1316 double SF_VmPp = contract_11_0(T1_KamPi0Kap, T1_KamPi0);
1317 amplitude += fitpara[1]*(SF_VmPp*RBW_Kst892_m);
1318
1319 double SF_VzPz = contract_11_0(T1_KapKamPi0, T1_KapKam);
1320 amplitude += fitpara[2]*(SF_VzPz*RBW_phi1020);
1321
1322 amplitude += fitpara[3]*(SF_VmPp*RBW_Kst1410_m);
1323
1324 // D-> SP
1325 amplitude += fitpara[4]*KpPi0S_Lass;
1326
1327
1328 return amplitude;
1329
1330}
1331
1332int EvtD0ToKKpi0::CalAmp()
1333{
1334 m_AmpD0 = CalD0Amp();
1335 m_AmpDb = CalDbAmp();
1336 return 0;
1337}
1338
1339double EvtD0ToKKpi0::mag2(complex<double> x)
1340{
1341 double temp = x.real()*x.real() + x.imag()*x.imag();
1342 return temp;
1343}
1344
1345double EvtD0ToKKpi0::mag2_itf(complex<double> x, complex<double> y)
1346{
1347 double temp = 2*(x.real()*y.real() + x.imag()*y.imag());
1348 return temp;
1349}
1350
1351double EvtD0ToKKpi0::arg(complex<double> x)
1352{
1353 double temp = atan(x.imag()/x.real());
1354 if(x.real()<0) temp=temp+PI;
1355 return temp;
1356}
1357double EvtD0ToKKpi0::Get_strongPhase()
1358{
1359 double temp = arg(m_AmpD0) - arg(m_AmpDb);
1360 while (temp < -PI){
1361 temp += 2.0*PI;
1362 }
1363 while (temp > PI){
1364 temp -= 2.0*PI;
1365 }
1366 return temp;
1367}
1368
1369double EvtD0ToKKpi0::AmplitudeSquare(int charm, int tagmode){
1370
1371 EvtVector4R dp1=GetDaugMomLab(0),dp2=GetDaugMomLab(1),dp3=GetDaugMomLab(2); // D0 -> K+ K- pi0
1372 EvtVector4R mp = dp1 + dp2 + dp3;
1373
1374 double emp = mp.get(0);
1375 EvtVector3R boostp3(-mp.get(1)/emp, -mp.get(2)/emp, -mp.get(3)/emp);
1376
1377 EvtVector4R dp1bst = boostTo(dp1, boostp3);
1378 EvtVector4R dp2bst = boostTo(dp2, boostp3);
1379 EvtVector4R dp3bst = boostTo(dp3, boostp3);
1380
1381 double p4kp[4], p4km[4], p4pi0[4];
1382 for(int i=0; i<3; i++){
1383 p4kp[i] =dp1bst.get(i+1);
1384 p4km[i] =dp2bst.get(i+1);
1385 p4pi0[i]=dp3bst.get(i+1);
1386 }
1387
1388 p4kp[3] =dp1bst.get(0);
1389 p4km[3] =dp2bst.get(0);
1390 p4pi0[3]=dp3bst.get(0);
1391
1392 setInput(p4kp, p4km, p4pi0);
1393 CalAmp();
1394
1395 complex<double> ampD0, ampDb;
1396 if(charm>0){
1397 ampD0 = Get_AmpD0();
1398 ampDb = Get_AmpDb();
1399 }else{
1400 ampD0 = Get_AmpDb();
1401 ampDb = Get_AmpD0();
1402 }
1403
1404 double ampsq = 1e-20;
1405 double r_tag = 0, R_tag = 0, delta_tag = 0;
1406
1407 if (tagmode==1||tagmode==2||tagmode==3) {
1408 if(tagmode == 1){// Kpi
1409 r_tag = 0.0586;
1410 R_tag = 1;
1411 delta_tag = 192.1/180.0*3.1415926;
1412 }else if(tagmode == 2){// Kpipi0
1413 r_tag = 0.0441;
1414 R_tag = 0.79;
1415 delta_tag = 196.0/180.0*3.1415926;
1416 }else if(tagmode == 3){// K3pi
1417 r_tag = 0.0550;
1418 R_tag = 0.44;
1419 delta_tag = 161.0/180.0*3.1415926;
1420 }
1421 complex<double> qcf(r_tag*R_tag*cos(-delta_tag), r_tag*R_tag*sin(-delta_tag));
1422 complex<double> ampD0_part1 = ampD0 - qcf*ampDb;
1423 ampsq = mag2(ampD0_part1) + r_tag*r_tag*(1-R_tag*R_tag)*(mag2(ampDb));
1424 } else {
1425 ampsq = mag2(ampD0);
1426 }
1427
1428 return (ampsq <= 0) ? 1e-20 : ampsq;
1429}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
double P(RecMdcKalTrack *trk)
double mass
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
TFile * f1
TF1 * g1
Double_t x[10]
int ID[no]
#define PI
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
EvtTensor3C eps(const EvtVector3R &v)
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in output
Definition FoamA.h:89
const double mpi
Definition Gam4pikp.cxx:47
XmlRpcServer s
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition KKsem.h:33
TTree * t
Definition binning.cxx:23
void decay(EvtParticle *p)
void getName(std::string &name)
virtual ~EvtD0ToKKpi0()
EvtDecayBase * clone()
double getArg(int j)
void setProbMax(double prbmx)
void checkNDaug(int d1, int d2=-1)
EvtId * getDaugs()
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
void setProb(double prob)
EvtVector4R getP4Lab()
const EvtVector4R & getP4() const
EvtParticle * getDaug(int i)
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
double get(int i) const
double y[1000]
const double mp
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)
Definition TUtil.h:27
double double * m2
Definition qcdloop1.h:75