ROOTPWA
wave.cc
Go to the documentation of this file.
1 #include <sstream>
2 
3 #include "event.h"
4 #include "wave.h"
5 
6 
7 using namespace std;
8 
9 
11  : particle(),
12  _b(0),
13  _t(0)
14 {
15 }
16 
17 
18 wave::wave(const wave& wv)
19  : particle(wv)
20 {
21  _m = wv._m;
22  _epsilon = wv._epsilon;
23  _beam = wv._beam;
24  _target = wv._target;
25  _t = wv._t;
26  _b = wv._b;
27 }
28 
29 
31 {
32 }
33 
34 
35 wave&
37 {
39  _m = wv._m;
40  _epsilon = wv._epsilon;
41  _beam = wv._beam;
42  _target = wv._target;
43  _t = wv._t;
44  _b = wv._b;
45  return *this;
46 }
47 
48 
49 wave&
51 {
52  _beam *= L;
53  _target *= L;
55  return *this;
56 }
57 
58 
59 wave
60 wave::setM(const int m)
61 {
62  _m = m;
63  return *this;
64 }
65 
66 
67 wave
68 wave::setSlope(const double b)
69 {
70  _b = b;
71  return *this;
72 }
73 
74 
75 wave
76 wave::setT(const double t)
77 {
78  _t = t;
79  return *this;
80 }
81 
82 
83 wave
84 wave::channel(const char* ch)
85 {
86  _channel = ch;
87  return *this;
88 }
89 
90 
91 wave
92 wave::fill(const event& e,
93  const int debug)
94 {
95  if (debug) {
96  cout << "Filling wave" << endl
97  << "Setting beam p to:" << endl;
98  e.beam().get4P().print();
99  }
100  _beam = e.beam().get4P();
101  if (debug) {
102  cout << "Setting target p to:" << endl;
103  e.target().get4P().print();
104  }
105  _target = e.target().get4P();
106  decay* d = Decay();
107  if (debug)
108  cout << "Calling fill for wave: " << endl;
109  fourVec p = d->fill(e, debug);
110  if (debug) {
111  cout << "Setting p of wave to: " << endl;
112  p.print();
113  }
114  set4P(p);
115  return *this;
116 }
117 
118 
119 wave&
121 {
122  if (debug)
123  cout << "put wave into Gottfried-Jackson frame:" << endl;
124  if (Stable()) {
125  ;
126  } else {
127  fourVec tempX = get4P();
128  fourVec tempBeam = _beam;
129  fourVec tempTarget = _target;
130  fourVec tempChild1 = Decay()->_children.begin()->get4P();
131 
132  if (debug) {
133  cout << "initially in lab:" << endl
134  << "tempX: ";
135  tempX.print();
136  cout << "tempBeam: ";
137  tempBeam.print();
138  cout << "tempTarget: ";
139  tempTarget.print();
140  cout << "tempChild1: ";
141  tempChild1.print();
142  }
143 
144  threeVec N;
145  if (channel() == "t")
146  // put normal to production plane along y
147  N = tempBeam.V () / tempX.V ();
148  else if ((channel() == "s") || (channel() == "expt"))
149  // use lab y
150  N = threeVec(0.0, 1.0, 0.0);
152  rotation R;
153  T.set(R.set(N.phi(), N.theta() - M_PI / 2.0, -M_PI / 2.0));
154  lorentzTransform L = T;
155  tempX *= T;
156  tempBeam *= T;
157  tempTarget *= T;
158  tempChild1 *= T;
159  if (debug) {
160  cout << "put normal to PP along y:" << endl
161  << "tempX: ";
162  tempX.print();
163  cout << "tempBeam: ";
164  tempBeam.print();
165  cout << "tempTarget: ";
166  tempTarget.print();
167  cout << "tempChild1: ";
168  tempChild1.print();
169  }
170 
171  // boost to X rest frame
172  T.set (tempX);
173  matrix <double> X(4, 4);
174  X = T * L;
175  // gives error: dereferencing pointer 'X.95' does break strict-aliasing rules
176  //L = *((lorentzTransform*) &X);
177  // !!! BG workaround
178  L = X;
179  tempX *= T;
180  tempBeam *= T;
181  tempTarget *= T;
182  tempChild1 *= T;
183  if (debug) {
184  cout << "boost to XRF:" << endl
185  << "tempX: ";
186  tempX.print();
187  cout << "tempBeam: ";
188  tempBeam.print();
189  cout << "tempTarget: ";
190  tempTarget.print();
191  cout << "tempChild1: ";
192  tempChild1.print();
193  }
194 
195  // put beam along z
196  // T.set (R.set (tempBeam.V ()));
197  T.set(R.set(0.0, signof(tempBeam.x()) * tempBeam.V().theta(), 0.0));
198  X = T * L;
199  // gives error: dereferencing pointer 'X.95' does break strict-aliasing rules
200  //L = *((lorentzTransform*) &X);
201  // !!! BG workaround
202  L = X;
203  tempX *= T;
204  tempBeam *= T;
205  tempTarget *= T;
206  tempChild1 *= T;
207  if (debug) {
208  cout << "put beam along z:" << endl
209  << "tempX: ";
210  tempX.print();
211  cout << "tempBeam: ";
212  tempBeam.print();
213  cout << "tempTarget: ";
214  tempTarget.print();
215  cout << "tempChild1: ";
216  tempChild1.print();
217  }
218 
219  // boost the beam and the target
220  _beam *= L;
221  _target *= L;
222 
223  // setupFrames of children
224  Decay()->setupFrames(L, debug);
225  }
226  return *this;
227 }
228 
229 
230 complex<double>
232 {
233  complex<double> a;
234  if (Stable())
235  a = complex<double>(1, 0);
236  else if (_b != 0.0) {
237  if (debug)
238  cout << "calculate decay amplitude for expt wave b=" << _b << " t=" << _t << endl;
239  decay* d = Decay();
240  a = d->expt_amp(_b, _t, debug);
241  } else {
242  if (debug)
243  cout << "calculate decay amplitude for wave J=" << J() << " m=" << _m << endl;
244  decay* d = Decay();
245  a = d->amp(J(), _m, debug);
246  }
247  return a;
248 }
249 
250 
251 string
252 wave::sprint(const string& space) const
253 {
254  stringstream s;
255  s << "J=" << J() << space << "P=" << P() << space << "M=" << M() << space << "{";
256  for (list<particle>::const_iterator i = Decay()->_children.begin();
257  i != Decay()->_children.end(); ++i)
258  s << space << i->sprint(space);
259  s << space << Decay()->L() << space << Decay()->S() << space << "};";
260  return s.str();
261 }
262 
263 
264 void
265 wave::print() const
266 {
267  cout << "wave: " << endl;
268  cout << "beam: ";
269  _beam.print();
270  cout << "target: ";
271  _target.print();
272  if (_b == 0.0) {
273  cout << I() << getsign(G());
274  cout << "(" << J() << getsign(P()) << getsign(C()) << ")";
275  cout << " m = " << _m << " eps = " << _epsilon << endl;
276  } else
277  cout << "b: " << _b << " t: " << _t;
278  cout << "momentum: ";
279  get4P().print();
280  cout << "decays to:" << endl;
281  if(!Stable())
282  Decay()->print();
283 }
284 
285 
286 void
288 {
289  cout << "wave: " << endl;
290  cout << "beam: ";
291  _beam.print();
292  cout << "target: ";
293  _target.print();
294  cout << I() << getsign(G());
295  cout << "(" << J() << getsign(P()) << getsign(C()) << ")";
296  cout << " m = " << _m << " eps = " << _epsilon << endl;
297  cout << "momentum: ";
298  get4P().print();
299  cout << "decays to:" << endl;
300  if(!Stable())
301  Decay()->printFrames();
302 }