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