2{
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 TChain * hit = new TChain("hit");
19 hit->Add("hough_hist_test.root");
20
21
22 Int_t hit_run;
23 Int_t hit_evt;
24 Int_t hit_nhit;
25 Int_t hit_hitid[10000];
26 Int_t hit_layer[10000];
27 Int_t hit_wire[10000];
28 Double_t hit_x[10000];
29 Double_t hit_y[10000];
30 Double_t hit_z[10000];
31 Double_t hit_driftdist[10000];
32 Double_t hit_drifttime[10000];
33 Int_t hit_flag[10000];
34 Double_t hit_truth_x[10000];
35 Double_t hit_truth_y[10000];
36 Double_t hit_truth_z[10000];
37 Double_t hit_truth_drift[10000];
38 Int_t hit_truth_ambig[10000];
39
40
41 hit->SetBranchAddress("hit_run",&hit_run);
42 hit->SetBranchAddress("hit_evt",&hit_evt);
43 hit->SetBranchAddress("hit_nhit",&hit_nhit);
44 hit->SetBranchAddress("hit_hitid",hit_hitid);
45 hit->SetBranchAddress("hit_layer",hit_layer);
46 hit->SetBranchAddress("hit_wire",hit_wire);
47 hit->SetBranchAddress("hit_x",hit_x);
48 hit->SetBranchAddress("hit_y",hit_y);
49 hit->SetBranchAddress("hit_z",hit_z);
50 hit->SetBranchAddress("hit_driftdist",hit_driftdist);
51 hit->SetBranchAddress("hit_drifttime",hit_drifttime);
52 hit->SetBranchAddress("hit_flag",hit_flag);
53 hit->SetBranchAddress("hit_truth_x",hit_truth_x);
54 hit->SetBranchAddress("hit_truth_y",hit_truth_y);
55 hit->SetBranchAddress("hit_truth_z",hit_truth_z);
56 hit->SetBranchAddress("hit_truth_drift",hit_truth_drift);
57 hit->SetBranchAddress("hit_truth_ambig",hit_truth_ambig);
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 TChain * hot = new TChain("hot");
81 hot->Add("hough_hist_test.root");
82
83
84 Int_t hot_run;
85 Int_t hot_evt;
86 Int_t hot_trk;
87 Int_t hot_nhot;
88 Int_t hot_hitid[1000];
89 Int_t hot_layer[1000];
90 Int_t hot_wire[1000];
91 Double_t hot_x[1000];
92 Double_t hot_y[1000];
93 Double_t hot_z[1000];
94 Double_t hot_x0[1000];
95 Double_t hot_y0[1000];
96 Double_t hot_z0[1000];
97 Double_t hot_s0[1000];
98 Double_t hot_x1[1000];
99 Double_t hot_y1[1000];
100 Double_t hot_z1[1000];
101 Double_t hot_s1[1000];
102 Double_t hot_drift[1000];
103 Int_t hot_flag[1000];
104 Double_t hot_deltaD[1000];
105 Double_t hot_truth_x[1000];
106 Double_t hot_truth_y[1000];
107 Double_t hot_truth_z[1000];
108 Double_t hot_truth_drift[1000];
109 Int_t hot_truth_ambig[1000];
110
111
112 hot->SetBranchAddress("hot_run",&hot_run);
113 hot->SetBranchAddress("hot_evt",&hot_evt);
114 hot->SetBranchAddress("hot_trk",&hot_trk);
115 hot->SetBranchAddress("hot_nhot",&hot_nhot);
116 hot->SetBranchAddress("hot_hitid",hot_hitid);
117 hot->SetBranchAddress("hot_layer",hot_layer);
118 hot->SetBranchAddress("hot_wire",hot_wire);
119 hot->SetBranchAddress("hot_x",hot_x);
120 hot->SetBranchAddress("hot_y",hot_y);
121 hot->SetBranchAddress("hot_z",hot_z);
122 hot->SetBranchAddress("hot_x0",hot_x0);
123 hot->SetBranchAddress("hot_y0",hot_y0);
124 hot->SetBranchAddress("hot_z0",hot_z0);
125 hot->SetBranchAddress("hot_s0",hot_s0);
126 hot->SetBranchAddress("hot_x1",hot_x1);
127 hot->SetBranchAddress("hot_y1",hot_y1);
128 hot->SetBranchAddress("hot_z1",hot_z1);
129 hot->SetBranchAddress("hot_s1",hot_s1);
130 hot->SetBranchAddress("hot_drift",hot_drift);
131 hot->SetBranchAddress("hot_flag",hot_flag);
132 hot->SetBranchAddress("hot_deltaD",hot_deltaD);
133 hot->SetBranchAddress("hot_truth_x",hot_truth_x);
134 hot->SetBranchAddress("hot_truth_y",hot_truth_y);
135 hot->SetBranchAddress("hot_truth_z",hot_truth_z);
136 hot->SetBranchAddress("hot_truth_drift",hot_truth_drift);
137 hot->SetBranchAddress("hot_truth_ambig",hot_truth_ambig);
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161 TChain * trk = new TChain("trk");
162 trk->Add("hough_hist_test.root");
163
164
165 Int_t trk_run;
166 Int_t trk_evt;
167 Int_t trk_ntrk;
168 Int_t trk_trackId[100];
169 Int_t trk_charge[100];
170 Double_t trk_dr[100];
171 Double_t trk_phi0[100];
172 Double_t trk_kappa[100];
173 Double_t trk_dz[100];
174 Double_t trk_tanl[100];
175 Double_t trk_pxy[100];
176 Double_t trk_px[100];
177 Double_t trk_py[100];
178 Double_t trk_pz[100];
179 Double_t trk_p[100];
180 Double_t trk_theta[100];
181 Double_t trk_phi[100];
182 Double_t trk_x[100];
183 Double_t trk_y[100];
184 Double_t trk_z[100];
185 Double_t trk_r[100];
186 Double_t trk_chi2[100];
187 Double_t trk_fiTerm[100];
188 Double_t trk_matchChi2[100];
189 Int_t trk_nhit[100];
190 Int_t trk_ncluster[100];
191 Int_t trk_stat[100];
192 Int_t trk_ndof[100];
193 Int_t trk_nster[100];
194 Int_t trk_nlayer[100];
195 Int_t trk_firstLayer[100];
196 Int_t trk_lastLayer[100];
197 Int_t trk_nCgemXClusters[100];
198 Int_t trk_nCgemVClusters[100];
199 Int_t trk_nhop[100];
200 Int_t trk_nhot[100];
201 Double_t trk_Xc[100];
202 Double_t trk_Yc[100];
203 Double_t trk_R[100];
204 Int_t trk_truth_charge[100];
205 Double_t trk_truth_dr[100];
206 Double_t trk_truth_phi0[100];
207 Double_t trk_truth_kappa[100];
208 Double_t trk_truth_dz[100];
209 Double_t trk_truth_tanl[100];
210 Double_t trk_truth_pxy[100];
211 Double_t trk_truth_px[100];
212 Double_t trk_truth_py[100];
213 Double_t trk_truth_pz[100];
214 Double_t trk_truth_p[100];
215 Double_t trk_truth_theta[100];
216 Double_t trk_truth_phi[100];
217 Double_t trk_truth_x[100];
218 Double_t trk_truth_y[100];
219 Double_t trk_truth_z[100];
220 Double_t trk_truth_r[100];
221 Double_t trk_truth_cosTheta[100];
222 Double_t trk_truth_Xc[100];
223 Double_t trk_truth_Yc[100];
224 Double_t trk_truth_R[100];
225
226
227 trk->SetBranchAddress("trk_run",&trk_run);
228 trk->SetBranchAddress("trk_evt",&trk_evt);
229 trk->SetBranchAddress("trk_ntrk",&trk_ntrk);
230 trk->SetBranchAddress("trk_trackId",trk_trackId);
231 trk->SetBranchAddress("trk_charge",trk_charge);
232 trk->SetBranchAddress("trk_dr",trk_dr);
233 trk->SetBranchAddress("trk_phi0",trk_phi0);
234 trk->SetBranchAddress("trk_kappa",trk_kappa);
235 trk->SetBranchAddress("trk_dz",trk_dz);
236 trk->SetBranchAddress("trk_tanl",trk_tanl);
237 trk->SetBranchAddress("trk_pxy",trk_pxy);
238 trk->SetBranchAddress("trk_px",trk_px);
239 trk->SetBranchAddress("trk_py",trk_py);
240 trk->SetBranchAddress("trk_pz",trk_pz);
241 trk->SetBranchAddress("trk_p",trk_p);
242 trk->SetBranchAddress("trk_theta",trk_theta);
243 trk->SetBranchAddress("trk_phi",trk_phi);
244 trk->SetBranchAddress("trk_x",trk_x);
245 trk->SetBranchAddress("trk_y",trk_y);
246 trk->SetBranchAddress("trk_z",trk_z);
247 trk->SetBranchAddress("trk_r",trk_r);
248 trk->SetBranchAddress("trk_chi2",trk_chi2);
249 trk->SetBranchAddress("trk_fiTerm",trk_fiTerm);
250 trk->SetBranchAddress("trk_matchChi2",trk_matchChi2);
251 trk->SetBranchAddress("trk_nhit",trk_nhit);
252 trk->SetBranchAddress("trk_ncluster",trk_ncluster);
253 trk->SetBranchAddress("trk_stat",trk_stat);
254 trk->SetBranchAddress("trk_ndof",trk_ndof);
255 trk->SetBranchAddress("trk_nster",trk_nster);
256 trk->SetBranchAddress("trk_nlayer",trk_nlayer);
257 trk->SetBranchAddress("trk_firstLayer",trk_firstLayer);
258 trk->SetBranchAddress("trk_lastLayer",trk_lastLayer);
259 trk->SetBranchAddress("trk_nCgemXClusters",trk_nCgemXClusters);
260 trk->SetBranchAddress("trk_nCgemVClusters",trk_nCgemVClusters);
261 trk->SetBranchAddress("trk_nhop",trk_nhop);
262 trk->SetBranchAddress("trk_nhot",trk_nhot);
263 trk->SetBranchAddress("trk_Xc",trk_Xc);
264 trk->SetBranchAddress("trk_Yc",trk_Yc);
265 trk->SetBranchAddress("trk_R",trk_R);
266 trk->SetBranchAddress("trk_truth_charge",trk_truth_charge);
267 trk->SetBranchAddress("trk_truth_dr",trk_truth_dr);
268 trk->SetBranchAddress("trk_truth_phi0",trk_truth_phi0);
269 trk->SetBranchAddress("trk_truth_kappa",trk_truth_kappa);
270 trk->SetBranchAddress("trk_truth_dz",trk_truth_dz);
271 trk->SetBranchAddress("trk_truth_tanl",trk_truth_tanl);
272 trk->SetBranchAddress("trk_truth_pxy",trk_truth_pxy);
273 trk->SetBranchAddress("trk_truth_px",trk_truth_px);
274 trk->SetBranchAddress("trk_truth_py",trk_truth_py);
275 trk->SetBranchAddress("trk_truth_pz",trk_truth_pz);
276 trk->SetBranchAddress("trk_truth_p",trk_truth_p);
277 trk->SetBranchAddress("trk_truth_theta",trk_truth_theta);
278 trk->SetBranchAddress("trk_truth_phi",trk_truth_phi);
279 trk->SetBranchAddress("trk_truth_x",trk_truth_x);
280 trk->SetBranchAddress("trk_truth_y",trk_truth_y);
281 trk->SetBranchAddress("trk_truth_z",trk_truth_z);
282 trk->SetBranchAddress("trk_truth_r",trk_truth_r);
283 trk->SetBranchAddress("trk_truth_cosTheta",trk_truth_cosTheta);
284 trk->SetBranchAddress("trk_truth_Xc",trk_truth_Xc);
285 trk->SetBranchAddress("trk_truth_Yc",trk_truth_Yc);
286 trk->SetBranchAddress("trk_truth_R",trk_truth_R);
287
288
289
290
291
292
293 TAxis *x_axis,*y_axis;
294
295
296
297
298 stringstream ssname;
299 string sname;
300 const char * name;
301 int event = 0;
302 int track = 0;
303
304
305
306
307
308 TEllipse *ed;
309 TEllipse *et;
310 TGraph *gr_O = new TGraph();
311 TGraph *gr_C = new TGraph();
312 TGraph *gr_CM = new TGraph();
313
314
315 Long64_t
nentries = trk->GetEntries();
316 Long64_t nbytes = 0;
317
318 for (Long64_t i=event; i<event+1;i++)
319 {
320 nbytes += trk->GetEntry(i);
321 if(trk_evt != event)continue;
322 cout<<trk_evt<<" "<<trk_ntrk<<endl;
323
324 for(int j=0;j<trk_ntrk;j++){
325 if(j !=track)continue;
326 gr_O->SetPoint(0,0,0);
327 gr_C->SetPoint(0,trk_Xc[j],trk_Yc[j]);
328 gr_CM->SetPoint(0,trk_truth_Xc[j],trk_truth_Yc[j]);
329 ed = new TEllipse(trk_Xc[j],trk_Yc[j],trk_R[j],trk_R[j]);
330 et = new TEllipse(trk_truth_Xc[j],trk_truth_Yc[j],trk_truth_R[j],trk_truth_R[j]);
331
332
333
334
335
336
337
338 cout<<"cos(Theta)="<<trk_truth_cosTheta[j]<<endl;
339 }
340 if(trk_ntrk == 0){
341 cout<<trk_truth_cosTheta[0]<<endl;
342 }
343 }
344
345
346
347 TGraph *gr_xy_data_axial = new TGraph();
348 TGraph *gr_xy_truth_axial = new TGraph();
349 double x1(999),y1(999),x2(-999),y2(-999);
351 nbytes = 0;
352 for (Long64_t i=0; i<
nentries;i++) {
353 nbytes += hit->GetEntry(i);
354 if(hit_evt != event)continue;
355 int point(0);
356 for(int j=0;j<hit_nhit;j++){
357 if(hit_flag[j] !=0)continue;
358
359 x1 = hit_x[j] < x1 ? hit_x[j] : x1;
360 y1 = hit_y[j] < y1 ? hit_y[j] : y1;
361 x2 = hit_x[j] > x2 ? hit_x[j] : x2;
362 y2 = hit_y[j] > y2 ? hit_y[j] : y2;
363 gr_xy_data_axial->SetPoint(point,hit_x[j],hit_y[j]);
364 gr_xy_truth_axial->SetPoint(point,hit_truth_x[j],hit_truth_y[j]);
365 point++;
366 }
367 }
368
369 TGraph *gr_xy_data_stereo0 = new TGraph();
370 TGraph *gr_xy_data_stereo1 = new TGraph();
371 TGraph *gr_xy_truth_stereo= new TGraph();
373 nbytes = 0;
374 for (Long64_t i=0; i<
nentries;i++) {
375 nbytes += hot->GetEntry(i);
376 if(hot_evt != event)continue;
377
378 int point(0);
379 for(int j=0;j<hot_nhot;j++){
380 if(hot_flag[j] ==0)continue;
381
382
383 x1 = hot_x[j] < x1 ? hot_x[j] : x1;
384 y1 = hot_y[j] < y1 ? hot_y[j] : y1;
385 x2 = hot_x[j] > x2 ? hot_x[j] : x2;
386 y2 = hot_y[j] > y2 ? hot_y[j] : y2;
387 gr_xy_data_stereo0->SetPoint(point,hot_x0[j],hot_y0[j]);
388 gr_xy_data_stereo1->SetPoint(point,hot_x1[j],hot_y1[j]);
389 gr_xy_truth_stereo->SetPoint(point,hot_truth_x[j],hot_truth_y[j]);
390 point++;
391 }
392 }
393
394 double x_min(-81),x_max(81),y_min(-81),y_max(81);
395 double scale = (x2-x1)>(y2-y1)?(x2-x1):(y2-y1);
396 x_min = (x2+x1)/2.-scale*0.6;
397 x_max = (x2+x1)/2.+scale*0.6;
398 y_min = (y2+y1)/2.-scale*0.6;
399 y_max = (y2+y1)/2.+scale*0.6;
400 ssname.str("");
401 ssname <<"xy "<<event;
402 sname = ssname.str();
403 name = sname.c_str();
404 TCanvas *c_xy = new TCanvas(name,name,1200, 600 );
405 c_xy->Divide(2,1);
406 c_xy->cd(1);
407 gr_xy_data_axial->Draw("APsame");
408 gr_xy_data_axial->GetXaxis()->SetLimits(x_min,x_max);
409 gr_xy_data_axial->SetMinimum(y_min);
410 gr_xy_data_axial->SetMaximum(y_max);
411 gr_xy_data_axial->SetMarkerStyle(5 );
412 gr_xy_data_axial->SetMarkerSize(0.7);
413 gr_xy_data_axial->SetMarkerColor(4);
414 gr_xy_truth_axial->Draw("Psame");
415 gr_xy_truth_axial->SetMarkerStyle(20);
416 gr_xy_truth_axial->SetMarkerSize(0.7);
417 gr_xy_truth_axial->SetMarkerColor(1);
418
419 gr_xy_data_stereo0->Draw("Psame");
420 gr_xy_data_stereo0->SetMarkerStyle(5 );
421 gr_xy_data_stereo0->SetMarkerSize(0.7);
422 gr_xy_data_stereo0->SetMarkerColor(2);
423 gr_xy_data_stereo1->Draw("Psame");
424 gr_xy_data_stereo1->SetMarkerStyle(5 );
425 gr_xy_data_stereo1->SetMarkerSize(0.7);
426 gr_xy_data_stereo1->SetMarkerColor(3);
427 gr_xy_truth_stereo->Draw("Psame");
428 gr_xy_truth_stereo->SetMarkerStyle(20);
429 gr_xy_truth_stereo->SetMarkerSize(0.7);
430 gr_xy_truth_stereo->SetMarkerColor(1);
431
432 gr_O->Draw("Psame");
433 gr_O->SetMarkerStyle(21);
434 gr_O->SetMarkerSize(1.5);
435 gr_O->SetMarkerColor(1);
436 gr_C->Draw("Psame");
437 gr_C->SetMarkerStyle(20);
438 gr_C->SetMarkerSize(1.5);
439 gr_C->SetMarkerColor(4);
440 gr_CM->Draw("Psame");
441 gr_CM->SetMarkerStyle(20);
442 gr_CM->SetMarkerSize(1.5);
443 gr_CM->SetMarkerColor(1);
444 ed->Draw("same");
445 ed->SetFillStyle(0);
446 ed->SetLineColor(4);
447 et->Draw("same");
448 et->SetFillStyle(0);
449 et->SetLineColor(1);
450
452 nbytes = 0;
453 for (Long64_t i=0; i<
nentries;i++) {
454 nbytes += hit->GetEntry(i);
455 if(hit_evt != event)continue;
456 int point(0);
457 for(int j=0;j<hit_nhit;j++){
458 if(hit_flag[j] !=0)continue;
459 TEllipse *exy = new TEllipse(hit_x[j],hit_y[j],hit_driftdist[j],hit_driftdist[j]);
460 exy->Draw("Csame");
461 exy->SetFillStyle(0);
462 exy->SetLineColor(4);
463 point++;
464 }
465 }
466
468 nbytes = 0;
469 for (Long64_t i=0; i<
nentries;i++) {
470 nbytes += hot->GetEntry(i);
471 if(hot_evt != event)continue;
472 int point(0);
473 for(int j=0;j<hot_nhot;j++){
474 if(hot_flag[j] ==0)continue;
475 TEllipse *exy0 = new TEllipse(hot_x0[j],hot_y0[j],hot_drift[j],hot_drift[j]);
476 TEllipse *exy1 = new TEllipse(hot_x1[j],hot_y1[j],hot_drift[j],hot_drift[j]);
477 exy0->Draw("Csame");
478 exy0->SetFillStyle(0);
479 exy0->SetLineColor(2);
480 exy1->Draw("Csame");
481 exy1->SetFillStyle(0);
482 exy1->SetLineColor(3);
483 point++;
484 }
485 }
486 TLegend* leg1= new TLegend(0.70 ,0.70,0.99,0.95);
487 leg1->AddEntry(gr_xy_truth_axial,"axial truth hit","p");
488 leg1->AddEntry(gr_xy_data_axial,"axial data hit","p");
489 leg1->AddEntry(gr_xy_data_stereo0,"stereo data hit(left)","p");
490 leg1->AddEntry(gr_xy_data_stereo1,"stereo data hit(right)","p");
491 leg1->AddEntry(ed,"reconstruction track","l");
492 leg1->AddEntry(et,"MC truth track","l");
493 leg1->Draw();
494 leg1->SetFillColor(0);
495
496 TGraph *gr_sz_data_stereo0 = new TGraph();
497 TGraph *gr_sz_data_stereo1 = new TGraph();
498 TGraph *gr_sz_truth_stereo= new TGraph();
499 double s1(999),z1(999),s2(-999),z2(-999);
501 nbytes = 0;
502 for (Long64_t i=0; i<
nentries;i++) {
503 nbytes += hot->GetEntry(i);
504 if(hot_evt != event)continue;
505 int point(0);
506 for(int j=0;j<hot_nhot;j++){
507 if(hot_flag[j] ==0)continue;
508 if(fabs(hot_z0[j])==99)continue;
509 if(fabs(hot_z1[j])==99)continue;
510
511
512 s1 = hot_s0[j] < s1 ? hot_s0[j] : s1;
513 z1 = hot_z0[j] < z1 ? hot_z0[j] : z1;
514 s2 = hot_s0[j] > s2 ? hot_s0[j] : s2;
515 z2 = hot_z0[j] > z2 ? hot_z0[j] : z2;
516 s1 = hot_s1[j] < s1 ? hot_s1[j] : s1;
517 z1 = hot_z1[j] < z1 ? hot_z1[j] : z1;
518 s2 = hot_s1[j] > s2 ? hot_s1[j] : s2;
519 z2 = hot_z1[j] > z2 ? hot_z1[j] : z2;
520 gr_sz_data_stereo0->SetPoint(point,hot_s0[j],hot_z0[j]);
521 gr_sz_data_stereo1->SetPoint(point,hot_s1[j],hot_z1[j]);
522 gr_sz_truth_stereo->SetPoint(point,(hot_s0[j]+hot_s1[j])/2,hot_truth_z[j]);
523 point++;
524 }
525 }
526
527
528 double s_min(-81),s_max(81),z_min(-120),z_max(120);
529 s_min = (s2+s1)/2.-(s2-s1)*0.55;
530 s_max = (s2+s1)/2.+(s2-s1)*0.55;
531 z_min = (z2+z1)/2.-(z2-z1)*0.55;
532 z_max = (z2+z1)/2.+(z2-z1)*0.55;
533 ssname.str("");
534 ssname <<"sz "<<event;
535 sname = ssname.str();
536 name = sname.c_str();
537
538 c_xy->cd(2);
539
540 gr_sz_data_stereo0->Draw("APsame");
541 gr_sz_data_stereo0->GetXaxis()->SetLimits(s_min,s_max);
542 gr_sz_data_stereo0->SetMinimum(z_min);
543 gr_sz_data_stereo0->SetMaximum(z_max);
544
545
546
547 gr_sz_data_stereo0->SetMarkerStyle(26);
548 gr_sz_data_stereo0->SetMarkerSize(1.0);
549 gr_sz_data_stereo0->SetMarkerColor(2);
550 gr_sz_data_stereo1->Draw("Psame");
551 gr_sz_data_stereo1->SetMarkerStyle(32);
552 gr_sz_data_stereo1->SetMarkerSize(1.0);
553 gr_sz_data_stereo1->SetMarkerColor(3);
554 gr_sz_truth_stereo->Draw("Psame");
555 gr_sz_truth_stereo->SetMarkerStyle(20);
556 gr_sz_truth_stereo->SetMarkerSize(0.7);
557 gr_sz_truth_stereo->SetMarkerColor(1);
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577}