BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtTensor4C.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) 1998 Caltech, UCSB
10//
11// Module: EvtTensor4C.cc
12//
13// Description: Implementation of tensor particles.
14//
15// Modification history:
16//
17// DJL/RYD September 25,1996 Module created
18//
19//------------------------------------------------------------------------
20//
22#include <iostream>
23#include <math.h>
24#include <assert.h>
28using std::endl;
29using std::ostream;
30
31
32
34
35 int i,j;
36
37 for(i=0;i<4;i++) {
38 for(j=0;j<4;j++) {
39 t[i][j] = t1.t[i][j];
40 }
41 }
42
43}
44
46
48
49 static EvtTensor4C g_metric(1.0,-1.0,-1.0,-1.0);
50
51 return g_metric;
52
53}
56 int i,j;
57
58 for(i=0;i<4;i++) {
59 for(j=0;j<4;j++) {
60 t[i][j] = t1.t[i][j];
61 }
62 }
63 return *this;
69 int i,j;
71 for(i=0;i<4;i++) {
72 for(j=0;j<4;j++) {
73 temp.set(j,i,::conj(t[i][j]));
74 }
75 }
76 return temp;
77}
78
79
81 double alpha,double beta,double gamma){
82
83 EvtTensor4C tmp(rs);
84 tmp.applyRotateEuler(alpha,beta,gamma);
85 return tmp;
86
87}
88
90 const EvtVector4R p4){
91
92 EvtTensor4C tmp(rs);
93 tmp.applyBoostTo(p4);
94 return tmp;
95
96}
97
99 const EvtVector3R boost){
100
101 EvtTensor4C tmp(rs);
102 tmp.applyBoostTo(boost);
103 return tmp;
104
105}
106
108
109 double e=p4.get(0);
110
111 EvtVector3R boost(p4.get(1)/e,p4.get(2)/e,p4.get(3)/e);
112
113 applyBoostTo(boost);
114
115 return;
116
117}
118
119
121
122 double bx,by,bz,gamma,b2;
123 double lambda[4][4];
124 EvtComplex tt[4][4];
125
126 bx=boost.get(0);
127 by=boost.get(1);
128 bz=boost.get(2);
129
130 double bxx=bx*bx;
131 double byy=by*by;
132 double bzz=bz*bz;
133
134 b2=bxx+byy+bzz;
135
136
137 if (b2==0.0){
138 return;
139 }
140
141 assert(b2<1.0);
142
143 gamma=1.0/sqrt(1-b2);
144
145
146 int i,j,k;
147
148
149 if (b2==0.0){
150 return ;
151 }
152
153 lambda[0][0]=gamma;
154 lambda[0][1]=gamma*bx;
155 lambda[1][0]=gamma*bx;
156 lambda[0][2]=gamma*by;
157 lambda[2][0]=gamma*by;
158 lambda[0][3]=gamma*bz;
159 lambda[3][0]=gamma*bz;
160
161 lambda[1][1]=1.0+(gamma-1.0)*bx*bx/b2;
162 lambda[2][2]=1.0+(gamma-1.0)*by*by/b2;
163 lambda[3][3]=1.0+(gamma-1.0)*bz*bz/b2;
164
165 lambda[1][2]=(gamma-1.0)*bx*by/b2;
166 lambda[2][1]=(gamma-1.0)*bx*by/b2;
167
168 lambda[1][3]=(gamma-1.0)*bx*bz/b2;
169 lambda[3][1]=(gamma-1.0)*bx*bz/b2;
170
171 lambda[3][2]=(gamma-1.0)*bz*by/b2;
172 lambda[2][3]=(gamma-1.0)*bz*by/b2;
173
174 for(i=0;i<4;i++){
175 for(j=0;j<4;j++){
176 tt[i][j] = EvtComplex(0.0);
177 for(k=0;k<4;k++){
178 tt[i][j]=tt[i][j]+lambda[j][k]*t[i][k];
179 }
180 }
181 }
182
183 for(i=0;i<4;i++){
184 for(j=0;j<4;j++){
185 t[i][j] = EvtComplex(0.0);
186 for(k=0;k<4;k++){
187 t[i][j]=t[i][j]+lambda[i][k]*tt[k][j];
188 }
189 }
190 }
191
192}
193
195 int i,j;
196 for(i=0;i<4;i++){
197 for(j=0;j<4;j++){
198 t[i][j]=EvtComplex(0.0,0.0);
199 }
200 }
201}
202
203
204
205ostream& operator<<(ostream& s,const EvtTensor4C& t){
206
207 int i,j;
208 s<< endl;
209 for(i=0;i<4;i++){
210 for(j=0;j<4;j++){
211 s << t.t[i][j];
212 }
213 s << endl;
214 }
215 return s;
216}
217
218void EvtTensor4C::setdiag(double g00, double g11, double g22, double g33){
219 t[0][0]=EvtComplex(g00);
220 t[1][1]=EvtComplex(g11);
221 t[2][2]=EvtComplex(g22);
222 t[3][3]=EvtComplex(g33);
223 t[0][1] = EvtComplex(0.0);
224 t[0][2] = EvtComplex(0.0);
225 t[0][3] = EvtComplex(0.0);
226 t[1][0] = EvtComplex(0.0);
227 t[1][2] = EvtComplex(0.0);
228 t[1][3] = EvtComplex(0.0);
229 t[2][0] = EvtComplex(0.0);
230 t[2][1] = EvtComplex(0.0);
231 t[2][3] = EvtComplex(0.0);
232 t[3][0] = EvtComplex(0.0);
233 t[3][1] = EvtComplex(0.0);
234 t[3][2] = EvtComplex(0.0);
235}
236
237
239
240 int i,j;
241
242 for (i=0;i<4;i++) {
243 for (j=0;j<4;j++) {
244 t[i][j]+=t2.get(i,j);
245 }
246 }
247 return *this;
248}
249
251
252 int i,j;
253
254 for (i=0;i<4;i++) {
255 for (j=0;j<4;j++) {
256 t[i][j]-=t2.get(i,j);
257 }
258 }
259 return *this;
260}
261
262
264 int i,j;
265
266 for (i=0;i<4;i++) {
267 for (j=0;j<4;j++) {
268 t[i][j]*=c;
269 }
270 }
271 return *this;
272}
273
274
276
277 return EvtTensor4C(t1)*=c;
278
279}
280
282
283 return EvtTensor4C(t1)*=c;
284
285}
286
287
289 int i,j;
290
291 for (i=0;i<4;i++) {
292 for (j=0;j<4;j++) {
293 t[i][j]*=EvtComplex(d,0.0);
294 }
295 }
296 return *this;
297}
298
299
300EvtTensor4C operator*(const EvtTensor4C& t1, double d){
301
302 return EvtTensor4C(t1)*=EvtComplex(d,0.0);
303
304}
305
306EvtTensor4C operator*(double d, const EvtTensor4C& t1){
307
308 return EvtTensor4C(t1)*=EvtComplex(d,0.0);
309
310}
311
313
314 EvtComplex sum(0.0,0.0);
315 int i,j;
316
317 for (i=0;i<4;i++) {
318 for (j=0;j<4;j++) {
319 sum+=t1.t[i][j]*t2.t[i][j];
320 }
321 }
322
323 return sum;
324}
325
326
328 EvtTensor4C temp;
329 int i,j;
330
331 for (i=0;i<4;i++) {
332 for (j=0;j<4;j++) {
333 temp.set(i,j,c1.get(i)*c2.get(j));
334 }
335 }
336 return temp;
337}
338
339
341 EvtTensor4C temp;
342 int i,j;
343
344 for (i=0;i<4;i++) {
345 for (j=0;j<4;j++) {
346 temp.set(i,j,c1.get(i)*c2.get(j));
347 }
348 }
349 return temp;
350}
351
352
354
355 EvtTensor4C temp;
356 int i,j;
357
358 for (i=0;i<4;i++) {
359 for (j=0;j<4;j++) {
360 temp.t[i][j]=EvtComplex(c1.get(i)*c2.get(j),0.0);
361 }
362 }
363 return temp;
364}
365
367
368 int i,j;
369
370 for (i=0;i<4;i++) {
371 for (j=0;j<4;j++) {
372 t[i][j]+=p1.get(i)*p2.get(j);
373 }
374 }
375 return *this;
376}
377
378
380
381 EvtTensor4C temp;
382
383 temp.set(0,0,EvtComplex(0.0,0.0));
384 temp.set(1,1,EvtComplex(0.0,0.0));
385 temp.set(2,2,EvtComplex(0.0,0.0));
386 temp.set(3,3,EvtComplex(0.0,0.0));
387
388 temp.set(0,1,t2.get(3,2)-t2.get(2,3));
389 temp.set(0,2,-t2.get(3,1)+t2.get(1,3));
390 temp.set(0,3,t2.get(2,1)-t2.get(1,2));
391
392 temp.set(1,2,-t2.get(3,0)+t2.get(0,3));
393 temp.set(1,3,t2.get(2,0)-t2.get(0,2));
394
395 temp.set(2,3,-t2.get(1,0)+t2.get(0,1));
396
397 temp.set(1,0,-temp.get(0,1));
398 temp.set(2,0,-temp.get(0,2));
399 temp.set(3,0,-temp.get(0,3));
400
401 temp.set(2,1,-temp.get(1,2));
402 temp.set(3,1,-temp.get(1,3));
403
404 temp.set(3,2,-temp.get(2,3));
405
406 return temp;
407
408}
409
410
412 EvtTensor4C temp;
413
414 int i,j;
415
416 for(i=0;i<4;i++){
417 for(j=0;j<4;j++){
418 temp.set(i,j,::conj((t2.get(i,j))));
419 }
420 }
421
422 return temp;
423}
424
425
427 EvtTensor4C temp;
428
429 int i,j;
430 EvtComplex c;
431
432 for(i=0;i<4;i++){
433 for(j=0;j<4;j++){
434 c=t1.get(i,0)*t2.get(j,0)-t1.get(i,1)*t2.get(j,1)
435 -t1.get(i,2)*t2.get(j,2)-t1.get(i,3)*t2.get(j,3);
436 temp.set(i,j,c);
437 }
438 }
439
440 return temp;
441}
442
444 EvtTensor4C temp;
445
446 int i,j;
447 EvtComplex c;
448
449 for(i=0;i<4;i++){
450 for(j=0;j<4;j++){
451 c=t1.get(0,i)*t2.get(0,j)-t1.get(1,i)*t2.get(1,j)
452 -t1.get(2,i)*t2.get(2,j)-t1.get(3,i)*t2.get(3,j);
453 temp.set(i,j,c);
454 }
455 }
456
457 return temp;
458}
459
460
462 EvtVector4C temp;
463
464 int i;
465
466 for(i=0;i<4;i++){
467 temp.set(i,t[0][i]*v4.get(0)-t[1][i]*v4.get(1)
468 -t[2][i]*v4.get(2)-t[3][i]*v4.get(3));
469 }
470
471 return temp;
472}
473
475 EvtVector4C temp;
476
477 int i;
478
479 for(i=0;i<4;i++){
480 temp.set(i,t[i][0]*v4.get(0)-t[i][1]*v4.get(1)
481 -t[i][2]*v4.get(2)-t[i][3]*v4.get(3));
482 }
483
484 return temp;
485}
486
487
489 EvtVector4C temp;
490
491 int i;
492
493 for(i=0;i<4;i++){
494 temp.set(i,t[0][i]*v4.get(0)-t[1][i]*v4.get(1)
495 -t[2][i]*v4.get(2)-t[3][i]*v4.get(3));
496 }
497
498 return temp;
499}
500
501
503 EvtVector4C temp;
504
505 int i;
506
507 for(i=0;i<4;i++){
508 temp.set(i,t[i][0]*v4.get(0)-t[i][1]*v4.get(1)
509 -t[i][2]*v4.get(2)-t[i][3]*v4.get(3));
510 }
511
512 return temp;
513}
514
515
516
517void EvtTensor4C::applyRotateEuler(double phi,double theta,double ksi){
518
519 EvtComplex tt[4][4];
520 double sp,st,sk,cp,ct,ck;
521 double lambda[4][4];
522
523 sp=sin(phi);
524 st=sin(theta);
525 sk=sin(ksi);
526 cp=cos(phi);
527 ct=cos(theta);
528 ck=cos(ksi);
529
530
531 lambda[0][0]=1.0;
532 lambda[0][1]=0.0;
533 lambda[1][0]=0.0;
534 lambda[0][2]=0.0;
535 lambda[2][0]=0.0;
536 lambda[0][3]=0.0;
537 lambda[3][0]=0.0;
538
539 lambda[1][1]= ck*ct*cp-sk*sp;
540 lambda[1][2]=-sk*ct*cp-ck*sp;
541 lambda[1][3]=st*cp;
542
543 lambda[2][1]= ck*ct*sp+sk*cp;
544 lambda[2][2]=-sk*ct*sp+ck*cp;
545 lambda[2][3]=st*sp;
546
547 lambda[3][1]=-ck*st;
548 lambda[3][2]=sk*st;
549 lambda[3][3]=ct;
550
551
552 int i,j,k;
553
554
555 for(i=0;i<4;i++){
556 for(j=0;j<4;j++){
557 tt[i][j] = EvtComplex(0.0);
558 for(k=0;k<4;k++){
559 tt[i][j]+=lambda[j][k]*t[i][k];
560 }
561 }
562 }
563
564 for(i=0;i<4;i++){
565 for(j=0;j<4;j++){
566 t[i][j] = EvtComplex(0.0);
567 for(k=0;k<4;k++){
568 t[i][j]+=lambda[i][k]*tt[k][j];
569 }
570 }
571 }
572
573}
574
575
576
EvtTensor4C dual(const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:379
ostream & operator<<(ostream &s, const EvtTensor4C &t)
Definition: EvtTensor4C.cc:205
EvtComplex cont(const EvtTensor4C &t1, const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:312
EvtTensor4C rotateEuler(const EvtTensor4C &rs, double alpha, double beta, double gamma)
Definition: EvtTensor4C.cc:80
EvtTensor4C cont22(const EvtTensor4C &t1, const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:426
EvtTensor4C cont11(const EvtTensor4C &t1, const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:443
EvtTensor4C boostTo(const EvtTensor4C &rs, const EvtVector4R p4)
Definition: EvtTensor4C.cc:89
EvtTensor4C operator*(const EvtTensor4C &t1, const EvtComplex &c)
Definition: EvtTensor4C.cc:275
EvtTensor4C conj(const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:411
EvtTensor4C directProd(const EvtVector4C &c1, const EvtVector4C &c2)
Definition: EvtTensor4C.cc:327
const double alpha
XmlRpcServer s
Definition: HelloServer.cpp:11
double sin(const BesAngle a)
double cos(const BesAngle a)
void setdiag(double t00, double t11, double t22, double t33)
Definition: EvtTensor4C.cc:218
void set(int i, int j, const EvtComplex &c)
Definition: EvtTensor4C.hh:122
const EvtComplex & get(int i, int j) const
Definition: EvtTensor4C.hh:126
EvtTensor4C & operator=(const EvtTensor4C &t1)
Definition: EvtTensor4C.cc:55
EvtTensor4C & operator-=(const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:250
virtual ~EvtTensor4C()
Definition: EvtTensor4C.cc:45
EvtVector4C cont1(const EvtVector4C &v4) const
Definition: EvtTensor4C.cc:461
static const EvtTensor4C & g()
Definition: EvtTensor4C.cc:47
void applyBoostTo(const EvtVector4R &p4)
Definition: EvtTensor4C.cc:107
EvtTensor4C & addDirProd(const EvtVector4R &p1, const EvtVector4R &p2)
Definition: EvtTensor4C.cc:366
EvtTensor4C & operator*=(const EvtComplex &c)
Definition: EvtTensor4C.cc:263
EvtVector4C cont2(const EvtVector4C &v4) const
Definition: EvtTensor4C.cc:474
EvtTensor4C & operator+=(const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:238
void applyRotateEuler(double alpha, double beta, double gamma)
Definition: EvtTensor4C.cc:517
friend EvtTensor4C conj(const EvtTensor4C &t2)
Definition: EvtTensor4C.cc:411
double get(int i) const
Definition: EvtVector3R.hh:126
void set(int, const EvtComplex &)
Definition: EvtVector4C.hh:109
const EvtComplex & get(int) const
Definition: EvtVector4C.hh:131
double get(int i) const
Definition: EvtVector4R.hh:179
int t()
Definition: t.c:1