CMS 3D CMS Logo

ColinsSoperVariables.h
Go to the documentation of this file.
1 #define CM_ENERGY 7000.0
2 #include "TLorentzVector.h"
3 #include "TVector3.h"
4 
5 
6 // calculate the Colins-Soper variables;
7 // everything is in the lab frame
8 void calCSVariables(TLorentzVector mu, TLorentzVector mubar,
9  double *res, bool swap) {
10 
11  // convention. beam direction is on the positive Z direction.
12  // beam contains quark flux.
13  TLorentzVector Pbeam (0, 0, CM_ENERGY/2.0, CM_ENERGY/2.0);
14  TLorentzVector Ptarget(0, 0, -CM_ENERGY/2.0, CM_ENERGY/2.0);
15 
16 
17  TLorentzVector Q(mu+mubar);
18  /************************************************************************
19  *
20  * 1) cos(theta) = 2 Q^-1 (Q^2+Qt^2)^-1 (mu^+ mubar^- - mu^- mubar^+)
21  *
22  *
23  ************************************************************************/
24  double muplus = 1.0/sqrt(2.0) * (mu.E() + mu.Z());
25  double muminus = 1.0/sqrt(2.0) * (mu.E() - mu.Z());
26 
27  double mubarplus = 1.0/sqrt(2.0) * (mubar.E() + mubar.Z());
28  double mubarminus = 1.0/sqrt(2.0) * (mubar.E() - mubar.Z());
29 
30  double costheta = 2.0 / Q.Mag() / sqrt(pow(Q.Mag(), 2) + pow(Q.Pt(), 2)) *
31  (muplus * mubarminus - muminus * mubarplus);
32  if (swap) costheta = -costheta;
33 
34 
35 
36  /************************************************************************
37  *
38  * 2) sin2(theta) = Q^-2 Dt^2 - Q^-2 (Q^2 + Qt^2)^-1 * (Dt dot Qt)^2
39  *
40  ************************************************************************/
41  TLorentzVector D(mu-mubar);
42  double dt_qt = D.X()*Q.X() + D.Y()*Q.Y();
43  double sin2theta = pow(D.Pt()/Q.Mag(), 2)
44  - 1.0/pow(Q.Mag(), 2)/(pow(Q.Mag(), 2) + pow(Q.Pt(), 2))*pow(dt_qt, 2);
45 
46 
47 
48  /************************************************************************
49  *
50  * 3) tanphi = (Q^2 + Qt^2)^1/2 / Q (Dt dot R unit) /(Dt dot Qt unit)
51  *
52  ************************************************************************/
53  // unit vector on R direction
54  TVector3 R = Pbeam.Vect().Cross(Q.Vect());
55  TVector3 Runit = R.Unit();
56 
57 
58  // unit vector on Qt
59  TVector3 Qt = Q.Vect(); Qt.SetZ(0);
60  TVector3 Qtunit = Qt.Unit();
61 
62 
63  TVector3 Dt = D.Vect(); Dt.SetZ(0);
64  double tanphi = sqrt(pow(Q.Mag(), 2) + pow(Q.Pt(), 2)) / Q.Mag() *
65  Dt.Dot(Runit) / Dt.Dot(Qtunit);
66  if (swap) tanphi = -tanphi;
67 
68  res[0] = costheta;
69  res[1] = sin2theta;
70  res[2] = tanphi;
71 }
72 
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
Definition: Electron.h:4
#define CM_ENERGY
T sqrt(T t)
Definition: SSEVec.h:18
const int mu
Definition: Constants.h:22
const int mubar
Definition: Constants.h:23
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:151
void calCSVariables(TLorentzVector mu, TLorentzVector mubar, double *res, bool swap)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40