C++ Interface to Tauola
include/TauSpinner/tau_reweight_lib.h
1 #ifndef _TAU_REWEIGHT_LIB_H_
2 #define _TAU_REWEIGHT_LIB_H_
3 
4 // Debug mode
5 #ifdef DEBUG_MODE
6 #define DEBUG(arg) arg;
7 #else
8 #define DEBUG(arg)
9 #endif
10 
11 // TAUOLA header
12 #include "Tauola/Tauola.h"
13 
14 #include "TauSpinner/Tauola_wrapper.h"
15 #include "TauSpinner/SimpleParticle.h"
16 #include "TauSpinner/Particle.h"
17 
18 // LHAPDF header
19 #include "LHAPDF/LHAPDF.h"
20 
21 #include <vector>
22 #include <iostream>
23 using std::vector;
24 using std::cout;
25 using std::endl;
26 
27 namespace TauSpinner {
28 
29 /** Definition of REAL*8 FUNCTION DISTH(S,T,H1,H2) from disth.f calculating
30  SM glue glue-->Higgs --> tau tau*/
31 extern "C" double disth_(double *SVAR, double *COSTHE, int *TA, int *TB);
32 
33 /** routine to modifiey electroweak FF */
34  void GSWadapt(int ID,double S, double cost, double GSWr[7],double GSWi[7]);
35  /** routine to rotate R for mustraal frames */
36  void Rotin(double phi, double R[4][4]);
37 /** Initialize TauSpinner
38 
39  Print info and set global variables */
40 void initialize_spinner(bool _Ipp, int _Ipol, int _nonSM2, int _nonSMN, double _CMSENE);
41 
42 /**
43  Initialize anomalous dipole moments 8=2*2*2 constants:
44  magnetic/electric * real/imaginary parts * for virtual photon/ for Z,
45  and its switches ifGSW, ifkorch, iqed
46  ifGSW electroweak form-factors need to be on for Korchin calculations?
47 */
48  void initialize_GSW( int _ifGSW, int _ifkorch, int _iqed,
49  double _ReAini,
50  double _ImAini,
51  double _ReBini,
52  double _ImBini,
53  double _ReXini,
54  double _ImXini,
55  double _ReYini,
56  double _ImYini);
57 
58 /**
59  Initialize anomalous gamma gamma couplings target A and B, in sample A0i B0i
60  if sample is of no anonmalous couplings set A0i B0i to zero.
61  Also how much of gamma gamma process there should be, with respect to quarks.
62  In sample GAMfraci. In target GAMfrac2i.
63 */
65  double _GAMfraci,
66  double _GAMfrac2i,
67  double _A0i,
68  double _B0i,
69  double _Ai,
70  double _Bi);
71 
72 
73 /**
74 User may want to modify form-factors, this routine enables that.
75 */
76  void initialize_GSW_norm(int _keyGSW,
77  double _ReGSW1,
78  double _ImGSW1,
79  double _ReGSW2,
80  double _ImGSW2,
81  double _ReGSW3,
82  double _ImGSW3,
83  double _ReGSW4,
84  double _ImGSW4,
85  double _ReGSW5,
86  double _ImGSW5,
87  double _ReGSW6,
88  double _ImGSW6);
89 
90 /** Set flag for calculating relative (NONSM/SM) or absolute that is matrix element^2 (spin averaged),
91  weight for X-section calculated as by product in longitudinal polarization method. */
92 void setRelWTnonSM(int _relWTnonSM);
93 
94 /** Set flag for type of effective Born kinematic approximation
95  1: Mustraal frame (NLO like) 0: old default, similar to Collins-Soper. */
96 void setFrameType(int _FrameType);
97 
98 /** set flag for simple formula (just Breit Wigner) of Higgs cross section,
99  set its parameters: Higgs mass, width and normalization for Higgs born (BW) function */
100  void setHiggsParameters(int jak, double mass, double width, double normalization);
101 
102 /** Get Higgs mass, width and normalization of Higgs born function */
103 void getHiggsParameters(double *mass, double *width, double *normalization);
104 
105 /** Set flag defining what type of spin treatment was used in analyzed sample */
106 void setSpinOfSample(bool _Ipol);
107 
108 /** Turn non Standard Model calculation on/off */
109 void setNonSMkey(int key);
110 
111 /** set transverse components for Higgs spin density matrix */
112 void setHiggsParametersTR(double Rxx, double Ryy, double Rxy, double Ryx);
113 
114 /** set multipliers for transverse components for Drell-Yan spin density matrix */
115 void setZgamMultipliersTR(double Rxx, double Ryy, double Rxy, double Ryx);
116 
117 /** get transverse components for Drell-Yan spin density matrix */
118 void getZgamParametersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx);
119 
120 /** get longitudinal (or time) - transverse components for Drell-Yan spin density matrix */
121  void getZgamParametersL(double &Rzx, double &Rzy, double &Rzz, double &Rtx, double &Rty, double &Rtz);
122 
123 /** get transverse components for Drell-Yan spin density matrix multipliers */
124 void getZgamMultipliersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx);
125 
126 /** get polarimetric vectors*/
127 void getHH(double &HHmx, double &HHmy, double &HHmz, double &HHpx, double &HHpy, double &HHpz);
128 
129 /** Get nonSM weight of production matrix element */
130 double getWtNonSM();
131 
132 /** Get tau+ weight of its decay matrix element */
133 double getWtamplitP();
134 
135 /** Get tau- weight of its decay matrix element */
136 double getWtamplitM();
137 
138 /** Get tau Helicity
139  Used after event is analyzed to obtain attributed tau helicity.
140  Returns -1 or 1. Note that 0 is returned if attribution fails. Method
141  assumes that sample has spin effects taken into account. Effects can
142  be taken into account with the help of spin weights. */
143 double getTauSpin();
144 
145 /** Calculate weights.
146 
147  Determines decay channel, calculates all necessary components for
148  calculation of all weights, calculates weights.
149  Function for W+/- and H+/- */
150 double calculateWeightFromParticlesWorHpn(SimpleParticle &W, SimpleParticle &tau, SimpleParticle &nu_tau, vector<SimpleParticle> &tau_daughters);
151 
152 /** Calculate weights.
153 
154  Determines decay channel, calculates all necessary components for
155  calculation of all weights, calculates weights.
156  Function for H/Z */
157 double calculateWeightFromParticlesH(SimpleParticle &sp_X, SimpleParticle &sp_tau1, SimpleParticle &sp_tau2, vector<SimpleParticle> &sp_tau1_daughters, vector<SimpleParticle> &sp_tau2_daughters);
158 
159 /** Prepare kinematics for HH calculation
160 
161  Boost particles to effective pair rest frame, and rotate them so that tau is on Z axis.
162  Then rotate again with theta2 phi2 so neutrino (first tau decay product) from tau decay is along Z. */
163 void prepareKinematicForHH(Particle &tau, Particle &nu_tau, vector<Particle> &tau_daughters, double *phi2, double *theta2);
164 
165 /** Calculate polarization vector.
166 
167  We use FORTRAN metdods to calculate HH.
168  First decide what is the channel. After that, 4-vectors
169  are moved to tau rest frame of tau.
170  Polarimetric vector HH is then rotated using angles phi and theta.
171 
172  Order of the particles does not matter. */
173 double* calculateHH(int tau_pdgid, vector<Particle> &tau_daughters, double phi, double theta);
174 
175 /**
176  Get Longitudinal polarization
177 
178  Returns longitudinal polarization in Z/gamma* -> tau+ tau-
179  S: invariant mass^2 of the bozon */
180 double getLongitudinalPolarization(double S, SimpleParticle &sp_tau, SimpleParticle &sp_nu_tau);
181 
182 /** Check if the vector of particles match the listed order of pdgid's:
183 
184  1) Returns true if 'particles' contain all of the listed pdgid-s.
185  2) If it does - 'particles' will be reordered so that they have
186  the same order as listed pdgid-s.
187 
188  It is done so the order of particles is the same as the order mandatory
189  for TAUOLA Fortran routines. */
190 bool channelMatch(vector<Particle> &particles, int p1, int p2=0, int p3=0, int p4=0, int p5=0, int p6=0);
191 
192 //------------------------------------------------------------------------------
193 //-- Useful debug methods ------------------------------------------------------
194 //------------------------------------------------------------------------------
195 
196 /** Prints out two vertices:
197  W -> tau, nu_tau
198  tau -> tau_daughters */
199 void print(Particle &W, Particle &nu_tau, Particle &tau, vector<Particle> &tau_daughters);
200 
201 /** Sums all 4-vectors of the particles on the list */
202 Particle *vector_sum(vector<Particle> &x);
203 
204 } // namespace TauSpinner
205 #endif
void initialize_gamagama(double _GAMfraci, double _GAMfrac2i, double _A0i, double _B0i, double _Ai, double _Bi)
void initialize_GSW_norm(int _keyGSW, double _ReGSW1, double _ImGSW1, double _ReGSW2, double _ImGSW2, double _ReGSW3, double _ImGSW3, double _ReGSW4, double _ImGSW4, double _ReGSW5, double _ImGSW5, double _ReGSW6, double _ImGSW6)
double calculateWeightFromParticlesH(SimpleParticle &sp_X, SimpleParticle &sp_tau1, SimpleParticle &sp_tau2, vector< SimpleParticle > &sp_tau1_daughters, vector< SimpleParticle > &sp_tau2_daughters)
void initialize_GSW(int _ifGSW, int _ifkorch, int _iqed, double _ReAini, double _ImAini, double _ReBini, double _ImBini, double _ReXini, double _ImXini, double _ReYini, double _ImYini)
bool channelMatch(vector< Particle > &particles, int p1, int p2=0, int p3=0, int p4=0, int p5=0, int p6=0)
double disth_(double *SVAR, double *COSTHE, int *TA, int *TB)
double calculateWeightFromParticlesWorHpn(SimpleParticle &W, SimpleParticle &tau, SimpleParticle &nu_tau, vector< SimpleParticle > &tau_daughters)
void getZgamMultipliersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx)
void setSpinOfSample(bool _Ipol)
double getWtamplitP()
void Rotin(double phi, double R[4][4])
void getZgamParametersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx)
double getLongitudinalPolarization(double, SimpleParticle &, SimpleParticle &)
void getHiggsParameters(double *mass, double *width, double *normalization)
void setZgamMultipliersTR(double Rxx, double Ryy, double Rxy, double Ryx)
void setFrameType(int _FrameType)
void getZgamParametersL(double &Rzx, double &Rzy, double &Rzz, double &Rtx, double &Rty, double &Rtz)
Particle * vector_sum(vector< Particle > &x)
void setNonSMkey(int key)
double getWtNonSM()
double * calculateHH(int tau_pdgid, vector< Particle > &tau_daughters, double phi, double theta)
void setHiggsParametersTR(double Rxx, double Ryy, double Rxy, double Ryx)
void getHH(double &HHmx, double &HHmy, double &HHmz, double &HHpx, double &HHpy, double &HHpz)
void GSWadapt(int ID, double S, double cost, double GSWr[7], double GSWi[7])
void setRelWTnonSM(int _relWTnonSM)
void print(Particle &W, Particle &nu_tau, Particle &tau, vector< Particle > &tau_daughters)
void initialize_spinner(bool _Ipp, int _Ipol, int _nonSM2, int _nonSMN, double _CMSENE)
void prepareKinematicForHH(Particle &tau, Particle &nu_tau, vector< Particle > &tau_daughters, double *phi2, double *theta2)
void setHiggsParameters(int jak, double mass, double width, double normalization)
double getTauSpin()
double getWtamplitM()