Line data Source code
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: EvtPhotonParticle.cc
12 : //
13 : // Description: Class to describe massless vectors
14 : //
15 : // Modification history:
16 : //
17 : // DJL/RYD September 25, 1996 Module created
18 : //
19 : //------------------------------------------------------------------------
20 : //
21 : #include "EvtGenBase/EvtPatches.hh"
22 : #include <stdlib.h>
23 : #include <iostream>
24 : #include <math.h>
25 : #include "EvtGenBase/EvtComplex.hh"
26 : #include "EvtGenBase/EvtPhotonParticle.hh"
27 : #include "EvtGenBase/EvtVector4C.hh"
28 : #include "EvtGenBase/EvtReport.hh"
29 : using std::endl;
30 :
31 0 : EvtPhotonParticle::EvtPhotonParticle() {
32 0 : }
33 :
34 0 : EvtPhotonParticle::~EvtPhotonParticle(){}
35 :
36 : void EvtPhotonParticle::init(EvtId part_n,const EvtVector4R& p4){
37 :
38 0 : init(part_n,p4.get(0),p4.get(1),
39 0 : p4.get(2),p4.get(3));
40 0 : }
41 :
42 : void EvtPhotonParticle::init(EvtId part_n,double e,double px,double py,double pz){
43 :
44 0 : _validP4=true;
45 0 : setp(e,px,py,pz);
46 0 : setpart_num(part_n);
47 :
48 0 : setLifetime();
49 :
50 : //defere calculation of basis vectors untill they are needed!
51 0 : _evalBasis=0;
52 :
53 0 : }
54 :
55 :
56 : EvtVector4C EvtPhotonParticle::epsParentPhoton(int i){
57 :
58 0 : if (!_evalBasis){
59 :
60 0 : _evalBasis=1;
61 0 : eps1.set(EvtComplex(0.0,0.0), EvtComplex(-1.0/sqrt(2.0),0.0),
62 0 : EvtComplex(0.0,-1.0/sqrt(2.0)), EvtComplex(0.0,0.0));
63 0 : eps2.set(EvtComplex(0.0,0.0), EvtComplex(1.0/sqrt(2.0),0.0),
64 0 : EvtComplex(0.0,-1.0/sqrt(2.0)), EvtComplex(0.0,0.0));
65 :
66 : // These are for photon along z axis. Rotate to get
67 : // correct direction...
68 :
69 : double phi,theta;
70 :
71 0 : EvtVector4R p=this->getP4();
72 :
73 0 : double px=p.get(1);
74 0 : double py=p.get(2);
75 0 : double pz=p.get(3);
76 :
77 0 : phi = atan2(py,px);
78 0 : theta = acos(pz/sqrt(px*px+py*py+pz*pz));
79 0 : eps1.applyRotateEuler(phi,theta,-phi);
80 0 : eps2.applyRotateEuler(phi,theta,-phi);
81 :
82 0 : }
83 :
84 :
85 0 : EvtVector4C temp;
86 :
87 0 : switch(i) {
88 :
89 : case 0:
90 0 : temp=eps1;
91 0 : break;
92 : case 1:
93 0 : temp=eps2;
94 0 : break;
95 : default:
96 0 : report(Severity::Error,"EvtGen") << "EvtPhotonParticle.cc: Asked "
97 0 : << "for state:"<<i<<endl;
98 0 : ::abort();
99 : break;
100 : }
101 :
102 : return temp;
103 0 : }
104 :
105 : EvtVector4C EvtPhotonParticle::epsPhoton(int ){
106 :
107 0 : report(Severity::Error,"EvtGen") << "EvtPhotonParticle.cc: Can not get "
108 0 : << "state in photons restframe."<<endl;;
109 0 : ::abort();
110 : return EvtVector4C();
111 :
112 : }
113 :
114 :
115 : EvtSpinDensity EvtPhotonParticle::rotateToHelicityBasis() const {
116 :
117 0 : EvtVector4C eplus(0.0,-1.0/sqrt(2.0),
118 0 : EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
119 0 : EvtVector4C eminus(0.0,1.0/sqrt(2.0),
120 0 : EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
121 :
122 : //Really uggly have to cast away constness because the
123 : //function epsParentPhoton caches the state vectors...
124 0 : EvtVector4C e1=((EvtParticle*)this)->epsParentPhoton(0);
125 0 : EvtVector4C e2=((EvtParticle*)this)->epsParentPhoton(1);
126 :
127 :
128 0 : EvtSpinDensity R;
129 0 : R.setDim(2);
130 :
131 0 : R.set(0,0,(eplus.conj())*e1);
132 0 : R.set(0,1,(eplus.conj())*e2);
133 :
134 0 : R.set(1,0,(eminus.conj())*e1);
135 0 : R.set(1,1,(eminus.conj())*e2);
136 :
137 : return R;
138 :
139 0 : }
140 :
141 :
142 : EvtSpinDensity EvtPhotonParticle::rotateToHelicityBasis(double alpha,
143 : double beta,
144 : double gamma) const{
145 :
146 0 : EvtVector4C eplus(0.0,-1.0/sqrt(2.0),
147 0 : EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
148 0 : EvtVector4C eminus(0.0,1.0/sqrt(2.0),
149 0 : EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
150 :
151 0 : eplus.applyRotateEuler(alpha,beta,gamma);
152 0 : eminus.applyRotateEuler(alpha,beta,gamma);
153 :
154 :
155 : //Really uggly have to cast away constness because the
156 : //function epsParentPhoton caches the state vectors...
157 0 : EvtVector4C e1=((EvtParticle*)this)->epsParentPhoton(0);
158 0 : EvtVector4C e2=((EvtParticle*)this)->epsParentPhoton(1);
159 :
160 0 : EvtSpinDensity R;
161 0 : R.setDim(2);
162 :
163 0 : R.set(0,0,(eplus.conj())*e1);
164 0 : R.set(0,1,(eplus.conj())*e2);
165 :
166 0 : R.set(1,0,(eminus.conj())*e1);
167 0 : R.set(1,1,(eminus.conj())*e2);
168 :
169 : return R;
170 :
171 0 : }
172 :
173 :
|