File: SpinInfo.h

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 (433 lines) | stat: -rw-r--r-- 10,394 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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
// -*- C++ -*-
//
// SpinInfo.h 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.
//
#ifndef ThePEG_SpinInfo_H
#define ThePEG_SpinInfo_H
// This is the declaration of the SpinInfo class.

#include "ThePEG/EventRecord/EventInfoBase.h"
#include "ThePEG/PDT/PDT.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "HelicityVertex.h"

namespace ThePEG {

/**
 *   The SpinInfo is the base class for the spin information for the
 *   spin correlation algorithm. The implementations for different spin
 *   states inherit from this.
 *
 *   The class contains pointers to the vertex where the particle is
 *   produced and where it decays, together with methods to set/get
 *   these.
 *
 *   There are two flags decayed which store information on the state
 *   of the particle.
 *
 *   The decayed() members provides access to the _decay data member
 *   which is true if the spin density matrix required to perform the
 *   decay of a timelike particle has been calculated (this would be a
 *   decay matrix for a spacelike particle.) This is set by the
 *   decay() method which calls a method from the production vertex to
 *   calculate this matrix. The decay() method should be called by a
 *   decayer which uses spin correlation method before it uses the
 *   spin density matrix to calculate the matrix element for the
 *   decay.
 *
 *   The developed() member provides access to the _developed data
 *   member which is true if the decay matrix required to perform the
 *   decays of the siblings of a particle has been calculated (this
 *   would a spin density matrix for a spacelike particle.) This is
 *   set by the developed() method which calls a method from the decay
 *   vertex to calculate the matrix. The developed() method is called
 *   by a DecayHandler which is capable of performing spin
 *   correlations after all the unstable particles produced by a
 *   decaying particle are decayed.
 *
 *   Methods are also provided to access the spin density and decay
 *   matrices for a particle.
 *
 * @author Peter Richardson
 *
 */
class SpinInfo: public EventInfoBase {

public:

  /**
   *  Status for the implementation of spin correlations
   */
  enum DevelopedStatus {
    Undeveloped=0, /**< Not developed. */
    Developed=1,   /**< Developed. */
    NeedsUpdate=2  /**< Developed but needs recalculating due to some change. */
  };

public:

  /** @name Standard constructors and destructors. */
  //@{
  /**
   * Default constructor.
   */
  SpinInfo() 
    : _timelike(false), _prodloc(-1), _decayloc(-1), 
      _decayed(false), _developed(Undeveloped) {}

  /**
   * Standard Constructor.
   * @param s the spin.
   * @param p the production momentum.
   * @param time true if the particle is time-like.
   */
  SpinInfo(PDT::Spin s, 
	   const Lorentz5Momentum & p = Lorentz5Momentum(), 
	   bool time = false)
    : _timelike(time), _prodloc(-1), _decayloc(-1),
      _decayed(false), _developed(Undeveloped),
      _rhomatrix(s), _Dmatrix(s), _spin(s),
      _productionmomentum(p), _currentmomentum(p) {}

  /**
   * Copy-constructor.
   */
  SpinInfo(const SpinInfo &);
  //@}

public:

  /**
   * Returns true if the polarization() has been implemented in a
   * subclass. This default version returns false.
   */
  virtual bool hasPolarization() const { return false; }

  /**
   * Return the angles of the polarization vector as a pair of
   * doubles. first is the polar angle and second is the azimuth
   * wrt. the particles direction. This default version of the
   * function returns 0,0, and if a subclass implements a proper
   * function it should also implement 'hasPolarization()' to return
   * true.
   */
  virtual DPair polarization() const { return DPair(); }

public:

  /**
   * Standard Init function.
   */
  static void Init();

  /**
   * Rebind to cloned objects. If a FermionSpinInfo is cloned together
   * with a whole Event and this has pointers to other event record
   * objects, these should be rebound to their clones in this
   * function.
   */
  virtual void rebind(const EventTranslationMap & trans);

  /**
   * Standard clone method.
   */
  virtual EIPtr clone() const;

  /**
   * Method to handle the delelation
   */
  void update() const;

  /**
   * Perform a lorentz rotation of the spin information
   */
  virtual void transform(const LorentzMomentum & m, const LorentzRotation & r) {
    _currentmomentum = m;
    _currentmomentum.transform(r);
  }

public:


  /** @name Access the vertices. */
  //@{
  /**
   * Set the vertex at which the particle was produced.
   */
  void productionVertex(VertexPtr in) const {
    _production=in;
    // add to the list of outgoing if timelike
    int temp;
    if(_timelike) in->addOutgoing(this,temp); 
    // or incoming if spacelike
    else          in->addIncoming(this,temp);
    _prodloc=temp;
  }

  /**
   * Get the vertex at which the particle was produced.
   */
  tcVertexPtr productionVertex() const { return _production; }

  /**
   * Set the vertex at which the particle decayed or branched.
   */
  void decayVertex(VertexPtr in) const {
    _decay=in;
    int temp;
    in->addIncoming(this,temp);
    _decayloc=temp;
    assert(temp==0);
    //if(temp!=0){cout << "something dodgy here can only decay once" << endl;}
  }

  /**
   * Get the vertex at which the particle decayed or branched.
   */
  tcVertexPtr decayVertex() const { return _decay; }
  //@}

  /** @name Access information about the associated particle. */
  //@{
  /**
   * Has the particle decayed?
   */
  bool decayed() const { return _decayed; }

  /**
   * Set if the particle has decayed.
   */
  void decayed(bool b) const { _decayed = b; }

  /**
   * Return true if the decay matrix required to perform the decays of
   * the siblings of a particle has been calculated.
   */
  DevelopedStatus developed() const { return _developed; }

  /**
   * Calculate the rho matrix for the decay if not already done.
   */
  void decay() const ;

  /**
   * Set the developed flag and calculate the D matrix for the decay.
   */
  void develop() const ;

  /**
   *  Needs update
   */
  void needsUpdate() const {_developed=NeedsUpdate;}

  /**
   * Return 2s+1 for the particle
   */
  PDT::Spin iSpin() const { return _spin; }

  /**
   * Return the momentum of the particle when it was produced.
   */
  const Lorentz5Momentum & productionMomentum() const {
    return _productionmomentum;
  }

  /**
   *  The current momentum of the particle
   */
  const Lorentz5Momentum & currentMomentum() const {
    return _currentmomentum;
  }

  /**
   * Return true if particle is timelike (rather than spacelike).
   */
  bool timelike() const { return _timelike; }
  //@}

  /**
   *  Access to the locations
   */
  //@{
  /**
   *  Production Location
   */
  int productionLocation() const {return _prodloc;}

  /**
   *  Decay Location
   */
  int decayLocation() const {return _decayloc;}
  //@}

public:

  /** @name Access the rho and D matrices. */
  //@{
  /**
   * Access the rho matrix.
   */
  RhoDMatrix rhoMatrix() const { return _rhomatrix; }

  /**
   * Access the rho matrix.
   */
  RhoDMatrix & rhoMatrix() { return _rhomatrix; }

  /**
   * Access the D matrix.
   */
  RhoDMatrix DMatrix() const { return _Dmatrix; }

  /**
   * Access the D matrix.
   */
  RhoDMatrix & DMatrix() { return _Dmatrix; }
  //@}

protected:

  /**
   *  Check if momentum is near to the current momentum
   */
  bool isNear(const Lorentz5Momentum & p) {
    return currentMomentum().isNear(p,_eps);
  }

private:

  /**
   * Describe a concrete class without persistent data.
   */
  static NoPIOClassDescription<SpinInfo> initSpinInfo;

  /**
   * Private and non-existent assignment operator.
   */
  SpinInfo & operator=(const SpinInfo &);

private:

  /**
   * Set the developed flag and calculate the D matrix for the decay,
   * and all decays further up the chain.
   */
  void redevelop() const ;

private:

  /**
   * Pointer to the production vertex for the particle
   */
  mutable VertexPtr _production;

  /**
   * Pointers to the decay vertex for the particle
   */
  mutable VertexPtr _decay;

  /**
   * Is this is timelike (true) or spacelike (false ) particle?  This
   * is used to decide if the particle is incoming or outgoing at the
   * production vertex
   */
  bool _timelike;

  /**
   * Location in the hard vertex array at production.
   */
  mutable int _prodloc;

  /**
   * Location in the hard vertex array at decay.
   */
  mutable int _decayloc;

  /**
   * Has the particle been decayed?  (I.e. has the rho matrix for the
   * decay been calculated.)
   */
  mutable bool _decayed;

  /**
   * Has the particle been developed?  (I.e. has the D matrix encoding
   * the info about the decay been calculated)
   */
  mutable DevelopedStatus _developed;

  /**
   * Storage of the rho matrix.
   */
  mutable RhoDMatrix _rhomatrix;

  /**
   * Storage of the decay matrix
   */
  mutable RhoDMatrix _Dmatrix;

  /**
   * The spin of the particle
   */
  PDT::Spin _spin;

  /**
   * Momentum of the particle when it was produced
   */
  Lorentz5Momentum _productionmomentum;

  /**
   * Momentum of the particle when it decayed
   */
  mutable Lorentz5Momentum _decaymomentum;
  
  /**
   * Current momentum of the particle
   */
  Lorentz5Momentum _currentmomentum;

  /**
   *  A small energy for comparing momenta to check if Lorentz Transformations
   *  should be performed
   */
  static const double _eps;
};

}


namespace ThePEG {

/** @cond TRAITSPECIALIZATIONS */

/**
 * This template specialization informs ThePEG about the base class of
 * SpinInfo.
 */
template <>
struct BaseClassTrait<ThePEG::SpinInfo,1>: public ClassTraitsType {
  /** Typedef of the base class of SpinInfo. */
  typedef EventInfoBase NthBase;
};

/**
 * This template specialization informs ThePEG about the name of the
 * SpinInfo class and the shared object where it is defined.
 */
template <>
struct ClassTraits<ThePEG::SpinInfo>
  : public ClassTraitsBase<ThePEG::SpinInfo> {
  /**
   * Return the class name.
   */
  static string className() { return "ThePEG::SpinInfo"; }
};

/** @endcond */

}

#endif /* ThePEG_SpinInfo_H */