BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtPhotonParticle.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: 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 "EvtPhotonParticle.hh"
22#include "EvtComplex.hh"
23#include "EvtPatches.hh"
24#include "EvtReport.hh"
25#include "EvtVector4C.hh"
26#include <iostream>
27#include <math.h>
28#include <stdlib.h>
29using std::endl;
30
32
33void EvtPhotonParticle::init( EvtId part_n, const EvtVector4R& p4 ) {
34
35 init( part_n, p4.get( 0 ), p4.get( 1 ), p4.get( 2 ), p4.get( 3 ) );
36}
37
38void EvtPhotonParticle::init( EvtId part_n, double e, double px, double py, double pz ) {
39
40 _validP4 = true;
41 setp( e, px, py, pz );
42 setpart_num( part_n );
43
45
46 // defere calculation of basis vectors untill they are needed!
47 _evalBasis = 0;
48}
49
51
52 if ( !_evalBasis )
53 {
54
55 _evalBasis = 1;
56 eps1.set( EvtComplex( 0.0, 0.0 ), EvtComplex( -1.0 / sqrt( 2.0 ), 0.0 ),
57 EvtComplex( 0.0, -1.0 / sqrt( 2.0 ) ), EvtComplex( 0.0, 0.0 ) );
58 eps2.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
61 // These are for photon along z axis. Rotate to get
62 // correct direction...
63
64 double phi, theta;
65
66 EvtVector4R p = this->getP4();
67
68 double px = p.get( 1 );
69 double py = p.get( 2 );
70 double pz = p.get( 3 );
71
72 phi = atan2( py, px );
73 theta = acos( pz / sqrt( px * px + py * py + pz * pz ) );
74 eps1.applyRotateEuler( phi, theta, -phi );
75 eps2.applyRotateEuler( phi, theta, -phi );
76 }
77
78 EvtVector4C temp;
79
80 switch ( i )
81 {
82
83 case 0: temp = eps1; break;
84 case 1: temp = eps2; break;
85 default:
86 report( ERROR, "EvtGen" ) << "EvtPhotonParticle.cc: Asked "
87 << "for state:" << i << endl;
88 ::abort();
89 break;
90 }
91
92 return temp;
93}
94
96
97 report( ERROR, "EvtGen" ) << "EvtPhotonParticle.cc: Can not get "
98 << "state in photons restframe." << endl;
99 ;
100 ::abort();
101 return EvtVector4C();
102}
103
105
106 EvtVector4C eplus( 0.0, -1.0 / sqrt( 2.0 ), EvtComplex( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
107 EvtVector4C eminus( 0.0, 1.0 / sqrt( 2.0 ), EvtComplex( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
108
109 // Really uggly have to cast away constness because the
110 // function epsParentPhoton caches the state vectors...
111 EvtVector4C e1 = ( (EvtParticle*)this )->epsParentPhoton( 0 );
112 EvtVector4C e2 = ( (EvtParticle*)this )->epsParentPhoton( 1 );
113
115 R.SetDim( 2 );
116
117 R.Set( 0, 0, ( eplus.conj() ) * e1 );
118 R.Set( 0, 1, ( eplus.conj() ) * e2 );
119
120 R.Set( 1, 0, ( eminus.conj() ) * e1 );
121 R.Set( 1, 1, ( eminus.conj() ) * e2 );
122
123 return R;
124}
125
127 double gamma ) const {
128
129 EvtVector4C eplus( 0.0, -1.0 / sqrt( 2.0 ), EvtComplex( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
130 EvtVector4C eminus( 0.0, 1.0 / sqrt( 2.0 ), EvtComplex( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
131
132 eplus.applyRotateEuler( alpha, beta, gamma );
133 eminus.applyRotateEuler( alpha, beta, gamma );
134
135 // Really uggly have to cast away constness because the
136 // function epsParentPhoton caches the state vectors...
137 EvtVector4C e1 = ( (EvtParticle*)this )->epsParentPhoton( 0 );
138 EvtVector4C e2 = ( (EvtParticle*)this )->epsParentPhoton( 1 );
139
141 R.SetDim( 2 );
142
143 R.Set( 0, 0, ( eplus.conj() ) * e1 );
144 R.Set( 0, 1, ( eplus.conj() ) * e2 );
145
146 R.Set( 1, 0, ( eminus.conj() ) * e1 );
147 R.Set( 1, 1, ( eminus.conj() ) * e2 );
148
149 return R;
150}
Double_t e1
Double_t e2
double alpha
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
Definition EvtId.hh:27
void setLifetime()
const EvtVector4R & getP4() const
void setp(double e, double px, double py, double pz)
void setpart_num(EvtId particle_number)
EvtSpinDensity rotateToHelicityBasis() const
void init(EvtId part_n, double e, double px, double py, double pz)
EvtVector4C epsPhoton(int i)
EvtVector4C epsParentPhoton(int i)
void applyRotateEuler(double alpha, double beta, double gamma)
EvtVector4C conj() const
double get(int i) const