StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gamovCorrect.cc
1 #ifndef STHBT_GAMOVCORRECT
2 #define STHBT_GAMOVCORRECT
3 
4 
5 #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
6 #include "StHbtMaker/Infrastructure/StHbtPair.hh"
7 #include "PhysicalConstants.h"
8 //#include <cstdio>
9 
10 
11 double gamovCorrect(const StHbtPair* pair,
12  const double& charge) {
13  static double px1,py1,pz1,px2,py2,pz2;
14  static double px1new,py1new,pz1new;
15  static double px2new,py2new,pz2new;
16  static double vx1cms,vy1cms,vz1cms;
17  static double vx2cms,vy2cms,vz2cms;
18  static double VcmsX,VcmsY,VcmsZ;
19  static double dv = 0.0;
20  static double e1,e2,e1new,e2new;
21  static double psi,theta;
22  static double beta,gamma;
23  static double VcmsXnew;
24 
25  // G = 2*pi*(eta)/(Exp(2*pi*(eta))-1)
26  // eta = Z1*Z2*e^2/((h_bar)*c* Vel(rel) )
27  px1 = pair->track1()->FourMomentum().px();
28  py1 = pair->track1()->FourMomentum().py();
29  pz1 = pair->track1()->FourMomentum().pz();
30  e1 = pair->track1()->FourMomentum().e();
31  px2 = pair->track2()->FourMomentum().px();
32  py2 = pair->track2()->FourMomentum().py();
33  pz2 = pair->track2()->FourMomentum().pz();
34  e2 = pair->track2()->FourMomentum().e();
35 
36  VcmsX = ( px1+px2 )/( e1+e2 );
37  VcmsY = ( py1+py2 )/( e1+e2 );
38  VcmsZ = ( pz1+pz2 )/( e1+e2 );
39  // Rotate Vcms to x-direction
40  psi = atan(VcmsY/VcmsX);
41  VcmsXnew = VcmsX*cos(psi)+VcmsY*sin(psi);
42  VcmsX = VcmsXnew;
43  theta = atan(VcmsZ/VcmsX);
44  VcmsXnew = VcmsX*cos(theta)+VcmsZ*sin(theta);
45  VcmsX = VcmsXnew;
46  // Gamma and Beta
47  beta = VcmsX;
48  gamma = 1.0/::sqrt( 1.0-beta*beta );
49 
50  // Rotate p1 and p2 to new frame
51  px1new = px1*cos(psi)+py1*sin(psi);
52  py1new = -px1*sin(psi)+py1*cos(psi);
53  px1 = px1new;
54  px1new = px1*cos(theta)+pz1*sin(theta);
55  pz1new = -px1*sin(theta)+pz1*cos(theta);
56  px1 = px1new;
57  py1 = py1new;
58  pz1 = pz1new;
59 
60  px2new = px2*cos(psi)+py2*sin(psi);
61  py2new = -px2*sin(psi)+py2*cos(psi);
62  px2 = px2new;
63  px2new = px2*cos(theta)+pz2*sin(theta);
64  pz2new = -px2*sin(theta)+pz2*cos(theta);
65  px2 = px2new;
66  py2 = py2new;
67  pz2 = pz2new;
68 
69  // Lorentz transform the x component and energy
70  e1new = gamma*e1 - gamma*beta*px1;
71  px1new = -gamma*beta*e1 + gamma*px1;
72  e2new = gamma*e2 - gamma*beta*px2;
73  px2new = -gamma*beta*e2 + gamma*px2;
74  px1 = px1new;
75  px2 = px2new;
76 
77  // New velocities
78  vx1cms = px1/e1new;
79  vy1cms = py1/e1new;
80  vz1cms = pz1/e1new;
81  vx2cms = px2/e2new;
82  vy2cms = py2/e2new;
83  vz2cms = pz2/e2new;
84 
85  // Velocity difference in CMS frame
86  dv = ::sqrt( (vx1cms-vx2cms)*(vx1cms-vx2cms) +
87  (vy1cms-vy2cms)*(vy1cms-vy2cms) +
88  (vz1cms-vz2cms)*(vz1cms-vz2cms) );
89 
90  // Assumes same charge particles
91  double eta = charge*fine_structure_const/( dv );
92  double gamov = twopi*eta/(exp(twopi*eta)-1);
93  return (gamov);
94 }
95 
96 #endif