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