BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtEvalHelAmp.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 2000 Caltech, UCSB
10//
11// Module: EvtHelAmp.cc
12//
13// Description: Decay model for implementation of generic 2 body
14// decay specified by the partial wave amplitudes
15//
16//
17// Modification history:
18//
19// fkw February 2, 2001 changes to satisfy KCC
20// RYD September 7, 2000 Module created
21// Ping RG Apr. 15,2007 change to helicity angle(@Line=210) for sequential decays
22//------------------------------------------------------------------------
23//
25#include <stdlib.h>
27#include "EvtGenBase/EvtPDL.hh"
31#include "EvtGenBase/EvtId.hh"
34#include "EvtGenBase/EvtAmp.hh"
36
37using std::endl;
38
39
41
42 //allocate memory
43 delete [] _lambdaA2;
44 delete [] _lambdaB2;
45 delete [] _lambdaC2;
46
47 int ia,ib,ic;
48 for(ib=0;ib<_nB;ib++){
49 delete [] _HBC[ib];
50 }
51
52 delete [] _HBC;
53
54
55 for(ia=0;ia<_nA;ia++){
56 delete [] _RA[ia];
57 }
58 delete [] _RA;
59
60 for(ib=0;ib<_nB;ib++){
61 delete [] _RB[ib];
62 }
63 delete [] _RB;
64
65 for(ic=0;ic<_nC;ic++){
66 delete [] _RC[ic];
67 }
68 delete [] _RC;
69
70
71 for(ia=0;ia<_nA;ia++){
72 for(ib=0;ib<_nB;ib++){
73 delete [] _amp[ia][ib];
74 delete [] _amp1[ia][ib];
75 delete [] _amp3[ia][ib];
76 }
77 delete [] _amp[ia];
78 delete [] _amp1[ia];
79 delete [] _amp3[ia];
80 }
81
82 delete [] _amp;
83 delete [] _amp1;
84 delete [] _amp3;
85
86}
87
88
93
94 //find out how many states each particle have
98
99 //find out what 2 times the spin is
100 _JA2=EvtSpinType::getSpin2(typeA);
101 _JB2=EvtSpinType::getSpin2(typeB);
102 _JC2=EvtSpinType::getSpin2(typeC);
103
104
105 //allocate memory
106 _lambdaA2=new int[_nA];
107 _lambdaB2=new int[_nB];
108 _lambdaC2=new int[_nC];
109
110 _HBC=new EvtComplexPtr[_nB];
111 int ia,ib,ic;
112 for(ib=0;ib<_nB;ib++){
113 _HBC[ib]=new EvtComplex[_nC];
114 }
115
116
117 _RA=new EvtComplexPtr[_nA];
118 for(ia=0;ia<_nA;ia++){
119 _RA[ia]=new EvtComplex[_nA];
120 }
121 _RB=new EvtComplexPtr[_nB];
122 for(ib=0;ib<_nB;ib++){
123 _RB[ib]=new EvtComplex[_nB];
124 }
125 _RC=new EvtComplexPtr[_nC];
126 for(ic=0;ic<_nC;ic++){
127 _RC[ic]=new EvtComplex[_nC];
128 }
129
130 _amp=new EvtComplexPtrPtr[_nA];
131 _amp1=new EvtComplexPtrPtr[_nA];
132 _amp3=new EvtComplexPtrPtr[_nA];
133 for(ia=0;ia<_nA;ia++){
134 _amp[ia]=new EvtComplexPtr[_nB];
135 _amp1[ia]=new EvtComplexPtr[_nB];
136 _amp3[ia]=new EvtComplexPtr[_nB];
137 for(ib=0;ib<_nB;ib++){
138 _amp[ia][ib]=new EvtComplex[_nC];
139 _amp1[ia][ib]=new EvtComplex[_nC];
140 _amp3[ia][ib]=new EvtComplex[_nC];
141 }
142 }
143
144 //find the allowed helicities (actually 2*times the helicity!)
145
146 fillHelicity(_lambdaA2,_nA,_JA2);
147 fillHelicity(_lambdaB2,_nB,_JB2);
148 fillHelicity(_lambdaC2,_nC,_JC2);
149
150 for(ib=0;ib<_nB;ib++){
151 for(ic=0;ic<_nC;ic++){
152 _HBC[ib][ic]=HBC[ib][ic];
153 }
154 }
155}
156
157
158
159
160
161
163
164 double c=1.0/sqrt(4*EvtConst::pi/(_JA2+1));
165
166 int ia,ib,ic;
167
168
169 double theta;
170 int itheta;
171
172 double maxprob=0.0;
173
174 for(itheta=-10;itheta<=10;itheta++){
175 theta=acos(0.099999*itheta);
176 for(ia=0;ia<_nA;ia++){
177 double prob=0.0;
178 for(ib=0;ib<_nB;ib++){
179 for(ic=0;ic<_nC;ic++){
180 _amp[ia][ib][ic]=0.0;
181 if (abs(_lambdaB2[ib]-_lambdaC2[ic])<=_JA2) {
182 _amp[ia][ib][ic]=c*_HBC[ib][ic]*
183 EvtdFunction::d(_JA2,_lambdaA2[ia],
184 _lambdaB2[ib]-_lambdaC2[ic],theta);
185 prob+=real(_amp[ia][ib][ic]*conj(_amp[ia][ib][ic]));
186 }
187 }
188 }
189
190 prob*=sqrt(1.0*_nA);
191
192 if (prob>maxprob) maxprob=prob;
193
194 }
195 }
196
197 return maxprob;
198
199}
200
201
203
204 //find theta and phi of the first daughter
205
206 EvtVector4R pB=p->getDaug(0)->getP4();
207 EvtVector4R pC=p->getDaug(1)->getP4();
208 EvtVector4R pP=pB+pC;
209
210 EvtHelSys angles(pP,pB);
211 double theta=angles.getHelAng(1);
212 double phi =angles.getHelAng(2);
213// double theta=acos(pB.get(3)/pB.d3mag()); //pingrg ,2007,4,15
214// double phi=atan2(pB.get(2),pB.get(1));
215
216 double c=sqrt((_JA2+1)/(4*EvtConst::pi));
217
218 int ia,ib,ic;
219
220 double prob1=0.0;
221
222 for(ia=0;ia<_nA;ia++){
223 for(ib=0;ib<_nB;ib++){
224 for(ic=0;ic<_nC;ic++){
225 _amp[ia][ib][ic]=0.0;
226 if (abs(_lambdaB2[ib]-_lambdaC2[ic])<=_JA2) {
227 double dfun=EvtdFunction::d(_JA2,_lambdaA2[ia],
228 _lambdaB2[ib]-_lambdaC2[ic],theta);
229
230 _amp[ia][ib][ic]=c*_HBC[ib][ic]*
231 exp(EvtComplex(0.0,phi*0.5*(_lambdaA2[ia]-_lambdaB2[ib]+
232 _lambdaC2[ic])))*dfun;
233 }
234 prob1+=real(_amp[ia][ib][ic]*conj(_amp[ia][ib][ic]));
235 }
236 }
237 }
238
239 setUpRotationMatrices(p,theta,phi);
240
241 applyRotationMatrices();
242
243 double prob2=0.0;
244
245 for(ia=0;ia<_nA;ia++){
246 for(ib=0;ib<_nB;ib++){
247 for(ic=0;ic<_nC;ic++){
248 prob2+=real(_amp[ia][ib][ic]*conj(_amp[ia][ib][ic]));
249 if (_nA==1){
250 if (_nB==1){
251 if (_nC==1){
252 amp.vertex(_amp[ia][ib][ic]);
253 }
254 else{
255 amp.vertex(ic,_amp[ia][ib][ic]);
256 }
257 }
258 else{
259 if (_nC==1){
260 amp.vertex(ib,_amp[ia][ib][ic]);
261 }
262 else{
263 amp.vertex(ib,ic,_amp[ia][ib][ic]);
264 //report(INFO,"EvtGen") << "ib,ic:"<<ib<<" "<<ic<<" "<<_amp[ia][ib][ic]<<endl;
265 }
266 }
267 }else{
268 if (_nB==1){
269 if (_nC==1){
270 amp.vertex(ia,_amp[ia][ib][ic]);
271 }
272 else{
273 amp.vertex(ia,ic,_amp[ia][ib][ic]);
274 }
275 }
276 else{
277 if (_nC==1){
278 amp.vertex(ia,ib,_amp[ia][ib][ic]);
279 }
280 else{
281 amp.vertex(ia,ib,ic,_amp[ia][ib][ic]);
282 }
283 }
284 }
285 }
286 }
287 }
288
289 if (fabs(prob1-prob2)>0.000001*prob1){
290 report(INFO,"EvtGen") << "prob1,prob2:"<<prob1<<" "<<prob2<<endl;
291 ::abort();
292 }
293
294 return ;
295
296}
297
298
299void EvtEvalHelAmp::fillHelicity(int* lambda2,int n,int J2){
300
301 int i;
302
303 //photon is special case!
304 if (n==2&&J2==2) {
305 lambda2[0]=2;
306 lambda2[1]=-2;
307 return;
308 }
309
310 assert(n==J2+1);
311
312 for(i=0;i<n;i++){
313 lambda2[i]=n-i*2-1;
314 }
315
316 return;
317
318}
319
320
321void EvtEvalHelAmp::setUpRotationMatrices(EvtParticle* p,double theta, double phi){
322
323 switch(_JA2){
324
325 case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
326
327 {
328
330
331
332 int i,j,n;
333
334 n=R.GetDim();
335
336 assert(n==_nA);
337
338
339 for(i=0;i<n;i++){
340 for(j=0;j<n;j++){
341 _RA[i][j]=R.Get(i,j);
342 }
343 }
344
345 }
346
347 break;
348
349 default:
350 report(ERROR,"EvtGen") << "Spin2(_JA2)="<<_JA2<<" not supported!"<<endl;
351 ::abort();
352 }
353
354
355 switch(_JB2){
356
357
358 case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
359
360 {
361
362 int i,j,n;
363
364 EvtSpinDensity R=p->getDaug(0)->rotateToHelicityBasis(phi,theta,-phi);
365
366 n=R.GetDim();
367
368 assert(n==_nB);
369
370 //report(INFO,"EvtGen") << "RB:"<< R <<endl;
371
372 for(i=0;i<n;i++){
373 for(j=0;j<n;j++){
374 _RB[i][j]=conj(R.Get(i,j));
375 }
376 }
377
378 }
379
380 break;
381
382 default:
383 report(ERROR,"EvtGen") << "Spin2(_JB2)="<<_JB2<<" not supported!"<<endl;
384 ::abort();
385 }
386
387 switch(_JC2){
388
389 case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
390
391 {
392
393 int i,j,n;
394
396
397 n=R.GetDim();
398
399 //report(INFO,"EvtGen") << "RC:"<< R <<endl;
400
401 assert(n==_nC);
402
403 for(i=0;i<n;i++){
404 for(j=0;j<n;j++){
405 _RC[i][j]=conj(R.Get(i,j));
406 }
407 }
408
409 }
410
411 break;
412
413 default:
414 report(ERROR,"EvtGen") << "Spin2(_JC2)="<<_JC2<<" not supported!"<<endl;
415 ::abort();
416 }
417
418
419
420}
421
422
423void EvtEvalHelAmp::applyRotationMatrices(){
424
425 int ia,ib,ic,i;
426
427 EvtComplex temp;
428
429
430
431 for(ia=0;ia<_nA;ia++){
432 for(ib=0;ib<_nB;ib++){
433 for(ic=0;ic<_nC;ic++){
434 temp=0;
435 for(i=0;i<_nC;i++){
436 temp+=_RC[i][ic]*_amp[ia][ib][i];
437 }
438 _amp1[ia][ib][ic]=temp;
439 }
440 }
441 }
442
443
444
445 for(ia=0;ia<_nA;ia++){
446 for(ic=0;ic<_nC;ic++){
447 for(ib=0;ib<_nB;ib++){
448 temp=0;
449 for(i=0;i<_nB;i++){
450 temp+=_RB[i][ib]*_amp1[ia][i][ic];
451 }
452 _amp3[ia][ib][ic]=temp;
453 }
454 }
455 }
456
457
458
459 for(ib=0;ib<_nB;ib++){
460 for(ic=0;ic<_nC;ic++){
461 for(ia=0;ia<_nA;ia++){
462 temp=0;
463 for(i=0;i<_nA;i++){
464 temp+=_RA[i][ia]*_amp3[i][ib][ic];
465 }
466 _amp[ia][ib][ic]=temp;
467 }
468 }
469 }
470
471
472}
473
474
475
476
477
478
479
480
481
482
483
484
const Int_t n
Evt3Rank3C conj(const Evt3Rank3C &t2)
Definition: Evt3Rank3C.cc:175
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ ERROR
Definition: EvtReport.hh:49
@ INFO
Definition: EvtReport.hh:52
Definition: EvtAmp.hh:30
void vertex(const EvtComplex &amp)
Definition: EvtAmp.cc:477
static const double pi
Definition: EvtConst.hh:28
EvtEvalHelAmp(EvtSpinType::spintype A, EvtSpinType::spintype B, EvtSpinType::spintype C, EvtComplexPtrPtr HBC)
double probMax()
void evalAmp(EvtParticle *p, EvtAmp &amp)
virtual ~EvtEvalHelAmp()
double getHelAng(int i)
Definition: EvtHelSys.cc:54
const EvtVector4R & getP4() const
Definition: EvtParticle.cc:121
virtual EvtSpinDensity rotateToHelicityBasis() const =0
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
static int getSpin2(spintype stype)
Definition: EvtSpinType.hh:34
static int getSpinStates(spintype stype)
Definition: EvtSpinType.hh:64
static double d(int j, int m1, int m2, double theta)
Definition: EvtdFunction.cc:30
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)
Definition: TUtil.h:27