ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Angles/src/Angles.cc
Revision: 1.3
Committed: Thu May 10 00:14:33 2012 UTC (13 years ago) by khahn
Content type: text/plain
Branch: MAIN
CVS Tags: synced_FSR_2, synced_FSR, synched2
Changes since 1.2: +8 -8 lines
Log Message:
SimpleLepton changes for fakerates

File Contents

# Content
1 #include <iostream>
2 #include "Angles.h"
3 #include "EventData.h"
4
5 void fillAngles( EventData &data, Angles &a ) {
6
7 LabVectors l;
8
9 if( data.Z1leptons[0].charge > 0 ) {
10 l.vecl1p = data.Z1leptons[0].vec;
11 l.vecl1m = data.Z1leptons[1].vec;
12 } else {
13 l.vecl1p = data.Z1leptons[1].vec;
14 l.vecl1m = data.Z1leptons[0].vec;
15 }
16
17 if( data.Z2leptons[0].charge > 0 ) {
18 l.vecl2p = data.Z2leptons[0].vec;
19 l.vecl2m = data.Z2leptons[1].vec;
20 } else {
21 l.vecl2p = data.Z2leptons[1].vec;
22 l.vecl2m = data.Z2leptons[0].vec;
23 }
24
25 l.vecz1 = (l.vecl1p+l.vecl1m);
26 l.vecz2 = (l.vecl2p+l.vecl2m);
27 l.vec4l = (l.vecz1+l.vecz2);
28
29 getAngles( l, a );
30 }
31
32 void getAngles( LabVectors &l,
33 Angles &a ) {
34
35 //
36 // define the frames
37 // --------------------------------------------------------------------------------------------------
38 TVector3 Xframe = l.vec4l.BoostVector();
39 TVector3 Z1frame = l.vecz1.BoostVector();
40 TVector3 Z2frame = l.vecz2.BoostVector();
41
42 //
43 // costheta(l1m,X) in Z1 frame
44 // --------------------------------------------------------------------------------------------------
45 TLorentzVector vecl1m_in_Z1frame( l.vecl1m ); // make a copies of the vectors
46 TLorentzVector vec4l_in_Z1frame( l.vec4l ); //
47 vecl1m_in_Z1frame.Boost( -1*Z1frame ); // now go to the Z1 rest frame
48 vec4l_in_Z1frame.Boost( -1*Z1frame ); //
49 a.costheta1
50 = vecl1m_in_Z1frame.Vect().Dot(-1*vec4l_in_Z1frame.Vect()) /
51 (vecl1m_in_Z1frame.Vect().Mag()*vec4l_in_Z1frame.Vect().Mag());
52
53 //
54 // costheta(l3,X) in Z2 frame
55 // --------------------------------------------------------------------------------------------------
56 TLorentzVector vecl2m_in_Z2frame( l.vecl2m ); // make copies of the vectors
57 TLorentzVector vec4l_in_Z2frame( l.vec4l ); //
58 vecl2m_in_Z2frame.Boost( -1*Z2frame ); // now go to the Z2 rest frame
59 vec4l_in_Z2frame.Boost( -1*Z2frame );
60 a.costheta2 =
61 vecl2m_in_Z2frame.Vect().Dot(-1*vec4l_in_Z2frame.Vect()) /
62 (vecl2m_in_Z2frame.Vect().Mag()*vec4l_in_Z2frame.Vect().Mag());
63
64
65 //
66 // Phi(Z1,Z2) in X frame
67 // --------------------------------------------------------------------------------------------------
68
69 // this is essentially what they do and it reproduces their numbers,
70 // it's the angle between l1 and the z2 decay plane in the Z1 frame
71 TLorentzVector vecz2_in_Z1frame( l.vecz2 ); //
72 TLorentzVector vecl2m_in_Z1frame( l.vecl2m ); //
73 TLorentzVector vecl2p_in_Z1frame( l.vecl2p ); //
74 vecz2_in_Z1frame.Boost( -1*Z1frame ); //
75 vecl2m_in_Z1frame.Boost( -1*Z1frame ); //
76 vecl2p_in_Z1frame.Boost( -1*Z1frame ); //
77
78 //
79 // define the Z2 coordinate system in the Z1 frame
80 // x : opposite the Z2 dir, lies in the Z2 decay plane
81 // z : orthogonal to the Z2 decay plane
82 // y : orthogonal to x&z, lies in the Z2 decay plane
83 TVector3 nnewX = ( -1*vecz2_in_Z1frame.Vect()).Unit();
84 TVector3 nnewZ = (vecl2m_in_Z1frame.Vect().Cross(vecl2p_in_Z1frame.Vect())).Unit();
85 TVector3 nnewY = nnewZ.Cross(nnewX).Unit();
86 TRotation rotation2;
87 rotation2 = (rotation2.RotateAxes( nnewX, nnewY, nnewZ )).Inverse();
88 TVector3 vecl1m_in_Z2coords_Z1frame = vecl1m_in_Z1frame.Vect().Transform(rotation2);
89
90 //
91 // axes are redfined so that Phi is the angle between the Z1 orthogonal
92 // and the Z2 decay plane as given by y
93 //
94 TRotation rotation3;
95 TVector3 nnnewX( 0,1,0 );
96 TVector3 nnnewY( 0,0,1 );
97 TVector3 nnnewZ( 1,0,0 );
98 rotation3 = (rotation3.RotateAxes( nnnewX, nnnewY, nnnewZ )).Inverse();
99 TVector3 vecl1m_in_Z2coords_redefined_Z1frame = vecl1m_in_Z2coords_Z1frame.Transform(rotation3);
100 a.Phi = vecl1m_in_Z2coords_redefined_Z1frame.Phi();
101
102
103 //
104 // rather, I'd expect something like this ...
105 //
106 TLorentzVector vecl1p_in_Xframe( l.vecl1p ); // make a copies of the vectors
107 TLorentzVector vecl1m_in_Xframe( l.vecl1m ); //
108 TLorentzVector vecl2p_in_Xframe( l.vecl2p ); //
109 TLorentzVector vecl2m_in_Xframe( l.vecl2m ); //
110
111 vecl1p_in_Xframe.Boost( -1*Xframe ); // go to the X rest frame
112 vecl1m_in_Xframe.Boost( -1*Xframe ); //
113 vecl2p_in_Xframe.Boost( -1*Xframe ); //
114 vecl2m_in_Xframe.Boost( -1*Xframe ); //
115
116 /*
117 // sanity check ...
118 TLorentzVector z1inX = vecl1p_in_Xframe+vecl1m_in_Xframe;
119 TLorentzVector z2inX = vecl2p_in_Xframe+vecl2m_in_Xframe;
120 float dotz1z2 = z1inX.Vect().Dot(z2inX.Vect()) / (z1inX.Vect().Mag()*z2inX.Vect().Mag());
121 std::cout << "dotz1z2: " << dotz1z2 << std::endl;
122 */
123
124 TVector3 Z1ortho_in_Xframe = // define the decay planes via the orthogonals
125 vecl1m_in_Xframe.Vect().Cross(vecl1p_in_Xframe.Vect());
126 TVector3 Z2ortho_in_Xframe =
127 vecl2m_in_Xframe.Vect().Cross(vecl2p_in_Xframe.Vect());
128
129 /*
130 // sanity check ... why are these small but not exactly zero ???
131 float z1odot = Z1ortho_in_Xframe.Dot(z1inX.Vect())/(Z1ortho_in_Xframe.Mag()*z1inX.Vect().Mag());
132 float z2odot = Z2ortho_in_Xframe.Dot(z2inX.Vect())/(Z2ortho_in_Xframe.Mag()*z2inX.Vect().Mag());
133 float l1podot = Z1ortho_in_Xframe.Dot(vecl1p_in_Xframe.Vect())/(Z1ortho_in_Xframe.Mag()*vecl1p_in_Xframe.Vect().Mag());
134 float l1modot = Z1ortho_in_Xframe.Dot(vecl1m_in_Xframe.Vect())/(Z1ortho_in_Xframe.Mag()*vecl1m_in_Xframe.Vect().Mag());
135 std::cout << "Z1ortho_in_Xframe.Dot(z1inX): " << z1odot << "\t"
136 << "Z2ortho_in_Xframe.Dot(z2inX): " << z2odot << "\t"
137 << "Z1ortho_in_Xframe.Dot(veclp1_in_Xframe) : " << l1podot << "\t"
138 << "Z1ortho_in_Xframe.Dot(veclm1_in_Xframe) : " << l1modot << "\t"
139 << std::endl;
140 */
141
142
143 // a.Phi = Z1ortho_in_Xframe.DeltaPhi(Z2ortho_in_Xframe);
144 //a.Phi = Z1ortho_in_Xframe.Angle(Z2ortho_in_Xframe);
145
146
147
148 //
149 // costheta*(Z1,pp) in X frame
150 // --------------------------------------------------------------------------------------------------
151 TLorentzVector vecz1_in_Xframe( l.vecz1 ); // make a copies of the vectors
152 TLorentzVector vecpp_in_Xframe( 0., 0., 1., 0. ); // define pp axis
153
154 vecz1_in_Xframe.Boost( -1*Xframe ); // go to the X rest frame
155 vecpp_in_Xframe.Boost( -1*Xframe ); //
156
157 a.costhetastar =
158 vecz1_in_Xframe.Vect().Dot(vecpp_in_Xframe.Vect()) /
159 (vecz1_in_Xframe.Vect().Mag()*vecpp_in_Xframe.Vect().Mag());
160
161
162 //
163 // Phi1(Z1,pp) in X frame
164 // --------------------------------------------------------------------------------------------------
165
166 // define the Z1 decay plane in the Xframe
167 // y: orthogonal to the Z1 decay plane
168 // x: lies in the Z1 decay plane, but orthogonal to Z1
169 // z: z1 in Xframe
170 TVector3 newY = (vecl1p_in_Xframe.Vect().Unit().Cross(vecl1m_in_Xframe.Vect().Unit())).Unit();
171 TVector3 newX = (newY.Cross(vecz1_in_Xframe.Vect().Unit())).Unit();
172 TVector3 newZ( (vecz1_in_Xframe.Vect()).Unit() );
173
174 TRotation rotation;
175 rotation = (rotation.RotateAxes( newX, newY, newZ )).Inverse();
176 TVector3 vecpp( 0., 0., 1. );
177 TVector3 vecpp_in_Z1coords_Xframe = vecpp.Transform(rotation);
178 a.Phi1 = vecpp_in_Z1coords_Xframe.Phi();
179
180 // a.mz1 = (l.vecl1m+l.vecl1p).M();
181 // a.mz2 = (l.vecl2m+l.vecl2p).M();
182 // a.m4l = (l.vec4l).M();
183
184 };
185
186