C++InterfacetoTauola
include/Tauola/TauolaParticlePair.h
1 #ifndef _TauolaParticlePair_h_included_
2 #define _TauolaParticlePair_h_included_
3 
4 /**
5  * @class TauolaParticlePair
6  *
7  * @brief Contains two TauolaParticle that are related by
8  * the same mother. Spin correlations are handled here.
9  *
10  * An object of TauolaParticlePair contains two TauolaParticle
11  * that are related by the same mother. Generally this will be
12  * a tau+ and tau- or a tau and tau neutrino. For the case of
13  * event records that contain multiple instances of the same
14  * particle. eg. tau -> gamma tau or simply tau -> tau. Both
15  * the tau from the production vertex, and the final tau before
16  * the decay vertex are stored. This allows better handling
17  * of spin correlations. The decay is done in the rest frame of
18  * the final tau, where as the spin weight is calculated in the
19  * rest frame of the production tau. All spin weights are done
20  * in this class. Please refer to the decayTauPairs() method.
21  *
22  * @author Nadia Davidson
23  * @date 17 June 2008
24  */
25 
26 
27 #include <iostream>
28 #include <vector>
29 #include <math.h>
30 #include "TauolaParticle.h"
31 
32 // Forward declarations for friend function
33 namespace TauSpinner {
34  class SimpleParticle;
36 }
37 
38 namespace Tauolapp
39 {
40 
42 
43  public:
44 
45  // needed to access m_R matrix and recalculateRij() function.
46  friend class Plots;
48 
49  /** This constructor takes the TauolaParticle and traverse
50  the event structure to find the mother, partner tau or tau
51  neutrino and assosiated final and production versions.
52  Once a TauolaParticlePair object has been created in this way
53  it is ready to be decayed via decayTauPairs(). */
54  TauolaParticlePair(std::vector<TauolaParticle*> &particle_list);
55 
56  /** Call the decay method of each 'final' tau. Then calculate
57  the spin correlation weight from the particles polarimetric
58  vectors. Decays are accepted or rejected based on the spin
59  weight. Rejected decays are redecayed. */
60  void decayTauPair();
61 
62  /** Does this pair contain the particle "particle". Note: it only
63  checks the "final" particles. */
64  bool contains(TauolaParticle * particle);
65 
66  /** Return the tau+ particle */
67  TauolaParticle * getTauPlus(std::vector<TauolaParticle*> particles);
68 
69  /** Return the tau- particle */
70  TauolaParticle * getTauMinus(std::vector<TauolaParticle*> particles);
71 
72  /** Return the first grandmother of the tau-
73  which is an anti-quark or anti-lepton. */
74  TauolaParticle * getGrandmotherPlus(std::vector<TauolaParticle*> particles);
75 
76  /** Return the first grandmother of the tau-
77  which is a quark or lepton. */
78  TauolaParticle * getGrandmotherMinus(std::vector<TauolaParticle*> particles);
79 
80  /** Print information about the mother and tau pair (at production and final). */
81  void print();
82 
83  /** Check that the 4 momentum in conserved at the verticle of
84  each decayed tau. */
86 
87  private:
88 
89  /** Default constructor is private, so that only friend class can use it. */
91 
92  /** Store born variables in Tauola class, so the user can retrieve
93  them using Tauola::getBornKinematics. */
94  static void setBornKinematics(int incoming_pdg_id, int outgoing_pdg_id, double invariant_mass_squared, double cosTheta);
95 
96  /** Pointers to taus (or tau and neutrino) as they
97  are before being decayed. */
98  std::vector<TauolaParticle*> m_final_particles;
99 
100  /** Pointers to taus (or tau and neutrino) as they
101  are after production. */
102  std::vector<TauolaParticle*> m_production_particles;
103 
104  /** Pointer to mothers of the tau pair. */
106 
107  /** Is there an entry in the event record for the tau pair's mother? */
109 
110  /** vector of pointers to the taus grandparents */
111  std::vector<TauolaParticle*> m_grandmothers;
112 
113  /** If SANC tables are present, use them to recalculate the matrix Rij. */
114  void recalculateRij(int incoming_pdg_id, int outgoing_pdg_id, double invariant_mass_squared, double cosTheta);
115 
116  /** Rotate the whole system using the given angle theta. */
117  void rotateSystem(vector<TauolaParticle *> grandmothers,
118  vector<TauolaParticle *> taus,
119  double theta,
120  int axis,
121  int axis2=TauolaParticle::Z_AXIS);
122 
123 
124  /** Boost the outgoing tau and partner and the incoming grandparents of
125  the tau to the mothers rest frame. The mother is not boosted.
126  The axis are rotated so that the particle given by "z_axis_particle" is aligned
127  on the z-axis. If "alignment" is -1 is will be aligned in the negative z direction.
128  otherwise it is aligned in the positive direction. rotaion_angle(1-3) are
129  returned to allow reversal of the transformation (through the method
130  boostFromMotherToLabFrame).*/
131  void boostFromLabToTauPairFrame(double * rotation_angle1,
132  double * rotation_angle2,
133  double * rotation_angle3,
134  TauolaParticle * mother,
135  vector<TauolaParticle *> grandmothers,
136  vector<TauolaParticle *> taus);
137 
138  /** Reverses the transformation of boostFromLabToMothersFrame. **/
139  void boostFromTauPairToLabFrame(double rotation_angle1,
140  double rotation_angle2,
141  double rotation_angle3,
142  TauolaParticle * mother,
143  vector<TauolaParticle *> grandmothers,
144  vector<TauolaParticle *> taus);
145 
146  /** The density matric m_R is filled based on the mothers type and kinematics
147  of the event in the mothers rest frame. */
149 
150  /** create a particle which m_mother points to. This is based on the
151  daughters 4-momentum and particle type. A Z or W is assumed if the
152  configuration of taus and neutrinos is correct. This particle is not
153  written into the event record, but it used by the fillDenistyMatrix
154  method for spin correlations */
155  TauolaParticle * makeTemporaryMother(vector<TauolaParticle *> taus);
156 
157  /**Needs to be changed*/
158  //void ANGULU(int *IDE, int *IDF, double *SVAR, double *COSTHE);
159  /**Needs to be changed*/
160  double getZPolarization(int *incoming_pdg_id,
161  int *outgoing_pdg_id,
162  double *invMass,
163  double *cosTheta);
164 
165  /** Private function, calculates virtuality between two particles. */
166  double getVirtuality(TauolaParticle * p1, TauolaParticle*p2, bool flip);
167 
168  /** Add particle to beam. */
169  void addToBeam(TauolaParticle * pcle,
170  std::vector<TauolaParticle*> * candidates_same,
171  std::vector<TauolaParticle*> * candidates_opp);
172 
173 
174  /** frames in which it is defined are fixed by the methods
175  boostFromLabToMotherFrame and boostFromMotherToLabFrame.
176  Modification to m_R and boostFrom/ToMotherFrame must be done
177  coherently. */
178  double m_R[4][4]; //density matrix
179 };
180 
181 //Temporary
182 //Pz is still calculated using the FORTRAN routine in tauola_extra.f
183 //This should be migrated to C++ at some stage.
184 extern "C" {
185  extern double plzap0_(int *incoming_pdg_id,
186  int *outgoing_pdg_id,
187  double *invMass,
188  double *cosTheta);
189 }
190 
191 } // namespace Tauolapp
192 #endif
193 
TauolaParticle * getTauMinus(std::vector< TauolaParticle * > particles)
void addToBeam(TauolaParticle *pcle, std::vector< TauolaParticle * > *candidates_same, std::vector< TauolaParticle * > *candidates_opp)
TauolaParticle * getGrandmotherPlus(std::vector< TauolaParticle * > particles)
double getZPolarization(int *incoming_pdg_id, int *outgoing_pdg_id, double *invMass, double *cosTheta)
void recalculateRij(int incoming_pdg_id, int outgoing_pdg_id, double invariant_mass_squared, double cosTheta)
double getLongitudinalPolarization(double, SimpleParticle &, SimpleParticle &)
std::vector< TauolaParticle * > m_final_particles
bool contains(TauolaParticle *particle)
double getVirtuality(TauolaParticle *p1, TauolaParticle *p2, bool flip)
void rotateSystem(vector< TauolaParticle * > grandmothers, vector< TauolaParticle * > taus, double theta, int axis, int axis2=TauolaParticle::Z_AXIS)
std::vector< TauolaParticle * > m_grandmothers
void boostFromTauPairToLabFrame(double rotation_angle1, double rotation_angle2, double rotation_angle3, TauolaParticle *mother, vector< TauolaParticle * > grandmothers, vector< TauolaParticle * > taus)
TauolaParticle * getTauPlus(std::vector< TauolaParticle * > particles)
std::vector< TauolaParticle * > m_production_particles
static void setBornKinematics(int incoming_pdg_id, int outgoing_pdg_id, double invariant_mass_squared, double cosTheta)
TauolaParticle * getGrandmotherMinus(std::vector< TauolaParticle * > particles)
void boostFromLabToTauPairFrame(double *rotation_angle1, double *rotation_angle2, double *rotation_angle3, TauolaParticle *mother, vector< TauolaParticle * > grandmothers, vector< TauolaParticle * > taus)
TauolaParticle * makeTemporaryMother(vector< TauolaParticle * > taus)