3 |
|
#include "TreeProducer.h" |
4 |
|
#include "TwoBodyDecaySpy.h" |
5 |
|
|
6 |
< |
|
7 |
< |
TLorentzVector qcalc(double px, double py, double pz) |
8 |
< |
{ |
9 |
< |
double p2 = px*px+py*py+pz*pz; |
10 |
< |
double e = sqrt(p2 + 0.105658367*0.105658367); |
11 |
< |
return TLorentzVector(px,py,pz,e); |
12 |
< |
} |
6 |
> |
#define MU_MASS 0.105658367 |
7 |
|
|
8 |
|
|
9 |
|
void EvtComparison::Compare(TwoBodyDecaySpy* a, |
23 |
|
if (read_a) |
24 |
|
{ |
25 |
|
Long64_t ientry1 = a->LoadTree(jentry1); |
26 |
< |
if (ientry1 < 0) return; |
26 |
> |
if (ientry1 < 0) break; |
27 |
|
a->GetEntry(jentry1); |
28 |
|
jentry1++; |
29 |
|
} |
31 |
|
if (read_b) |
32 |
|
{ |
33 |
|
Long64_t ientry2 = b->LoadTree(jentry2); |
34 |
< |
if (ientry2 < 0) return; |
34 |
> |
if (ientry2 < 0) break; |
35 |
|
b->GetEntry(jentry2); |
36 |
|
jentry2++; |
37 |
|
} |
40 |
|
a->EventNumber==b->EventNumber) |
41 |
|
{ |
42 |
|
std::vector<TLorentzVector> va; |
43 |
< |
TLorentzVector qa1=qcalc( a->NewTrack_px[0], |
44 |
< |
a->NewTrack_py[0], |
45 |
< |
a->NewTrack_pz[0] ); |
43 |
> |
TLorentzVector qa1; |
44 |
> |
qa1.SetXYZM( a->NewTrack_px[0], |
45 |
> |
a->NewTrack_py[0], |
46 |
> |
a->NewTrack_pz[0], |
47 |
> |
MU_MASS ); |
48 |
|
va.push_back(qa1); |
49 |
< |
TLorentzVector qa2=qcalc( a->NewTrack_px[1], |
50 |
< |
a->NewTrack_py[1], |
51 |
< |
a->NewTrack_pz[1]); |
49 |
> |
TLorentzVector qa2; |
50 |
> |
qa2.SetXYZM( a->NewTrack_px[1], |
51 |
> |
a->NewTrack_py[1], |
52 |
> |
a->NewTrack_pz[1], |
53 |
> |
MU_MASS ); |
54 |
|
va.push_back(qa2); |
55 |
|
std::vector<TLorentzVector> vb; |
56 |
< |
TLorentzVector qb1=qcalc( b->NewTrack_px[0], |
57 |
< |
b->NewTrack_py[0], |
58 |
< |
b->NewTrack_pz[0]); |
56 |
> |
TLorentzVector qb1; |
57 |
> |
qb1.SetXYZM( b->NewTrack_px[0], |
58 |
> |
b->NewTrack_py[0], |
59 |
> |
b->NewTrack_pz[0], |
60 |
> |
MU_MASS ); |
61 |
|
vb.push_back(qb1); |
62 |
< |
TLorentzVector qb2=qcalc( b->NewTrack_px[1], |
63 |
< |
b->NewTrack_py[1], |
64 |
< |
b->NewTrack_pz[1]); |
62 |
> |
TLorentzVector qb2; |
63 |
> |
qb2.SetXYZM( b->NewTrack_px[1], |
64 |
> |
b->NewTrack_py[1], |
65 |
> |
b->NewTrack_pz[1], |
66 |
> |
MU_MASS ); |
67 |
|
vb.push_back(qb2); |
68 |
|
ncounter++; |
69 |
|
Compare(va,vb,histos); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
+ |
void EvtComparison::Compare(TreeProducer* a, |
104 |
+ |
TreeProducer* b, |
105 |
+ |
histoEvt& histos) |
106 |
+ |
{ |
107 |
+ |
unsigned long ncounter = 0; |
108 |
+ |
|
109 |
+ |
Long64_t jentry1=0; |
110 |
+ |
Long64_t jentry2=0; |
111 |
+ |
|
112 |
+ |
bool read_a=true; |
113 |
+ |
bool read_b=true; |
114 |
+ |
|
115 |
+ |
while(1) |
116 |
+ |
{ |
117 |
+ |
if (read_a) |
118 |
+ |
{ |
119 |
+ |
Long64_t ientry1 = a->LoadTree(jentry1); |
120 |
+ |
if (ientry1 < 0) break; |
121 |
+ |
a->GetEntry(jentry1); |
122 |
+ |
jentry1++; |
123 |
+ |
} |
124 |
|
|
125 |
+ |
if (read_b) |
126 |
+ |
{ |
127 |
+ |
Long64_t ientry2 = b->LoadTree(jentry2); |
128 |
+ |
if (ientry2 < 0) break; |
129 |
+ |
b->GetEntry(jentry2); |
130 |
+ |
jentry2++; |
131 |
+ |
} |
132 |
|
|
133 |
< |
void EvtComparison::Compare(const std::vector<TLorentzVector>& spy, |
134 |
< |
const std::vector<TLorentzVector>& tree, |
133 |
> |
if (a->RunNumber ==b->RunNumber && |
134 |
> |
a->EventNumber==b->EventNumber) |
135 |
> |
{ |
136 |
> |
std::vector<TLorentzVector> va; |
137 |
> |
TLorentzVector qa1; |
138 |
> |
qa1.SetXYZM( a->Track_px[0], |
139 |
> |
a->Track_py[0], |
140 |
> |
a->Track_pz[0], |
141 |
> |
MU_MASS ); |
142 |
> |
va.push_back(qa1); |
143 |
> |
TLorentzVector qa2; |
144 |
> |
qa2.SetXYZM( a->Track_px[1], |
145 |
> |
a->Track_py[1], |
146 |
> |
a->Track_pz[1], |
147 |
> |
MU_MASS ); |
148 |
> |
va.push_back(qa2); |
149 |
> |
std::vector<TLorentzVector> vb; |
150 |
> |
TLorentzVector qb1; |
151 |
> |
qb1.SetXYZM( b->Track_px[0], |
152 |
> |
b->Track_py[0], |
153 |
> |
b->Track_pz[0], |
154 |
> |
MU_MASS ); |
155 |
> |
vb.push_back(qb1); |
156 |
> |
TLorentzVector qb2; |
157 |
> |
qb2.SetXYZM( b->Track_px[1], |
158 |
> |
b->Track_py[1], |
159 |
> |
b->Track_pz[1], |
160 |
> |
MU_MASS ); |
161 |
> |
vb.push_back(qb2); |
162 |
> |
if (a->momConverged || a->vtxConverged || a->fullConverged) |
163 |
> |
{ |
164 |
> |
if (b->momConverged || b->vtxConverged || b->fullConverged) |
165 |
> |
{ ncounter++; Compare(va,vb,histos);} |
166 |
> |
} |
167 |
> |
} |
168 |
> |
else if (a->RunNumber!=b->RunNumber) |
169 |
> |
{ |
170 |
> |
if (a->RunNumber<b->RunNumber) |
171 |
> |
{ |
172 |
> |
read_a=true; |
173 |
> |
read_b=false; |
174 |
> |
} |
175 |
> |
else |
176 |
> |
{ |
177 |
> |
read_a=false; |
178 |
> |
read_b=true; |
179 |
> |
} |
180 |
> |
} |
181 |
> |
else if (a->EventNumber!=b->EventNumber) |
182 |
> |
{ |
183 |
> |
if (a->EventNumber<b->EventNumber) |
184 |
> |
{ |
185 |
> |
read_a=true; |
186 |
> |
read_b=false; |
187 |
> |
} |
188 |
> |
else |
189 |
> |
{ |
190 |
> |
read_a=false; |
191 |
> |
read_b=true; |
192 |
> |
} |
193 |
> |
} |
194 |
> |
} |
195 |
> |
|
196 |
> |
std::cout << "Number of common events = " << ncounter << std::endl; |
197 |
> |
} |
198 |
> |
|
199 |
> |
|
200 |
> |
|
201 |
> |
void EvtComparison::Compare(const std::vector<TLorentzVector>& a, |
202 |
> |
const std::vector<TLorentzVector>& b, |
203 |
|
histoEvt& histos) |
204 |
|
{ |
205 |
< |
std::cout << "common" << std::endl; |
205 |
> |
|
206 |
> |
for (unsigned int i=0;i<2;i++) |
207 |
> |
{ |
208 |
> |
unsigned int j=0; |
209 |
> |
double theMax1 = histos.cos(a[i].Px(),a[i].Py(),a[i].Pz(),b[0].Px(),b[0].Py(),b[0].Pz()); |
210 |
> |
double theMax2 = histos.cos(a[i].Px(),a[i].Py(),a[i].Pz(),b[1].Px(),b[1].Py(),b[1].Pz()); |
211 |
> |
if (theMax1>theMax2) j=0; else j=1; |
212 |
> |
|
213 |
> |
histos.diffPT ->Fill( a[i].Pt()-b[j].Pt() ); |
214 |
> |
histos.diffP ->Fill( a[i].P()-b[j].P() ); |
215 |
> |
histos.diffPX ->Fill( a[i].Px()-b[j].Px() ); |
216 |
> |
histos.diffPY ->Fill( a[i].Py()-b[j].Py() ); |
217 |
> |
histos.diffPZ ->Fill( a[i].Pz()-b[j].Pz() ); |
218 |
> |
histos.diffE ->Fill( a[i].E()-b[j].E() ); |
219 |
> |
histos.diffEta->Fill( a[i].Eta()-b[j].Eta() ); |
220 |
> |
histos.diffPhi->Fill( a[i].Phi()-b[j].Phi() ); |
221 |
> |
} |
222 |
> |
|
223 |
> |
|
224 |
> |
double P2a = pow(a[0].Px()+a[1].Px(),2) + pow(a[0].Py()+a[1].Py(),2) + pow(a[0].Pz()+a[1].Pz(),2); |
225 |
> |
double E2a = pow(a[0].E()+a[1].E(),2); |
226 |
> |
|
227 |
> |
double P2b = pow(b[0].Px()+b[1].Px(),2) + pow(b[0].Py()+b[1].Py(),2) + pow(b[0].Pz()+b[1].Pz(),2); |
228 |
> |
double E2b = pow(b[0].E()+b[1].E(),2); |
229 |
> |
|
230 |
> |
|
231 |
> |
histos.diffMz ->Fill( sqrt(E2a-P2a) - sqrt(E2b-P2b) ); |
232 |
> |
|
233 |
|
} |