File: VectorWaveFunction.cc

package info (click to toggle)
thepeg 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 9,312 kB
  • ctags: 11,509
  • sloc: cpp: 57,129; sh: 11,315; java: 3,212; lisp: 1,402; makefile: 830; ansic: 58; perl: 3
file content (294 lines) | stat: -rw-r--r-- 8,954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// -*- C++ -*-
//
// VectorWaveFunction.cc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 2003-2011 Peter Richardson, Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the VectorWaveFunction class.
//
// Author: Peter Richardson
//

#include "VectorWaveFunction.h"

using namespace ThePEG;
using namespace ThePEG::Helicity;

// calculate the Wavefunction
void VectorWaveFunction::calculateWaveFunction(unsigned int ihel,VectorPhase vphase) {
  Direction dir=direction();
  if(dir==intermediate)
    throw ThePEG::Helicity::HelicityConsistencyError() 
      << "In VectorWaveFunction::calcluateWaveFunction "
      << "particle must be incoming or outgoing not intermediate" 
      << Exception::abortnow;
  // check a valid helicity combination
  if(ihel==0 || ihel==2||(ihel==1&&mass()>ZERO)) {
    int jhel=ihel-1;
    // extract the momentum components
    double fact=-1.; if(dir==incoming){fact=1.;}
    Energy ppx=fact*px(),ppy=fact*py(),ppz=fact*pz(),pee=fact*e(),pmm=mass();
    // calculate some kinematic quantites;
    Energy2 pt2 = ppx*ppx+ppy*ppy;
    Energy pabs = sqrt(pt2+ppz*ppz);
    Energy pt = sqrt(pt2);
    // overall phase of the vector
    Complex phase;
    if(vphase==vector_phase) {
      if(pt==ZERO || ihel==1) phase = 1.;
      else if(ihel==0)            phase = Complex(ppx/pt,-fact*ppy/pt);
      else                        phase = Complex(ppx/pt, fact*ppy/pt);
    }
    else                          phase = 1.;
    if(ihel!=1) phase = phase/sqrt(2.);
    // first the +/-1 helicity states
    if(ihel!=1) {
      // first the no pt case
      if(pt==ZERO) {
	double sgnz;
	sgnz = ppz<ZERO ? -1. : 1.;
	_wf.setX(-complex<double>(jhel)*phase);
	_wf.setY(sgnz*phase*complex<double>(0,-fact));
	_wf.setZ(0.);
	_wf.setT(0.);
      }
      else {
	InvEnergy opabs=1./pabs;
	InvEnergy opt  =1./pt;
	_wf.setX(phase*complex<double>(-jhel*ppz*ppx*opabs*opt, fact*ppy*opt));
	_wf.setY(phase*complex<double>(-jhel*ppz*ppy*opabs*opt,-fact*ppx*opt));
	_wf.setZ(double(jhel*pt*opabs)*phase);
	_wf.setT(0.);
      }
    }
    // 0 component for massive vectors
    else {
      if(pabs==ZERO) {
	_wf.setX(0.);
	_wf.setY(0.);
	_wf.setZ(1.);
	_wf.setT(0.);
      }
      else {
	InvEnergy empabs=pee/pmm/pabs;
	_wf.setX(double(empabs*ppx));
	_wf.setY(double(empabs*ppy));
	_wf.setZ(double(empabs*ppz));
	_wf.setT(double(pabs/pmm));
      }
    }
  }
  // special return the momentum as a check of gauge invariance
  else if(ihel==10) {
    _wf.setX(double(px()/MeV));
    _wf.setY(double(py()/MeV));
    _wf.setZ(double(pz()/MeV));
    _wf.setT(double(e()/MeV));
  }
  // issue warning and return zero
  else {
    ThePEG::Helicity::HelicityConsistencyError() 
      << "Invalid Helicity = " << ihel << " requested for Vector " 
      << particle()->PDGName() << Exception::abortnow;
    _wf.setX(0.);_wf.setY(0.);_wf.setZ(0.);_wf.setT(0.);
  }
}


void VectorWaveFunction::
calculateWaveFunctions(vector<LorentzPolarizationVector> & waves,
		       tPPtr particle,Direction dir,bool massless,
		       VectorPhase phase) {
  tVectorSpinPtr inspin = !particle->spinInfo() ? tVectorSpinPtr() :
    dynamic_ptr_cast<tVectorSpinPtr>(particle->spinInfo());
  waves.resize(3);
  if(inspin) {
    if(dir==outgoing) {
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=inspin->getProductionBasisState(ix);
    }
    else {
      inspin->decay();
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=inspin->getDecayBasisState(ix);
    }
  }
  else {
    assert(!particle->spinInfo());
    VectorWaveFunction wave(particle->momentum(),particle->dataPtr(),0,
			    dir,phase);
    for(unsigned int ix=0;ix<3;++ix) {
      if(massless&&ix==1) {
	waves[ix] = LorentzPolarizationVector();
      }
      else {
	if(ix!=0) wave.reset(ix);
	waves[ix] = wave.wave();
      }
    }
  }
}

void VectorWaveFunction::
calculateWaveFunctions(vector<VectorWaveFunction> & waves,
		       tPPtr particle, Direction dir, bool massless,
		       VectorPhase phase) {
  tVectorSpinPtr inspin = !particle->spinInfo() ? tVectorSpinPtr() :
    dynamic_ptr_cast<tVectorSpinPtr>(particle->spinInfo());
  waves.resize(3);
  if(inspin) {
    if(dir==outgoing) {
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=VectorWaveFunction(particle->momentum(),
				     particle->dataPtr(),
				     inspin->getProductionBasisState(ix),dir);
    }
    else {
      inspin->decay();
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=VectorWaveFunction(particle->momentum(),
				     particle->dataPtr(),
				     inspin->getDecayBasisState(ix),dir);
    }
  }
  else {
    assert(!particle->spinInfo());
    VectorWaveFunction wave(particle->momentum(),particle->dataPtr(),0,
			    dir,phase);
    for(unsigned int ix=0;ix<3;++ix) {
      if(massless&&ix==1) {
	waves[ix] = VectorWaveFunction(particle->momentum(),
				       particle->dataPtr(),dir);
      }
      else {
	if(ix!=0) wave.reset(ix);
	waves[ix] = wave;
      }
    }
  }
}

void VectorWaveFunction::
calculateWaveFunctions(vector<LorentzPolarizationVector> & waves,
		       RhoDMatrix & rho,tPPtr particle,
		       Direction dir,bool massless,
		       VectorPhase phase) {
  tVectorSpinPtr inspin = !particle->spinInfo() ? tVectorSpinPtr() :
    dynamic_ptr_cast<tVectorSpinPtr>(particle->spinInfo());
  waves.resize(3);
  if(inspin) {
    if(dir==outgoing) {
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=inspin->getProductionBasisState(ix);
      rho = RhoDMatrix(PDT::Spin1);
    }
    else {
      inspin->decay();
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=inspin->getDecayBasisState(ix);
      rho = inspin->rhoMatrix();
    }
  }
  else {
    assert(!particle->spinInfo());
    VectorWaveFunction wave(particle->momentum(),particle->dataPtr(),0,
			    dir,phase);
    for(unsigned int ix=0;ix<3;++ix) {
      if(massless&&ix==1) {
	waves[ix] = LorentzPolarizationVector();
      }
      else {
	if(ix!=0) wave.reset(ix);
	waves[ix] = wave.wave();
      }
    }
    rho = RhoDMatrix(PDT::Spin1);
  }
}

void VectorWaveFunction::
calculateWaveFunctions(vector<VectorWaveFunction> & waves,
		       RhoDMatrix & rho,
		       tPPtr particle, Direction dir,bool massless,
		       VectorPhase phase) {
  tVectorSpinPtr inspin = !particle->spinInfo() ? tVectorSpinPtr() :
    dynamic_ptr_cast<tVectorSpinPtr>(particle->spinInfo());
  waves.resize(3);
  if(inspin) {
    if(dir==outgoing) {
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=VectorWaveFunction(particle->momentum(),
				     particle->dataPtr(),
				     inspin->getProductionBasisState(ix),dir);
      rho = RhoDMatrix(PDT::Spin1);
    }
    else {
      inspin->decay();
      for(unsigned int ix=0;ix<3;++ix)
	waves[ix]=VectorWaveFunction(particle->momentum(),
				     particle->dataPtr(),
				     inspin->getDecayBasisState(ix),dir);
      rho = inspin->rhoMatrix();
    }
  }
  else {
    assert(!particle->spinInfo());
    VectorWaveFunction wave(particle->momentum(),particle->dataPtr(),0,
			    dir,phase);
    for(unsigned int ix=0;ix<3;++ix) {
      if(massless&&ix==1) {
	waves[ix] = VectorWaveFunction(particle->momentum(),
				       particle->dataPtr(),dir);
      }
      else {
	if(ix!=0) wave.reset(ix);
	waves[ix] = wave;
      }
    }
    rho = RhoDMatrix(PDT::Spin1);
  }
}

void VectorWaveFunction::
constructSpinInfo(const vector<LorentzPolarizationVector> & waves,
		  tPPtr part,Direction dir, bool time,bool ) {
  assert(waves.size()==3);
  tVectorSpinPtr inspin = !part->spinInfo() ? tVectorSpinPtr() :
    dynamic_ptr_cast<tVectorSpinPtr>(part->spinInfo());
  if(inspin) {
    for(unsigned int ix=0;ix<3;++ix)
      if(dir==outgoing) inspin->setBasisState(ix,waves[ix]);
      else              inspin->setDecayState(ix,waves[ix]);
  }
  else {
    VectorSpinPtr temp = new_ptr(VectorSpinInfo(part->momentum(),time));
    part->spinInfo(temp);
    for(unsigned int ix=0;ix<3;++ix)
      if(dir==outgoing) temp->setBasisState(ix,waves[ix]);
      else              temp->setDecayState(ix,waves[ix]);
  }
}

void VectorWaveFunction::
constructSpinInfo(const vector<VectorWaveFunction> & waves,
		  tPPtr part,Direction dir, bool time,bool ) {
  assert(waves.size()==3);
  tVectorSpinPtr inspin = !part->spinInfo() ? tVectorSpinPtr() :
    dynamic_ptr_cast<tVectorSpinPtr>(part->spinInfo());
  if(inspin) {
    for(unsigned int ix=0;ix<3;++ix)
      if(dir==outgoing) inspin->setBasisState(ix,waves[ix].wave());
      else              inspin->setDecayState(ix,waves[ix].wave());
  }
  else {
    VectorSpinPtr temp = new_ptr(VectorSpinInfo(part->momentum(),time));
    part->spinInfo(temp);
    for(unsigned int ix=0;ix<3;++ix)
      if(dir==outgoing) temp->setBasisState(ix,waves[ix].wave());
      else              temp->setDecayState(ix,waves[ix].wave());
  }
}