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() {
34 EvtPhotonParticle::~EvtPhotonParticle(){}
36 void EvtPhotonParticle::init(EvtId part_n,const EvtVector4R& p4){
38 init(part_n,p4.get(0),p4.get(1),
42 void EvtPhotonParticle::init(EvtId part_n,double e,double px,double py,double pz){
50 //defere calculation of basis vectors untill they are needed!
56 EvtVector4C EvtPhotonParticle::epsParentPhoton(int i){
61 eps1.set(EvtComplex(0.0,0.0), EvtComplex(-1.0/sqrt(2.0),0.0),
62 EvtComplex(0.0,-1.0/sqrt(2.0)), EvtComplex(0.0,0.0));
63 eps2.set(EvtComplex(0.0,0.0), EvtComplex(1.0/sqrt(2.0),0.0),
64 EvtComplex(0.0,-1.0/sqrt(2.0)), EvtComplex(0.0,0.0));
66 // These are for photon along z axis. Rotate to get
67 // correct direction...
71 EvtVector4R p=this->getP4();
78 theta = acos(pz/sqrt(px*px+py*py+pz*pz));
79 eps1.applyRotateEuler(phi,theta,-phi);
80 eps2.applyRotateEuler(phi,theta,-phi);
96 report(ERROR,"EvtGen") << "EvtPhotonParticle.cc: Asked "
97 << "for state:"<<i<<endl;
105 EvtVector4C EvtPhotonParticle::epsPhoton(int ){
107 report(ERROR,"EvtGen") << "EvtPhotonParticle.cc: Can not get "
108 << "state in photons restframe."<<endl;;
110 return EvtVector4C();
115 EvtSpinDensity EvtPhotonParticle::rotateToHelicityBasis() const {
117 EvtVector4C eplus(0.0,-1.0/sqrt(2.0),
118 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
119 EvtVector4C eminus(0.0,1.0/sqrt(2.0),
120 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
122 //Really uggly have to cast away constness because the
123 //function epsParentPhoton caches the state vectors...
124 EvtVector4C e1=((EvtParticle*)this)->epsParentPhoton(0);
125 EvtVector4C e2=((EvtParticle*)this)->epsParentPhoton(1);
131 R.set(0,0,(eplus.conj())*e1);
132 R.set(0,1,(eplus.conj())*e2);
134 R.set(1,0,(eminus.conj())*e1);
135 R.set(1,1,(eminus.conj())*e2);
142 EvtSpinDensity EvtPhotonParticle::rotateToHelicityBasis(double alpha,
146 EvtVector4C eplus(0.0,-1.0/sqrt(2.0),
147 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
148 EvtVector4C eminus(0.0,1.0/sqrt(2.0),
149 EvtComplex(0.0,-1.0/sqrt(2.0)),0.0);
151 eplus.applyRotateEuler(alpha,beta,gamma);
152 eminus.applyRotateEuler(alpha,beta,gamma);
155 //Really uggly have to cast away constness because the
156 //function epsParentPhoton caches the state vectors...
157 EvtVector4C e1=((EvtParticle*)this)->epsParentPhoton(0);
158 EvtVector4C e2=((EvtParticle*)this)->epsParentPhoton(1);
163 R.set(0,0,(eplus.conj())*e1);
164 R.set(0,1,(eplus.conj())*e2);
166 R.set(1,0,(eminus.conj())*e1);
167 R.set(1,1,(eminus.conj())*e2);