1 //--------------------------------------------------------------------------
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.
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 1998 Caltech, UCSB
11 // Module: EvtPhotonParticle.cc
13 // Description: Class to describe massless vectors
15 // Modification history:
17 // DJL/RYD September 25, 1996 Module created
19 //------------------------------------------------------------------------
21 #include "EvtGenBase/EvtPatches.hh"
25 #include "EvtGenBase/EvtComplex.hh"
26 #include "EvtGenBase/EvtPhotonParticle.hh"
27 #include "EvtGenBase/EvtVector4C.hh"
28 #include "EvtGenBase/EvtReport.hh"
31 EvtPhotonParticle::~EvtPhotonParticle(){}
33 void EvtPhotonParticle::init(EvtId part_n,const EvtVector4R& p4){
35 init(part_n,p4.get(0),p4.get(1),
39 void EvtPhotonParticle::init(EvtId part_n,double e,double px,double py,double pz){
47 //defere calculation of basis vectors untill they are needed!
53 EvtVector4C EvtPhotonParticle::epsParentPhoton(int i){
58 eps1.set(EvtComplex(0.0,0.0), EvtComplex(-1.0/sqrt(2.0),0.0),
59 EvtComplex(0.0,-1.0/sqrt(2.0)), EvtComplex(0.0,0.0));
60 eps2.set(EvtComplex(0.0,0.0), EvtComplex(1.0/sqrt(2.0),0.0),
61 EvtComplex(0.0,-1.0/sqrt(2.0)), EvtComplex(0.0,0.0));
63 // These are for photon along z axis. Rotate to get
64 // correct direction...
68 EvtVector4R p=this->getP4();
75 theta = acos(pz/sqrt(px*px+py*py+pz*pz));
76 eps1.applyRotateEuler(phi,theta,-phi);
77 eps2.applyRotateEuler(phi,theta,-phi);
93 report(ERROR,"EvtGen") << "EvtPhotonParticle.cc: Asked "
94 << "for state:"<<i<<endl;
102 EvtVector4C EvtPhotonParticle::epsPhoton(int ){
104 report(ERROR,"EvtGen") << "EvtPhotonParticle.cc: Can not get "
105 << "state in photons restframe."<<endl;;
107 return EvtVector4C();
112 EvtSpinDensity EvtPhotonParticle::rotateToHelicityBasis() const {
114 EvtVector4C eplus(0.0,-1.0/sqrt(2.0),
115 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
116 EvtVector4C eminus(0.0,1.0/sqrt(2.0),
117 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
119 //Really uggly have to cast away constness because the
120 //function epsParentPhoton caches the state vectors...
121 EvtVector4C e1=((EvtParticle*)this)->epsParentPhoton(0);
122 EvtVector4C e2=((EvtParticle*)this)->epsParentPhoton(1);
128 R.set(0,0,(eplus.conj())*e1);
129 R.set(0,1,(eplus.conj())*e2);
131 R.set(1,0,(eminus.conj())*e1);
132 R.set(1,1,(eminus.conj())*e2);
139 EvtSpinDensity EvtPhotonParticle::rotateToHelicityBasis(double alpha,
143 EvtVector4C eplus(0.0,-1.0/sqrt(2.0),
144 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
145 EvtVector4C eminus(0.0,1.0/sqrt(2.0),
146 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
148 eplus.applyRotateEuler(alpha,beta,gamma);
149 eminus.applyRotateEuler(alpha,beta,gamma);
152 //Really uggly have to cast away constness because the
153 //function epsParentPhoton caches the state vectors...
154 EvtVector4C e1=((EvtParticle*)this)->epsParentPhoton(0);
155 EvtVector4C e2=((EvtParticle*)this)->epsParentPhoton(1);
160 R.set(0,0,(eplus.conj())*e1);
161 R.set(0,1,(eplus.conj())*e2);
163 R.set(1,0,(eminus.conj())*e1);
164 R.set(1,1,(eminus.conj())*e2);