BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
L1AlgoDraw.h
Go to the documentation of this file.
1#ifndef L1AlgoDraw_h
2#define L1AlgoDraw_h 1
3
4#define DRAW
5
6#include "CbmKF.h"
7#include "CbmL1.h"
8#include "L1Algo/L1Algo.h"
9#include "TApplication.h"
10#include "TCanvas.h"
11#include "TEllipse.h"
12#include "TFrame.h"
13#include "TLatex.h"
14#include "TMarker.h"
15#include "TPad.h"
16#include "TPaveText.h"
17#include "TPolyLine.h"
18#include "TPolyLine3D.h"
19#include "TPolyMarker.h"
20#include "TStyle.h"
21#include "TText.h"
22#include "TView3D.h"
23
24// #include <unistd.h> // for dir navigation
25
26// static TApplication *myapp;
27
29{
30 struct Point
31 {
32 double x, y, z;
33 Point() {};
34 Point(double _x, double _y, double _z)
35 : x(_x)
36 , y(_y)
37 , z(_z) {};
38 };
39
40 public:
41 L1AlgoDraw();
42 void InitL1Draw(L1Algo* algo_);
43
44 void DrawMCTracks();
45 void DrawRecoTracks();
46
47 void DrawTriplets(vector<L1Triplet>& triplets, const THitI* realIHit);
48 void DrawDoublets(vector<THitI>* Duplets_hits,
49 map<THitI, THitI>* Duplets_start,
50 const int MaxArrSize,
52 unsigned int* realIHit);
53 void DrawDoubletsOnSta(int iSta,
54 THitI* Duplets_hits,
55 THitI* Duplets_start,
56 const int MaxArrSize,
57 THitI* StsRestHitsStartIndex,
58 unsigned int* realIHit);
59
60 void DrawTarget();
61 void DrawInputHits(); // draw all hits, which TF have gotten
62 void DrawRestHits(THitI* StsRestHitsStartIndex,
63 THitI* StsRestHitsStopIndex,
64 unsigned int* realIHit); // draw only hits which leave on current iteration.
65
66 void DrawInfo();
67 void ClearVeiw();
68 void SaveCanvas(TString name);
69 void DrawAsk();
70
71 private:
72 Point GetHitCoor(int ih);
73
74 void DrawTriplet(int il, int im, int ir);
75 void DrawDoublet(int il, int ir);
76
78
79 vector<fscal> vStsStrips, vStsStripsB;
80 vector<L1StsHit> vStsHits;
82
85
86 int mcolor[10]; // color for hits on i-station
87 int StaColor; // color for stantions
88 int hitsMStyle; // style for hits
89 int fakesMStyle; // style for fakes
90 int targetMStyle; // style for target
91
92 double HitSize; // size of hits
93
95 /*static*/ TCanvas *YZ, *YX, *XZ, *XYZ;
96 bool ask;
97};
98
100{
101
102 int tmp[10] = {5, 7, 3, 8, 6, 2, 4, 1, 9, 14}; // color for hits on i-station
103 for (int i = 0; i < 10; i++) {
104 mcolor[i] = tmp[i];
105 }
106 StaColor = 17;
107 hitsMStyle = 20;
108 fakesMStyle = 24;
109 targetMStyle = 29;
110
111 HitSize = 1;
112
113 gStyle->SetCanvasBorderMode(0);
114 gStyle->SetCanvasBorderSize(1);
115 gStyle->SetCanvasColor(0);
116
117 YZ = new TCanvas("YZ", "YZ Side View", -1, 0, 500, 500);
118 YZ->Range(-5.0, -50.0, 105.0, 50.0);
119 YZ->Draw();
120 YZ->Update();
121
122 XZ = new TCanvas("XZ", "XZ Top View", -1, 500, 500, 500);
123 XZ->Range(-5.0, -50.0, 105.0, 50.0);
124 XZ->Draw();
125 XZ->Update();
126
127 YX = new TCanvas("YX", "YX Front View", -506, 0, 500, 500);
128 YX->Range(-50.0, -50.0, 50.0, 50.0);
129 YX->Draw();
130 YX->Update();
131
132 // XYZ = new TCanvas ("XYZ", "XYZ 3D View", -0, 0, 1000, 1000);
133 XYZ = new TCanvas("XYZ", "XYZ 3D View", -500, 500, 500, 500);
134 XYZ->Range(-5.0, -50.0, 115.0, 60.0);
135 // TView3D *view = (TView3D*) XYZ->GetView3D();
136 // view = (TView3D*) TView::CreateView(1);
137 // TView3D *view = new TView3D();
138 // view->SetRange(-50.0, -50.0, -0.0, 50.0, 50.0, 110.0);
139 // view->SetRange(0,0,0,4,4,4);
140 // view->Draw();
141 // XYZ->ResetView3D(view);
142 XYZ->Draw();
143 XYZ->Update();
144
145 fVerbose = CbmL1::Instance()->fVerbose;
146 ask = true;
147}
148
150{
151 // algo = CbmL1::Instance()->algo;
152 algo = algo_;
153 vStsStrips.resize(algo->vStsStrips.size());
154 for (int i = 0; i < algo->vStsStrips.size(); i++) {
155 vStsStrips[i] = algo->vStsStrips[i];
156 }
157 vStsStripsB.resize(algo->vStsStripsB.size());
158 for (int i = 0; i < algo->vStsStripsB.size(); i++) {
159 vStsStripsB[i] = algo->vStsStripsB[i];
160 }
161 vStsHits.resize(algo->vStsHits.size());
162 for (int i = 0; i < algo->vStsHits.size(); i++) {
163 vStsHits[i] = algo->vStsHits[i];
164 }
165 NStations = algo->NStations;
166 for (int i = 0; i < NStations; i++) {
167 StsHitsStartIndex[i] = algo->StsHitsStartIndex[i];
168 StsHitsStopIndex[i] = algo->StsHitsStopIndex[i];
169 vStations[i] = algo->vStations[i];
170 }
171}
172
174{
175 int NRegMCTracks = 0;
176 CbmL1& L1 = *CbmL1::Instance();
177 TPolyLine pline;
178 if (fVerbose >= 10) {
179 cout << "Only reconstructable tracks are shown." << endl;
180 cout << "Red - primary p > 0.5 - (first iteration)" << endl;
181 cout << "Blue - primary p < 0.5 - (second iteration)" << endl;
182 cout << "Green - secondary p > 0.5 - (third\\first iteration)" << endl;
183 cout << "Gray - secondary p < 0.5 - (third\\second iteration)" << endl;
184 };
185
186 for (vector<CbmL1MCTrack>::iterator it = L1.vMCTracks.begin(); it != L1.vMCTracks.end(); ++it) {
187 CbmL1MCTrack& T = *it;
188 // draw reconstructable tracks only
189 if (!T.IsReconstructable())
190 continue;
191 // if (( T.mother_ID< 0 )&&( T.nContStations<3 )) continue;
192 // if (( T.mother_ID>=0 )&&( T.nContStations<4 )) continue;
193 // if( T.p<.2 ) continue;
194 if (T.p < 0.1)
195 continue;
196 pline.SetLineColor(kRed);
197 if (T.p < 0.5)
198 pline.SetLineColor(kBlue);
199 if (T.mother_ID != -1)
200 pline.SetLineColor(8);
201 if ((T.mother_ID != -1) && (T.p < 0.5))
202 pline.SetLineColor(12);
203 if (fVerbose >= 1)
204 cout << "MC Track: p = " << T.p << " mother_ID = " << T.mother_ID << " PDG = " << T.pdg << " x,y,z = ("
205 << T.x << ", " << T.y << ", " << T.z << ")" << endl;
206 double par[6];
207 par[0] = T.x;
208 par[1] = T.y;
209 // if( fabs(T.pz)<0.1 ) continue;
210 par[2] = T.px / T.pz;
211 par[3] = T.py / T.pz;
212 par[4] = T.q / T.p;
213 par[5] = T.z;
214
215 int npoints = T.Points.size();
216 if (fVerbose >= 10)
217 cout << " NMCPoints = " << npoints << endl;
218 if (npoints < 1)
219 continue;
220
221 vector<double> lx, ly, lz;
222 lx.push_back(par[0]);
223 ly.push_back(par[1]);
224 lz.push_back(par[5]);
225
226 bool ok = true;
227
228 if (fVerbose >= 4) {
229 cout << "hits = ";
230 for (int ih = 0; ih < T.StsHits.size(); ih++)
231 cout << T.StsHits[ih] << " ";
232 cout << endl;
233 }
234 for (int ip = 0; ip < npoints; ip++) {
235 CbmL1MCPoint& p = L1.vMCPoints[T.Points[ip]];
236 double par1[6];
237 // if( fabs(p.pz)<0.05 ) continue;
238 par1[0] = p.x;
239 par1[1] = p.y;
240 par1[2] = p.px / p.pz;
241 par1[3] = p.py / p.pz;
242 par1[4] = p.q / p.p;
243 par1[5] = p.z;
244 if (fVerbose >= 5) {
245 static float pz = -1;
246 if (fabs(pz - p.z) > 1.0)
247 cout << "-- ";
248 cout << "point.z = " << p.z << endl;
249 pz = p.z;
250 }
251
252 double Zfrst = par[5];
253 double Zlast = par1[5];
254 double step = .5;
255 if (step > fabs(Zfrst - Zlast) / 5)
256 step = fabs(Zfrst - Zlast) / 5;
257 if (Zlast < par[5])
258 step = -step;
259 while (fabs(par[5] - Zlast) > fabs(step)) {
260 double znxt = par[5] + step;
261 CbmKF::Instance()->Propagate(par1, 0, znxt, par1[4]);
262 CbmKF::Instance()->Propagate(par, 0, znxt, par[4]);
263 double w = fabs(znxt - Zfrst);
264 double w1 = fabs(znxt - Zlast);
265 if (w + w1 < 1.e-3) {
266 w = 1;
267 w1 = 0;
268 }
269 float xl = (w1 * par[0] + w * par1[0]) / (w + w1);
270 float yl = (w1 * par[1] + w * par1[1]) / (w + w1);
271 float zl = (w1 * par[5] + w * par1[5]) / (w + w1);
272 if ((fabs(xl) > 50.0) || (fabs(yl) > 50.0)) {
273 // cout << "*** track " << NRegMCTracks+1 << " xl = " << xl << ", zl = " << zl << endl;
274 // cout << "*** track " << NRegMCTracks+1 << " yl = " << yl << ", zl = " << zl << endl;
275 ok = false;
276 continue;
277 }
278 lx.push_back((w1 * par[0] + w * par1[0]) / (w + w1));
279 ly.push_back((w1 * par[1] + w * par1[1]) / (w + w1));
280 lz.push_back((w1 * par[5] + w * par1[5]) / (w + w1));
281 }
282
283 par[0] = p.x;
284 par[1] = p.y;
285 par[2] = p.px / p.pz;
286 par[3] = p.py / p.pz;
287 par[4] = p.q / p.p;
288 par[5] = p.z;
289 lx.push_back(par[0]);
290 ly.push_back(par[1]);
291 lz.push_back(par[5]);
292 }
293
294 if (ok) {
295
296 NRegMCTracks++;
297
298 YZ->cd();
299 pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0]));
300 XZ->cd();
301 pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0]));
302 YX->cd();
303 pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0]));
304
305 // YZ->cd(); YZ->Update();
306 // XZ->cd(); XZ->Update();
307 // YX->cd(); YX->Update();
308 // DrawAsk();
309 }
310 }
311
312 cout << "L1CADraw: number of registered MC tracks: " << NRegMCTracks << endl;
313
314 YZ->cd();
315 YZ->Update();
316 XZ->cd();
317 XZ->Update();
318 YX->cd();
319 YX->Update();
320}
321
323{
324 // XYZ->cd();
325 // TView *view = TView::CreateView(1);
326 // view->SetRange(-100,-100,-100, 100, 100, 100);
327
328 int NRecTracks = 0;
329 // CbmL1 &L1 = *CbmL1::Instance();
330
331 int curRecoHit = 0;
332 vector<THitI>& recoHits = algo->vRecoHits;
333 for (vector<L1Track>::iterator it = algo->vTracks.begin(); it != algo->vTracks.end(); ++it) {
334 L1Track& T = *it;
335 int nHits = T.NHits;
336 // if (nHits > 5) continue; // draw clones
337 // YZ->cd(); YZ->Update();
338 // XZ->cd(); XZ->Update();
339 // YX->cd(); YX->Update();
340 // DrawAsk();
341 vector<double> lx, ly, lz;
342 vector<double> lx_turned, ly_turned, lz_turned;
343
344 TPolyLine pline;
345 pline.SetLineColor(kBlue);
346 // TPolyLine3D pline3D(nHits);
347 // pline3D.SetLineColor(kBlue);
348 if (fVerbose >= 4) {
349 cout << "hits = ";
350 }
351 for (int iHit = 0; iHit < nHits; iHit++) {
352 unsigned int ih = recoHits[curRecoHit++];
353 if (fVerbose >= 4) {
354 cout << ih << " ";
355 }
356
357 Point p = GetHitCoor(ih);
358 lx.push_back(p.x);
359 ly.push_back(p.y);
360 lz.push_back(p.z);
361
362 TVector3 v3(p.x, p.y, p.z);
363 v3.RotateX(TMath::Pi() / 5);
364 v3.RotateY(TMath::Pi() / 20);
365 v3.RotateZ(TMath::Pi() / 100);
366 lx_turned.push_back(v3.x());
367 ly_turned.push_back(v3.y());
368 lz_turned.push_back(v3.z());
369 // pline3D.SetPoint(iHit, p.x, p.y, p.z);
370 }
371 if (fVerbose >= 4) {
372 cout << endl;
373 }
374 if (1) {
375
376 NRecTracks++;
377
378 YZ->cd();
379 pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0]));
380 XZ->cd();
381 pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0]));
382 YX->cd();
383 pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0]));
384 XYZ->cd();
385 pline.DrawPolyLine(lx_turned.size(), &(lz_turned[0]), &(lx_turned[0]));
386 // pline3D.Draw();
387 }
388 }
389
390 cout << "L1CADraw: number of reconstructed tracks: " << NRecTracks << endl;
391
392 YZ->cd();
393 YZ->Update();
394 XZ->cd();
395 XZ->Update();
396 YX->cd();
397 YX->Update();
398
399 XYZ->cd();
400 XYZ->Update();
401}
402
403void L1AlgoDraw::DrawTriplets(vector<L1Triplet>& triplets, const THitI* realIHit)
404{
405 // vector <L1Triplet> triplets = algo->vTriplets;
406 for (int iTrip = 0; iTrip < triplets.size(); iTrip++) {
407 L1Triplet& trip = triplets[iTrip];
408
409 unsigned int iLHit = trip.GetLHit();
410 iLHit = realIHit[iLHit];
411 unsigned int iMHit = trip.GetMHit();
412 iMHit = realIHit[iMHit];
413 unsigned int iRHit = trip.GetRHit();
414 iRHit = realIHit[iRHit];
415
416 DrawTriplet(iLHit, iMHit, iRHit);
417 }
418
419 YZ->cd();
420 YZ->Update();
421 XZ->cd();
422 XZ->Update();
423 YX->cd();
424 YX->Update();
425};
426
427void L1AlgoDraw::DrawTriplet(int il, int im, int ir)
428{
429 TPolyLine pline;
430 pline.SetLineColor(kBlack);
431 TMarker marker;
432 marker.SetMarkerColor(kBlack);
433 marker.SetMarkerStyle(26);
434 marker.SetMarkerSize(HitSize * 2);
435
436 vector<double> lx, ly, lz;
437
438 Point coor;
439
440 coor = GetHitCoor(il);
441 lx.push_back(coor.x);
442 ly.push_back(coor.y);
443 lz.push_back(coor.z);
444
445 coor = GetHitCoor(im);
446 lx.push_back(coor.x);
447 ly.push_back(coor.y);
448 lz.push_back(coor.z);
449
450 coor = GetHitCoor(ir);
451 lx.push_back(coor.x);
452 ly.push_back(coor.y);
453 lz.push_back(coor.z);
454
455 const int nHits = 3;
456 YZ->cd();
457 pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0]));
458 marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]);
459 XZ->cd();
460 pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0]));
461 marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]);
462 YX->cd();
463 pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0]));
464 marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]);
465}
466
467void L1AlgoDraw::DrawDoublets(vector<THitI>* Duplets_hits,
468 map<THitI, THitI>* Duplets_start,
469 const int MaxArrSize,
470 THitI* StsRestHitsStartIndex,
471 unsigned int* realIHit)
472{
473 for (int iSta = 0; iSta < NStations - 1; iSta++) {
474 const int firstHitOnSta = StsRestHitsStartIndex[iSta];
475 const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1];
476 THitI* staDupletsHits = &(Duplets_hits[iSta][0]);
477 map<THitI, THitI>& staDupletsStart = Duplets_start[iSta];
478
479 for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) {
480 const int ilh = iRestLHit - firstHitOnSta;
481 const int iirhFirst = staDupletsStart[ilh];
482 const int iirhLast = staDupletsStart[ilh + 1] - 1;
483
484 for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) {
485 const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta;
486
487 const int iLHit = realIHit[iRestLHit];
488 const int iRHit = realIHit[iRestRHit];
489
490 DrawDoublet(iLHit, iRHit);
491 }
492 }
493 }
494
495 YZ->cd();
496 YZ->Update();
497 XZ->cd();
498 XZ->Update();
499 YX->cd();
500 YX->Update();
501};
502
504 THitI* Duplets_hits,
505 THitI* Duplets_start,
506 const int MaxArrSize,
507 THitI* StsRestHitsStartIndex,
508 unsigned int* realIHit)
509{
510 const int firstHitOnSta = StsRestHitsStartIndex[iSta];
511 const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1];
512 THitI* staDupletsHits = Duplets_hits + MaxArrSize * iSta;
513 THitI* staDupletsStart = Duplets_start + MaxArrSize * iSta;
514
515 for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) {
516 const int ilh = iRestLHit - firstHitOnSta;
517 const int iirhFirst = staDupletsStart[ilh];
518 const int iirhLast = staDupletsStart[ilh + 1] - 1;
519
520 for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) {
521 const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta;
522
523 const int iLHit = realIHit[iRestLHit];
524 const int iRHit = realIHit[iRestRHit];
525
526 DrawDoublet(iLHit, iRHit);
527 }
528 }
529
530 YZ->cd();
531 YZ->Update();
532 XZ->cd();
533 XZ->Update();
534 YX->cd();
535 YX->Update();
536};
537
538void L1AlgoDraw::DrawDoublet(int il, int ir)
539{
540 TPolyLine pline;
541 pline.SetLineColor(kBlue);
542 TMarker marker;
543 marker.SetMarkerColor(kBlue);
544 marker.SetMarkerStyle(27);
545 marker.SetMarkerSize(HitSize * 2);
546
547 vector<double> lx, ly, lz;
548
549 Point coor;
550
551 coor = GetHitCoor(il);
552 lx.push_back(coor.x);
553 ly.push_back(coor.y);
554 lz.push_back(coor.z);
555
556 coor = GetHitCoor(ir);
557 lx.push_back(coor.x);
558 ly.push_back(coor.y);
559 lz.push_back(coor.z);
560
561 const int nHits = 2;
562 YZ->cd();
563 pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0]));
564 marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]);
565 XZ->cd();
566 pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0]));
567 marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]);
568 YX->cd();
569 pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0]));
570 marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]);
571}
572
574{
575 cout << " vStsHits.size = " << algo->vStsHits.size() << endl;
576 cout << " vRecoHits.size = " << algo->vRecoHits.size() << endl;
577 cout << " vTracks.size = " << algo->vTracks.size() << endl;
578}
579
581{
582
583 float x = 0, y = 0, z = 0;
584 float x_t, z_t;
585
586 TVector3 v3(x, y, z);
587 v3.RotateX(TMath::Pi() / 5);
588 v3.RotateY(TMath::Pi() / 20);
589 v3.RotateZ(TMath::Pi() / 100);
590 x_t = v3.x();
591 z_t = v3.z();
592
593 {
594 YZ->cd();
595
596 TMarker* marker = new TMarker(z, y, targetMStyle);
597 marker->SetMarkerColor(kRed);
599 marker->SetMarkerSize(HitSize);
600 marker->Draw();
601 }
602
603 {
604 XZ->cd();
605
606 TMarker* marker = new TMarker(z, x, targetMStyle);
607 marker->SetMarkerColor(kRed);
609 marker->SetMarkerSize(HitSize);
610 marker->Draw();
611 }
612
613 {
614 YX->cd();
615
616 TMarker* marker = new TMarker(x, y, targetMStyle);
617 marker->SetMarkerColor(kRed);
619 marker->SetMarkerSize(HitSize);
620 marker->Draw();
621 }
622
623 {
624 XYZ->cd();
625
626 TMarker* marker = new TMarker(z_t, x_t, targetMStyle);
627 marker->SetMarkerColor(kRed);
629 marker->SetMarkerSize(HitSize);
630 marker->Draw();
631 }
632}
633
635{
636
637 TLatex latex;
638 latex.SetTextFont(132);
639 latex.SetTextAlign(12);
640 latex.SetTextSize(0.035);
641
642 YZ->cd();
643 latex.DrawLatex(0.0, 45.0, "YZ Side View");
644 YZ->Draw();
645 XZ->cd();
646 latex.DrawLatex(0.0, 45.0, "XZ Top View");
647 XZ->Draw();
648 YX->cd();
649 latex.DrawLatex(-45.0, 45.0, "YX Front View");
650 YX->Draw();
651
652 int nhits = vStsHits.size();
653 Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits];
654 Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits];
655 Double_t x_poly_turned[nhits], z_poly_turned[nhits];
656 Double_t x_poly_fake_turned[nhits], z_poly_fake_turned[nhits];
657
658 for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers
659 L1Station& st = vStations[ista];
660 Int_t n_poly = 0;
661 Int_t n_poly_fake = 0;
662 for (int ih = StsHitsStartIndex[ista]; ih < StsHitsStopIndex[ista]; ih++) {
663 L1StsHit& h = vStsHits[ih];
664 int iMC = CbmL1::Instance()->vHitMCRef[ih];
665 // if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used
666
667 float x, y, z;
668 float x_t, z_t;
669 algo->GetHitCoor(h, x, y, z, st);
670
671 TVector3 v3(x, y, z);
672 v3.RotateX(TMath::Pi() / 5);
673 v3.RotateY(TMath::Pi() / 20);
674 v3.RotateZ(TMath::Pi() / 100);
675 x_t = v3.x();
676 z_t = v3.z();
677
678 if (iMC >= 0) {
679 x_poly[n_poly] = x;
680 y_poly[n_poly] = y;
681 z_poly[n_poly] = z;
682 x_poly_turned[n_poly] = x_t;
683 z_poly_turned[n_poly] = z_t;
684 n_poly++;
685 } else {
686 x_poly_fake[n_poly_fake] = x;
687 y_poly_fake[n_poly_fake] = y;
688 z_poly_fake[n_poly_fake] = z;
689 x_poly_fake_turned[n_poly_fake] = x_t;
690 z_poly_fake_turned[n_poly_fake] = z_t;
691 n_poly_fake++;
692 }
693 }
694
695 YZ->cd();
696
697 TLine* line = new TLine();
698 line->SetLineColor(StaColor);
699 line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]);
700
701 TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly);
702 pmyz->SetMarkerColor(mcolor[ista]);
704 pmyz->SetMarkerSize(HitSize);
705 pmyz->Draw();
706
707 TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake);
708 pmyz_fake->SetMarkerColor(mcolor[ista]);
709 pmyz_fake->SetMarkerStyle(fakesMStyle);
710 pmyz_fake->SetMarkerSize(HitSize);
711 pmyz_fake->Draw();
712
713 XZ->cd();
714
715 line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]);
716
717 TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly);
718 pmxz->SetMarkerColor(mcolor[ista]);
720 pmxz->SetMarkerSize(HitSize);
721 pmxz->Draw();
722
723 TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake);
724 pmxz_fake->SetMarkerColor(mcolor[ista]);
725 pmxz_fake->SetMarkerStyle(fakesMStyle);
726 pmxz_fake->SetMarkerSize(HitSize);
727 pmxz_fake->Draw();
728
729 YX->cd();
730
731 TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Rmax[0]);
732 ellipse->SetLineColor(StaColor);
733 ellipse->SetFillStyle(0);
734 ellipse->Draw();
735
736 TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly);
737 pmyx->SetMarkerColor(mcolor[ista]);
739 pmyx->SetMarkerSize(HitSize);
740 pmyx->Draw();
741
742 TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake);
743 pmyx_fake->SetMarkerColor(mcolor[ista]);
744 pmyx_fake->SetMarkerStyle(fakesMStyle);
745 pmyx_fake->SetMarkerSize(HitSize);
746 pmyx_fake->Draw();
747
748 XYZ->cd();
749
750 TPolyMarker* pmxyz = new TPolyMarker(n_poly, z_poly_turned, x_poly_turned);
751 pmxyz->SetMarkerColor(mcolor[ista]);
753 pmxyz->SetMarkerSize(HitSize);
754 pmxyz->Draw();
755
756 TPolyMarker* pmxyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake_turned, x_poly_fake_turned);
757 pmxyz_fake->SetMarkerColor(mcolor[ista]);
758 pmxyz_fake->SetMarkerStyle(fakesMStyle);
759 pmxyz_fake->SetMarkerSize(HitSize);
760 pmxyz_fake->Draw();
761 }
762
763} // DrawInputHits
764
765void L1AlgoDraw::DrawRestHits(THitI* StsRestHitsStartIndex, THitI* StsRestHitsStopIndex, unsigned int* realIHit)
766{
767
768 TLatex latex;
769 latex.SetTextFont(132);
770 latex.SetTextAlign(12);
771 latex.SetTextSize(0.035);
772
773 YZ->cd();
774 latex.DrawLatex(0.0, 45.0, "YZ Side View");
775 YZ->Draw();
776 XZ->cd();
777 latex.DrawLatex(0.0, 45.0, "XZ Top View");
778 XZ->Draw();
779 YX->cd();
780 latex.DrawLatex(-45.0, 45.0, "YX Front View");
781 YX->Draw();
782
783 int nhits = vStsHits.size();
784 Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits];
785 Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits];
786
787 for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers
788 L1Station& st = vStations[ista];
789 Int_t n_poly = 0;
790 Int_t n_poly_fake = 0;
791 for (int iRestHit = StsRestHitsStartIndex[ista]; iRestHit < StsRestHitsStopIndex[ista]; iRestHit++) {
792 int ih = realIHit[iRestHit];
793 L1StsHit& h = vStsHits[ih];
794 int iMC = CbmL1::Instance()->vHitMCRef[ih];
795 // if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used
796
797 float x, y, z;
798 algo->GetHitCoor(h, x, y, z, st);
799 if (iMC >= 0) {
800 x_poly[n_poly] = x;
801 y_poly[n_poly] = y;
802 z_poly[n_poly] = z;
803 n_poly++;
804 } else {
805 x_poly_fake[n_poly_fake] = x;
806 y_poly_fake[n_poly_fake] = y;
807 z_poly_fake[n_poly_fake] = z;
808 n_poly_fake++;
809 }
810 }
811
812 YZ->cd();
813
814 TLine* line = new TLine();
815 line->SetLineColor(StaColor);
816 line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]);
817
818 TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly);
819 pmyz->SetMarkerColor(mcolor[ista]);
821 pmyz->SetMarkerSize(HitSize);
822 pmyz->Draw();
823
824 TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake);
825 pmyz_fake->SetMarkerColor(mcolor[ista]);
826 pmyz_fake->SetMarkerStyle(fakesMStyle);
827 pmyz_fake->SetMarkerSize(HitSize);
828 pmyz_fake->Draw();
829
830 XZ->cd();
831
832 line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]);
833
834 TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly);
835 pmxz->SetMarkerColor(mcolor[ista]);
837 pmxz->SetMarkerSize(HitSize);
838 pmxz->Draw();
839
840 TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake);
841 pmxz_fake->SetMarkerColor(mcolor[ista]);
842 pmxz_fake->SetMarkerStyle(fakesMStyle);
843 pmxz_fake->SetMarkerSize(HitSize);
844 pmxz_fake->Draw();
845
846 YX->cd();
847
848 TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Rmax[0]);
849 ellipse->SetLineColor(StaColor);
850 ellipse->SetFillStyle(0);
851 ellipse->Draw();
852
853 TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly);
854 pmyx->SetMarkerColor(mcolor[ista]);
856 pmyx->SetMarkerSize(HitSize);
857 pmyx->Draw();
858
859 TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake);
860 pmyx_fake->SetMarkerColor(mcolor[ista]);
861 pmyx_fake->SetMarkerStyle(fakesMStyle);
862 pmyx_fake->SetMarkerSize(HitSize);
863 pmyx_fake->Draw();
864 }
865
866} // DrawCurHits
867
869{
870 char symbol;
871 if (ask) {
872 std::cout << "ask>";
873 do {
874 std::cin.get(symbol);
875 if (symbol == 'r')
876 ask = false;
877 if (symbol == 'q')
878 exit;
879 } while (symbol != '\n');
880 std::cout << endl;
881 }
882}
883
885{
886 YZ->Clear();
887 XZ->Clear();
888 YX->Clear();
889 XYZ->Clear();
890}
891
893{
894 L1StsHit& hit = vStsHits[ih];
895 // find station
896 int ista = 0;
897 for (int i = 0; i < NStations; i++) {
898 if ((StsHitsStartIndex[i] <= ih) && (StsHitsStopIndex[i] > ih)) {
899 ista = i;
900 break;
901 }
902 }
903 L1Station& sta = vStations[ista];
904 float x, y, z;
905 algo->GetHitCoor(hit, x, y, z, sta);
906 return Point(x, y, z);
907};
908
910{
911 system("mkdir L1CADraw -p");
912 chdir("L1CADraw");
913 TString tmp = name;
914 tmp += "YXView.pdf";
915 YX->cd();
916 // YX->SaveAs("YXView.eps");
917 YX->SaveAs(tmp);
918
919 tmp = name;
920 tmp += "XZView.pdf";
921 XZ->cd();
922 // XZ->SaveAs("XZView.eps");
923 XZ->SaveAs(tmp);
924
925 tmp = name;
926 tmp += "YZView.pdf";
927 YZ->cd();
928 // YZ->SaveAs("YZView.eps");
929 YZ->SaveAs(tmp);
930
931 tmp = name;
932 tmp += "XYZView.pdf";
933 XYZ->cd();
934 XYZ->SaveAs(tmp);
935 // XYZ->SaveAs("XYZView.eps");
936 // XYZ->SaveAs("XYZView.png");
937 // XYZ->SaveAs("XYZView.pdf");
938 chdir("..");
939}
940
941#endif
unsigned int THitI
Definition L1StsHit.h:6
friend F32vec4 fabs(const F32vec4 &a)
Definition P4_F32vec4.h:52
int i
Definition P4_F32vec4.h:22
int Int_t
double Double_t
kRed
kBlack
kBlue
R__EXTERN TStyle * gStyle
Int_t Propagate(Double_t *T, Double_t *C, Double_t z_out, Double_t QP0, Bool_t line=false)
Propagation of (T, C) to z_out without material, using linearisation at qp0.
Definition CbmKF.cxx:747
static CbmKF * Instance()
Definition CbmKF.h:34
Definition CbmL1.h:48
static CbmL1 * Instance()
reconstructed tracks
Definition CbmL1.h:59
vector< int > vHitMCRef
Definition CbmL1.h:175
void SaveCanvas(TString name)
Definition L1AlgoDraw.h:909
int StsHitsStartIndex[20]
Definition L1AlgoDraw.h:81
vector< fscal > vStsStripsB
Definition L1AlgoDraw.h:79
int StsHitsStopIndex[20]
Definition L1AlgoDraw.h:81
void DrawRestHits(THitI *StsRestHitsStartIndex, THitI *StsRestHitsStopIndex, unsigned int *realIHit)
Definition L1AlgoDraw.h:765
TCanvas * YZ
Definition L1AlgoDraw.h:95
void DrawTarget()
Definition L1AlgoDraw.h:580
void DrawTriplet(int il, int im, int ir)
Definition L1AlgoDraw.h:427
void DrawDoublet(int il, int ir)
Definition L1AlgoDraw.h:538
void DrawTriplets(vector< L1Triplet > &triplets, const THitI *realIHit)
Definition L1AlgoDraw.h:403
vector< L1StsHit > vStsHits
Definition L1AlgoDraw.h:80
L1Station vStations[20]
Definition L1AlgoDraw.h:84
void DrawDoubletsOnSta(int iSta, THitI *Duplets_hits, THitI *Duplets_start, const int MaxArrSize, THitI *StsRestHitsStartIndex, unsigned int *realIHit)
Definition L1AlgoDraw.h:503
int NStations
Definition L1AlgoDraw.h:83
void ClearVeiw()
Definition L1AlgoDraw.h:884
TCanvas * XZ
Definition L1AlgoDraw.h:95
int hitsMStyle
Definition L1AlgoDraw.h:88
int mcolor[10]
Definition L1AlgoDraw.h:86
void DrawDoublets(vector< THitI > *Duplets_hits, map< THitI, THitI > *Duplets_start, const int MaxArrSize, THitI *StsHitsStartIndex, unsigned int *realIHit)
Definition L1AlgoDraw.h:467
void DrawRecoTracks()
Definition L1AlgoDraw.h:322
void DrawInfo()
Definition L1AlgoDraw.h:573
void InitL1Draw(L1Algo *algo_)
Definition L1AlgoDraw.h:149
Point GetHitCoor(int ih)
Definition L1AlgoDraw.h:892
int fakesMStyle
Definition L1AlgoDraw.h:89
void DrawMCTracks()
Definition L1AlgoDraw.h:173
vector< fscal > vStsStrips
Definition L1AlgoDraw.h:79
int targetMStyle
Definition L1AlgoDraw.h:90
TCanvas * XYZ
Definition L1AlgoDraw.h:95
TCanvas * YX
Definition L1AlgoDraw.h:95
void DrawAsk()
Definition L1AlgoDraw.h:868
L1Algo * algo
Definition L1AlgoDraw.h:77
double HitSize
Definition L1AlgoDraw.h:92
void DrawInputHits()
Definition L1AlgoDraw.h:634
fvec Rmax
Definition L1Station.h:27
unsigned char NHits
Definition L1Track.h:23
THitI GetLHit() const
Definition L1Triplet.h:63
THitI GetMHit() const
Definition L1Triplet.h:64
THitI GetRHit() const
Definition L1Triplet.h:65
virtual void SetFillStyle(Style_t fstyle)
virtual void SetLineColor(Color_t lcolor)
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
virtual void SetTextAlign(Short_t align=11)
virtual void SetTextFont(Font_t tfont=62)
virtual void SetTextSize(Float_t tsize=1)
void Draw(Option_t *option="") override
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void Draw(Option_t *option="") override
virtual TMarker * DrawMarker(Double_t x, Double_t y)
virtual TPolyLine * DrawPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
void Draw(Option_t *option="") override
void RotateZ(Double_t)
void RotateX(Double_t)
Double_t z() const
Double_t x() const
Double_t y() const
void RotateY(Double_t)
constexpr Double_t Pi()
Point(double _x, double _y, double _z)
Definition L1AlgoDraw.h:34