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 /** Initialize TauSpinner
36 
37  Print info and set global variables */
38 void initialize_spinner(bool _Ipp, int _Ipol, int _nonSM2, int _nonSMN, double _CMSENE);
39 
40  void initialize_GSW( int _ifGSW, int _ifkorch,
41  double _ReAini,
42  double _ImAini,
43  double _ReBini,
44  double _ImBini,
45  double _ReXini,
46  double _ImXini,
47  double _ReYini,
48  double _ImYini);
49 
50  void initialize_gamagama(
51  double _GAMfraci,
52  double _GAMfrac2i,
53  double _A0i,
54  double _B0i,
55  double _Ai,
56  double _Bi);
57 
58 
59 /**
60 User may want to modify form-factors, this routine enables that.
61 */
62  void initialize_GSW_norm(int _keyGSW,
63  double _ReGSW1,
64  double _ImGSW1,
65  double _ReGSW2,
66  double _ImGSW2,
67  double _ReGSW3,
68  double _ImGSW3,
69  double _ReGSW4,
70  double _ImGSW4,
71  double _ReGSW5,
72  double _ImGSW5,
73  double _ReGSW6,
74  double _ImGSW6);
75 
76 /** Set flag for calculating relative (NONSM/SM) or absolute that is matrix element^2 (spin averaged),
77  weight for X-section calculated as by product in longitudinal polarization method. */
78 void setRelWTnonSM(int _relWTnonSM);
79 
80 /** Set flag for type of effective Born kinematic approximation
81  1: Mustraal frame (NLO like) 0: old default, similar to Collins-Soper. */
82 void setFrameType(int _FrameType);
83 
84 /** set flag for simple formula (just Breit Wigner) of Higgs cross section,
85  set its parameters: Higgs mass, width and normalization for Higgs born (BW) function */
86  void setHiggsParameters(int jak, double mass, double width, double normalization);
87 
88 /** Get Higgs mass, width and normalization of Higgs born function */
89 void getHiggsParameters(double *mass, double *width, double *normalization);
90 
91 /** Set flag defining what type of spin treatment was used in analyzed sample */
92 void setSpinOfSample(bool _Ipol);
93 
94 /** Turn non Standard Model calculation on/off */
95 void setNonSMkey(int key);
96 
97 /** set transverse components for Higgs spin density matrix */
98 void setHiggsParametersTR(double Rxx, double Ryy, double Rxy, double Ryx);
99 
100 /** set multipliers for transverse components for Drell-Yan spin density matrix */
101 void setZgamMultipliersTR(double Rxx, double Ryy, double Rxy, double Ryx);
102 
103 /** get transverse components for Drell-Yan spin density matrix */
104 void getZgamParametersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx);
105 
106 /** get longitudinal components for Drell-Yan spin density matrix */
107 void getZgamParametersL(double &Rzz, double &Rtt, double &Rzt, double &Rtz);
108 
109 /** get transverse components for Drell-Yan spin density matrix multipliers */
110 void getZgamMultipliersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx);
111 
112 
113 /** Get nonSM weight of production matrix element */
114 double getWtNonSM();
115 
116 /** Get tau+ weight of its decay matrix element */
117 double getWtamplitP();
118 
119 /** Get tau- weight of its decay matrix element */
120 double getWtamplitM();
121 
122 /** Get tau Helicity
123  Used after event is analyzed to obtain attributed tau helicity.
124  Returns -1 or 1. Note that 0 is returned if attribution fails. Method
125  assumes that sample has spin effects taken into account. Effects can
126  be taken into account with the help of spin weights. */
127 double getTauSpin();
128 
129 /** Calculate weights.
130 
131  Determines decay channel, calculates all necessary components for
132  calculation of all weights, calculates weights.
133  Function for W+/- and H+/- */
134 double calculateWeightFromParticlesWorHpn(SimpleParticle &W, SimpleParticle &tau, SimpleParticle &nu_tau, vector<SimpleParticle> &tau_daughters);
135 
136 /** Calculate weights.
137 
138  Determines decay channel, calculates all necessary components for
139  calculation of all weights, calculates weights.
140  Function for H/Z */
141 double calculateWeightFromParticlesH(SimpleParticle &sp_X, SimpleParticle &sp_tau1, SimpleParticle &sp_tau2, vector<SimpleParticle> &sp_tau1_daughters, vector<SimpleParticle> &sp_tau2_daughters);
142 
143 /** Prepare kinematics for HH calculation
144 
145  Boost particles to effective pair rest frame, and rotate them so that tau is on Z axis.
146  Then rotate again with theta2 phi2 so neutrino (first tau decay product) from tau decay is along Z. */
147 void prepareKinematicForHH(Particle &tau, Particle &nu_tau, vector<Particle> &tau_daughters, double *phi2, double *theta2);
148 
149 /** Calculate polarization vector.
150 
151  We use FORTRAN metdods to calculate HH.
152  First decide what is the channel. After that, 4-vectors
153  are moved to tau rest frame of tau.
154  Polarimetric vector HH is then rotated using angles phi and theta.
155 
156  Order of the particles does not matter. */
157 double* calculateHH(int tau_pdgid, vector<Particle> &tau_daughters, double phi, double theta);
158 
159 /**
160  Get Longitudinal polarization
161 
162  Returns longitudinal polarization in Z/gamma* -> tau+ tau-
163  S: invariant mass^2 of the bozon */
164 double getLongitudinalPolarization(double S, SimpleParticle &sp_tau, SimpleParticle &sp_nu_tau);
165 
166 /** Check if the vector of particles match the listed order of pdgid's:
167 
168  1) Returns true if 'particles' contain all of the listed pdgid-s.
169  2) If it does - 'particles' will be reordered so that they have
170  the same order as listed pdgid-s.
171 
172  It is done so the order of particles is the same as the order mandatory
173  for TAUOLA Fortran routines. */
174 bool channelMatch(vector<Particle> &particles, int p1, int p2=0, int p3=0, int p4=0, int p5=0, int p6=0);
175 
176 //------------------------------------------------------------------------------
177 //-- Useful debug methods ------------------------------------------------------
178 //------------------------------------------------------------------------------
179 
180 /** Prints out two vertices:
181  W -> tau, nu_tau
182  tau -> tau_daughters */
183 void print(Particle &W, Particle &nu_tau, Particle &tau, vector<Particle> &tau_daughters);
184 
185 /** Sums all 4-vectors of the particles on the list */
186 Particle *vector_sum(vector<Particle> &x);
187 
188 } // namespace TauSpinner
189 #endif
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)
bool channelMatch(vector< Particle > &particles, int p1, int p2=0, int p3=0, int p4=0, int p5=0, int p6=0)
void getZgamParametersL(double &Rzz, double &Rtt, double &Rzt, double &Rtz)
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 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)
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 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()