Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sPHElectronPairv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file sPHElectronPairv1.cc
1 #include <TLorentzVector.h>
2 
3 #include "sPHElectronPairv1.h"
4 
6 {
7  _id = -99999;
8  _type = 0;
9  _e1 = sPHElectronv1();
10  _e2 = sPHElectronv1();
11 }
12 
14 {
15  _id = e1->get_id() + e2->get_id()*100000;
16  _type = 0;
17  _e1 = *e1;
18  _e2 = *e2;
19 }
20 
22 {
23  double px1 = _e1.get_px();
24  double py1 = _e1.get_py();
25  double pz1 = _e1.get_pz();
26  double ee1 = sqrt(px1*px1+py1*py1+pz1*pz1+0.000511*0.000511);
27  TLorentzVector tmp1 = TLorentzVector(px1,py1,pz1,ee1);
28  double px2 = _e2.get_px();
29  double py2 = _e2.get_py();
30  double pz2 = _e2.get_pz();
31  double ee2 = sqrt(px2*px2+py2*py2+pz2*pz2+0.000511*0.000511);
32  TLorentzVector tmp2 = TLorentzVector(px2,py2,pz2,ee2);
33  TLorentzVector pair = tmp1 + tmp2;
34  return pair.M();
35 }
36 
38 {
39  double px1 = _e1.get_px();
40  double py1 = _e1.get_py();
41  double pz1 = _e1.get_pz();
42  double ee1 = sqrt(px1*px1+py1*py1+pz1*pz1+0.000511*0.000511);
43  TLorentzVector tmp1 = TLorentzVector(px1,py1,pz1,ee1);
44  double px2 = _e2.get_px();
45  double py2 = _e2.get_py();
46  double pz2 = _e2.get_pz();
47  double ee2 = sqrt(px2*px2+py2*py2+pz2*pz2+0.000511*0.000511);
48  TLorentzVector tmp2 = TLorentzVector(px2,py2,pz2,ee2);
49  TLorentzVector pair = tmp1 + tmp2;
50  return pair.Pt();
51 }
52 
54 {
55  double px1 = _e1.get_px();
56  double py1 = _e1.get_py();
57  double pz1 = _e1.get_pz();
58  double ee1 = sqrt(px1*px1+py1*py1+pz1*pz1+0.000511*0.000511);
59  TLorentzVector tmp1 = TLorentzVector(px1,py1,pz1,ee1);
60  double px2 = _e2.get_px();
61  double py2 = _e2.get_py();
62  double pz2 = _e2.get_pz();
63  double ee2 = sqrt(px2*px2+py2*py2+pz2*pz2+0.000511*0.000511);
64  TLorentzVector tmp2 = TLorentzVector(px2,py2,pz2,ee2);
65  TLorentzVector pair = tmp1 + tmp2;
66  return pair.Eta();
67 }
68 
70 {
71 // assumes that the first element of the pair is the positron, and second the electron
72  double px1 = _e1.get_px();
73  double py1 = _e1.get_py();
74  double pz1 = _e1.get_pz();
75  double px2 = _e2.get_px();
76  double py2 = _e2.get_py();
77  double pz2 = _e2.get_pz();
78  double px = px1 + px2;
79  double py = py1 + py2;
80  double pz = pz1 + pz2;
81  double pp = sqrt(px*px+py*py+pz*pz);
82  double ux = px/pp;
83  double uy = py/pp;
84  double uz = pz/pp;
85 
86 // axis defined by (ux,uy,ux)X(0,0,1).
87 // this is the axis that is perpendicular to the direction of
88 // pair, and also perpendicular to the Z axis (field direction).
89 // If the pair is conversion at R!=0, it must have (apparent)
90 // momentum component in this axis (caused by field intergral from the
91 // vertex point to the conversion point).
92 // The sign of the component is opposite for e+ and e-.
93 //
94 // (ux,uy,ux)X(0,0,1)=(uy,-ux,0)
95 //
96 
97  double ax = uy/sqrt(ux*ux+uy*uy);
98  double ay = -ux/sqrt(ux*ux+uy*uy);
99 
100 //momentum of e+ and e- in (ax,ay,az) axis. Note that az=0 by definition.
101 
102 //vector product of pep X pem
103  double vpx = py1*pz2 - pz1*py2;
104  double vpy = pz1*px2 - px1*pz2;
105  double vpz = px1*py2 - py1*px2;
106  double vp = sqrt(vpx*vpx+vpy*vpy+vpz*vpz);
107 
108 //unit vector of pep X pem
109  double vx = vpx/vp;
110  double vy = vpy/vp;
111  double vz = vpz/vp;
112 
113 //The third axis defined by vector product (ux,uy,uz)X(vx,vy,vz)
114  double wx = uy*vz - uz*vy;
115  double wy = uz*vx - ux*vz;
116 // double wz = ux*vy - uy*vx;
117 // double wl = sqrt(wx*wx+wy*wy+wz*wz);
119 // if(fabs(wl - 1.0) > 0.00001) std:;cout << "Calculation error in W vector"<<std::endl;
120 
121 // measure angle between (wx,wy,wz) and (ax,ay,0). The angle between them
122 // should be small if the pair is conversion
123  double cosPhiV = wx*ax + wy*ay;
124  double phiV = acos(cosPhiV);
125 
126  return phiV;
127 }
128