C++InterfacetoTauola
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 /** Initialize TauSpinner
34 
35  Print info and set global variables */
36 void initialize_spinner(bool _Ipp, int _Ipol, int _nonSM2, int _nonSMN, double _CMSENE);
37 
38 /** Set flag for calculating relative (NONSM/SM) or absolute that is matrix element^2 (spin averaged),
39  weight for X-section calculated as by product in longitudinal polarization method. */
40 void setRelWTnonSM(int _relWTnonSM);
41 
42 /** set flag for simple formula (just Breit Wigner) of Higgs cross section,
43  set its parameters: Higgs mass, width and normalization for Higgs born (BW) function */
44  void setHiggsParameters(int jak, double mass, double width, double normalization);
45 
46 /** Get Higgs mass, width and normalization of Higgs born function */
47 void getHiggsParameters(double *mass, double *width, double *normalization);
48 
49 /** Set flag defining what type of spin treatment was used in analyzed sample */
50 void setSpinOfSample(bool _Ipol);
51 
52 /** Turn non Standard Model calculation on/off */
53 void setNonSMkey(int key);
54 
55 /** set transverse components for Higgs spin density matrix */
56 void setHiggsParametersTR(double Rxx, double Ryy, double Rxy, double Ryx);
57 
58 /** set multipliers for transverse components for Drell-Yan spin density matrix */
59 void setZgamMultipliersTR(double Rxx, double Ryy, double Rxy, double Ryx);
60 
61 /** get transverse components for Drell-Yan spin density matrix */
62 void getZgamParametersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx);
63 
64 /** Get nonSM weight of production matrix element */
65 double getWtNonSM();
66 
67 /** Get tau+ weight of its decay matrix element */
68 double getWtamplitP();
69 
70 /** Get tau- weight of its decay matrix element */
71 double getWtamplitM();
72 
73 /** Get tau Helicity
74  Used after event is analyzed to obtain attributed tau helicity.
75  Returns -1 or 1. Note that 0 is returned if attribution fails. Method
76  assumes that sample has spin effects taken into account. Effects can
77  be taken into account with the help of spin weights. */
78 double getTauSpin();
79 
80 /** Calculate weights.
81 
82  Determines decay channel, calculates all necessary components for
83  calculation of all weights, calculates weights.
84  Function for W+/- and H+/- */
85 double calculateWeightFromParticlesWorHpn(SimpleParticle &W, SimpleParticle &tau, SimpleParticle &nu_tau, vector<SimpleParticle> &tau_daughters);
86 
87 /** Calculate weights.
88 
89  Determines decay channel, calculates all necessary components for
90  calculation of all weights, calculates weights.
91  Function for H/Z */
92 double calculateWeightFromParticlesH(SimpleParticle &sp_X, SimpleParticle &sp_tau1, SimpleParticle &sp_tau2, vector<SimpleParticle> &sp_tau1_daughters, vector<SimpleParticle> &sp_tau2_daughters);
93 
94 /** Prepare kinematics for HH calculation
95 
96  Boost particles to effective pair rest frame, and rotate them so that tau is on Z axis.
97  Then rotate again with theta2 phi2 so neutrino (first tau decay product) from tau decay is along Z. */
98 void prepareKinematicForHH(Particle &tau, Particle &nu_tau, vector<Particle> &tau_daughters, double *phi2, double *theta2);
99 
100 /** Calculate polarization vector.
101 
102  We use FORTRAN metdods to calculate HH.
103  First decide what is the channel. After that, 4-vectors
104  are moved to tau rest frame of tau.
105  Polarimetric vector HH is then rotated using angles phi and theta.
106 
107  Order of the particles does not matter. */
108 double* calculateHH(int tau_pdgid, vector<Particle> &tau_daughters, double phi, double theta);
109 
110 /**
111  Get Longitudinal polarization
112 
113  Returns longitudinal polarization in Z/gamma* -> tau+ tau-
114  S: invariant mass^2 of the bozon */
115 double getLongitudinalPolarization(double S, SimpleParticle &sp_tau, SimpleParticle &sp_nu_tau);
116 
117 /** Check if the vector of particles match the listed order of pdgid's:
118 
119  1) Returns true if 'particles' contain all of the listed pdgid-s.
120  2) If it does - 'particles' will be reordered so that they have
121  the same order as listed pdgid-s.
122 
123  It is done so the order of particles is the same as the order mandatory
124  for TAUOLA Fortran routines. */
125 bool channelMatch(vector<Particle> &particles, int p1, int p2=0, int p3=0, int p4=0, int p5=0, int p6=0);
126 
127 //------------------------------------------------------------------------------
128 //-- Useful debug methods ------------------------------------------------------
129 //------------------------------------------------------------------------------
130 
131 /** Prints out two vertices:
132  W -> tau, nu_tau
133  tau -> tau_daughters */
134 void print(Particle &W, Particle &nu_tau, Particle &tau, vector<Particle> &tau_daughters);
135 
136 /** Sums all 4-vectors of the particles on the list */
137 Particle *vector_sum(vector<Particle> &x);
138 
139 } // namespace TauSpinner
140 #endif
double calculateWeightFromParticlesH(SimpleParticle &sp_X, SimpleParticle &sp_tau1, SimpleParticle &sp_tau2, vector< SimpleParticle > &sp_tau1_daughters, vector< SimpleParticle > &sp_tau2_daughters)
double calculateWeightFromParticlesWorHpn(SimpleParticle &W, SimpleParticle &tau, SimpleParticle &nu_tau, vector< SimpleParticle > &tau_daughters)
void print(Particle &W, Particle &nu_tau, Particle &tau, vector< Particle > &tau_daughters)
void setHiggsParameters(int jak, double mass, double width, double normalization)
void setSpinOfSample(bool _Ipol)
void getZgamParametersTR(double &Rxx, double &Ryy, double &Rxy, double &Ryx)
double getWtamplitP()
void setRelWTnonSM(int _relWTnonSM)
void setZgamMultipliersTR(double Rxx, double Ryy, double Rxy, double Ryx)
double getTauSpin()
void prepareKinematicForHH(Particle &tau, Particle &nu_tau, vector< Particle > &tau_daughters, double *phi2, double *theta2)
double getLongitudinalPolarization(double, SimpleParticle &, SimpleParticle &)
double * calculateHH(int tau_pdgid, vector< Particle > &tau_daughters, double phi, double theta)
void setNonSMkey(int key)
double disth_(double *SVAR, double *COSTHE, int *TA, int *TB)
void getHiggsParameters(double *mass, double *width, double *normalization)
bool channelMatch(vector< Particle > &particles, int p1, int p2=0, int p3=0, int p4=0, int p5=0, int p6=0)
double getWtNonSM()
Particle * vector_sum(vector< Particle > &x)
double getWtamplitM()
void setHiggsParametersTR(double Rxx, double Ryy, double Rxy, double Ryx)
void initialize_spinner(bool _Ipp, int _Ipol, int _nonSM2, int _nonSMN, double _CMSENE)