10 #include "TApplication.h"
17 #include "TPaveText.h"
18 #include "TPolyLine.h"
19 #include "TPolyLine3D.h"
20 #include "TPolyMarker.h"
33 Point(
double _x,
double _y,
double _z) :
x(_x),
y(_y),
z(_z) {};
45 map<THitI, THitI>* Duplets_start,
48 unsigned int* realIHit);
53 THitI* StsRestHitsStartIndex,
54 unsigned int* realIHit);
60 THitI* StsRestHitsStopIndex,
100 int tmp[10] = {5, 7, 3, 8, 6, 2, 4, 1, 9, 14};
101 for (
int i = 0;
i < 10;
i++) {
111 gStyle->SetCanvasBorderMode(0);
112 gStyle->SetCanvasBorderSize(1);
113 gStyle->SetCanvasColor(0);
115 YZ =
new TCanvas(
"YZ",
"YZ Side View", -1, 0, 500, 500);
116 YZ->Range(-5.0, -50.0, 105.0, 50.0);
120 XZ =
new TCanvas(
"XZ",
"XZ Top View", -1, 500, 500, 500);
121 XZ->Range(-5.0, -50.0, 105.0, 50.0);
125 YX =
new TCanvas(
"YX",
"YX Front View", -506, 0, 500, 500);
126 YX->Range(-50.0, -50.0, 50.0, 50.0);
131 XYZ =
new TCanvas(
"XYZ",
"XYZ 3D View", -500, 500, 500, 500);
132 XYZ->Range(-5.0, -50.0, 115.0, 60.0);
171 int NRegMCTracks = 0;
175 cout <<
"Only reconstructable tracks are shown." << endl;
176 cout <<
"Red - primary p > 0.5 - (first iteration)" << endl;
177 cout <<
"Blue - primary p < 0.5 - (second iteration)" << endl;
178 cout <<
"Green - secondary p > 0.5 - (third\\first iteration)" << endl;
179 cout <<
"Gray - secondary p < 0.5 - (third\\second iteration)" << endl;
182 for (vector<CbmL1MCTrack>::iterator it = L1.
vMCTracks.begin();
191 if (T.
p < 0.1)
continue;
192 pline.SetLineColor(kRed);
193 if (T.
p < 0.5) pline.SetLineColor(kBlue);
194 if (T.
mother_ID != -1) pline.SetLineColor(8);
195 if ((T.
mother_ID != -1) && (T.
p < 0.5)) pline.SetLineColor(12);
197 cout <<
"MC Track: p = " << T.
p <<
" mother_ID = " << T.
mother_ID
198 <<
" PDG = " << T.
pdg <<
" x,y,z = (" << T.
x <<
", " << T.
y <<
", "
199 << T.
z <<
")" << endl;
204 par[2] = T.
px / T.
pz;
205 par[3] = T.
py / T.
pz;
209 int npoints = T.
Points.size();
210 if (
fVerbose >= 10) cout <<
" NMCPoints = " << npoints << endl;
211 if (npoints < 1)
continue;
213 vector<double> lx, ly, lz;
214 lx.push_back(par[0]);
215 ly.push_back(par[1]);
216 lz.push_back(par[5]);
222 for (
int ih = 0; ih < T.
StsHits.size(); ih++)
226 for (
int ip = 0; ip < npoints; ip++) {
232 par1[2] = p.
px / p.
pz;
233 par1[3] = p.
py / p.
pz;
237 static float pz = -1;
238 if (
fabs(pz - p.
z) > 1.0) cout <<
"-- ";
239 cout <<
"point.z = " << p.
z << endl;
243 double Zfrst = par[5];
244 double Zlast = par1[5];
246 if (step >
fabs(Zfrst - Zlast) / 5) step =
fabs(Zfrst - Zlast) / 5;
247 if (Zlast < par[5]) step = -step;
248 while (
fabs(par[5] - Zlast) >
fabs(step)) {
249 double znxt = par[5] + step;
252 double w =
fabs(znxt - Zfrst);
253 double w1 =
fabs(znxt - Zlast);
254 if (w + w1 < 1.e-3) {
258 float xl = (w1 * par[0] + w * par1[0]) / (w + w1);
259 float yl = (w1 * par[1] + w * par1[1]) / (w + w1);
260 float zl = (w1 * par[5] + w * par1[5]) / (w + w1);
261 if ((
fabs(xl) > 50.0) || (
fabs(yl) > 50.0)) {
267 lx.push_back((w1 * par[0] + w * par1[0]) / (w + w1));
268 ly.push_back((w1 * par[1] + w * par1[1]) / (w + w1));
269 lz.push_back((w1 * par[5] + w * par1[5]) / (w + w1));
274 par[2] = p.
px / p.
pz;
275 par[3] = p.
py / p.
pz;
278 lx.push_back(par[0]);
279 ly.push_back(par[1]);
280 lz.push_back(par[5]);
288 pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0]));
290 pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0]));
292 pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0]));
301 cout <<
"L1CADraw: number of registered MC tracks: " << NRegMCTracks << endl;
321 for (vector<L1Track>::iterator it =
algo->
vTracks.begin();
331 vector<double> lx, ly, lz;
332 vector<double> lx_turned, ly_turned, lz_turned;
335 pline.SetLineColor(kBlue);
338 if (
fVerbose >= 4) { cout <<
"hits = "; }
339 for (
int iHit = 0; iHit < nHits; iHit++) {
340 unsigned int ih = recoHits[curRecoHit++];
341 if (
fVerbose >= 4) { cout << ih <<
" "; }
348 TVector3 v3(p.
x, p.
y, p.
z);
352 lx_turned.push_back(v3.x());
353 ly_turned.push_back(v3.y());
354 lz_turned.push_back(v3.z());
357 if (
fVerbose >= 4) { cout << endl; }
363 pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0]));
365 pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0]));
367 pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0]));
369 pline.DrawPolyLine(lx_turned.size(), &(lz_turned[0]), &(lx_turned[0]));
374 cout <<
"L1CADraw: number of reconstructed tracks: " << NRecTracks << endl;
388 const THitI* realIHit) {
390 for (
int iTrip = 0; iTrip < triplets.size(); iTrip++) {
393 unsigned int iLHit = trip.
GetLHit();
394 iLHit = realIHit[iLHit];
395 unsigned int iMHit = trip.
GetMHit();
396 iMHit = realIHit[iMHit];
397 unsigned int iRHit = trip.
GetRHit();
398 iRHit = realIHit[iRHit];
413 pline.SetLineColor(kBlack);
415 marker.SetMarkerColor(kBlack);
416 marker.SetMarkerStyle(26);
417 marker.SetMarkerSize(
HitSize * 2);
419 vector<double> lx, ly, lz;
424 lx.push_back(coor.
x);
425 ly.push_back(coor.
y);
426 lz.push_back(coor.
z);
429 lx.push_back(coor.
x);
430 ly.push_back(coor.
y);
431 lz.push_back(coor.
z);
434 lx.push_back(coor.
x);
435 ly.push_back(coor.
y);
436 lz.push_back(coor.
z);
440 pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0]));
441 marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]);
443 pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0]));
444 marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]);
446 pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0]));
447 marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]);
451 map<THitI, THitI>* Duplets_start,
452 const int MaxArrSize,
453 THitI* StsRestHitsStartIndex,
454 unsigned int* realIHit) {
455 for (
int iSta = 0; iSta <
NStations - 1; iSta++) {
456 const int firstHitOnSta = StsRestHitsStartIndex[iSta];
457 const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1];
458 THitI* staDupletsHits = &(Duplets_hits[iSta][0]);
459 map<THitI, THitI>& staDupletsStart = Duplets_start[iSta];
461 for (
int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta;
463 const int ilh = iRestLHit - firstHitOnSta;
464 const int iirhFirst = staDupletsStart[ilh];
465 const int iirhLast = staDupletsStart[ilh + 1] - 1;
467 for (
int iirh = iirhFirst; iirh <= iirhLast; iirh++) {
468 const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta;
470 const int iLHit = realIHit[iRestLHit];
471 const int iRHit = realIHit[iRestRHit];
488 THitI* Duplets_start,
489 const int MaxArrSize,
490 THitI* StsRestHitsStartIndex,
491 unsigned int* realIHit) {
492 const int firstHitOnSta = StsRestHitsStartIndex[iSta];
493 const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1];
494 THitI* staDupletsHits = Duplets_hits + MaxArrSize * iSta;
495 THitI* staDupletsStart = Duplets_start + MaxArrSize * iSta;
497 for (
int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta;
499 const int ilh = iRestLHit - firstHitOnSta;
500 const int iirhFirst = staDupletsStart[ilh];
501 const int iirhLast = staDupletsStart[ilh + 1] - 1;
503 for (
int iirh = iirhFirst; iirh <= iirhLast; iirh++) {
504 const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta;
506 const int iLHit = realIHit[iRestLHit];
507 const int iRHit = realIHit[iRestRHit];
523 pline.SetLineColor(kBlue);
525 marker.SetMarkerColor(kBlue);
526 marker.SetMarkerStyle(27);
527 marker.SetMarkerSize(
HitSize * 2);
529 vector<double> lx, ly, lz;
534 lx.push_back(coor.
x);
535 ly.push_back(coor.
y);
536 lz.push_back(coor.
z);
539 lx.push_back(coor.
x);
540 ly.push_back(coor.
y);
541 lz.push_back(coor.
z);
545 pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0]));
546 marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]);
548 pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0]));
549 marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]);
551 pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0]));
552 marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]);
557 cout <<
" vStsHits.size = " <<
algo->
vStsHits.size() << endl;
558 cout <<
" vRecoHits.size = " <<
algo->
vRecoHits.size() << endl;
559 cout <<
" vTracks.size = " <<
algo->
vTracks.size() << endl;
564 float x = 0,
y = 0, z = 0;
567 TVector3 v3(
x,
y, z);
578 marker->SetMarkerColor(kRed);
580 marker->SetMarkerSize(
HitSize);
588 marker->SetMarkerColor(kRed);
590 marker->SetMarkerSize(
HitSize);
598 marker->SetMarkerColor(kRed);
600 marker->SetMarkerSize(
HitSize);
608 marker->SetMarkerColor(kRed);
610 marker->SetMarkerSize(
HitSize);
618 latex.SetTextFont(132);
619 latex.SetTextAlign(12);
620 latex.SetTextSize(0.035);
623 latex.DrawLatex(0.0, 45.0,
"YZ Side View");
626 latex.DrawLatex(0.0, 45.0,
"XZ Top View");
629 latex.DrawLatex(-45.0, 45.0,
"YX Front View");
634 Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits];
635 Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits];
636 Double_t x_poly_turned[nhits], z_poly_turned[nhits];
637 Double_t x_poly_fake_turned[nhits], z_poly_fake_turned[nhits];
640 for (
int ista =
NStations - 1; ista >= 0;
644 Int_t n_poly_fake = 0;
654 TVector3 v3(
x,
y, z);
665 x_poly_turned[n_poly] = x_t;
666 z_poly_turned[n_poly] = z_t;
669 x_poly_fake[n_poly_fake] =
x;
670 y_poly_fake[n_poly_fake] =
y;
671 z_poly_fake[n_poly_fake] = z;
672 x_poly_fake_turned[n_poly_fake] = x_t;
673 z_poly_fake_turned[n_poly_fake] = z_t;
680 TLine* line =
new TLine();
682 line->DrawLine(st.
z[0], -st.
Rmax[0], st.
z[0], st.
Rmax[0]);
684 TPolyMarker* pmyz =
new TPolyMarker(n_poly, z_poly, y_poly);
685 pmyz->SetMarkerColor(
mcolor[ista]);
690 TPolyMarker* pmyz_fake =
691 new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake);
692 pmyz_fake->SetMarkerColor(
mcolor[ista]);
694 pmyz_fake->SetMarkerSize(
HitSize);
699 line->DrawLine(st.
z[0], -st.
Rmax[0], st.
z[0], st.
Rmax[0]);
701 TPolyMarker* pmxz =
new TPolyMarker(n_poly, z_poly, x_poly);
702 pmxz->SetMarkerColor(
mcolor[ista]);
707 TPolyMarker* pmxz_fake =
708 new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake);
709 pmxz_fake->SetMarkerColor(
mcolor[ista]);
711 pmxz_fake->SetMarkerSize(
HitSize);
716 TEllipse* ellipse =
new TEllipse(0.0, 0.0, st.
Rmax[0]);
718 ellipse->SetFillStyle(0);
721 TPolyMarker* pmyx =
new TPolyMarker(n_poly, x_poly, y_poly);
722 pmyx->SetMarkerColor(
mcolor[ista]);
727 TPolyMarker* pmyx_fake =
728 new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake);
729 pmyx_fake->SetMarkerColor(
mcolor[ista]);
731 pmyx_fake->SetMarkerSize(
HitSize);
736 TPolyMarker* pmxyz =
new TPolyMarker(n_poly, z_poly_turned, x_poly_turned);
737 pmxyz->SetMarkerColor(
mcolor[ista]);
742 TPolyMarker* pmxyz_fake =
743 new TPolyMarker(n_poly_fake, z_poly_fake_turned, x_poly_fake_turned);
744 pmxyz_fake->SetMarkerColor(
mcolor[ista]);
746 pmxyz_fake->SetMarkerSize(
HitSize);
753 THitI* StsRestHitsStopIndex,
754 unsigned int* realIHit) {
757 latex.SetTextFont(132);
758 latex.SetTextAlign(12);
759 latex.SetTextSize(0.035);
762 latex.DrawLatex(0.0, 45.0,
"YZ Side View");
765 latex.DrawLatex(0.0, 45.0,
"XZ Top View");
768 latex.DrawLatex(-45.0, 45.0,
"YX Front View");
773 Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits];
774 Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits];
777 for (
int ista =
NStations - 1; ista >= 0;
781 Int_t n_poly_fake = 0;
782 for (
int iRestHit = StsRestHitsStartIndex[ista];
783 iRestHit < StsRestHitsStopIndex[ista];
785 int ih = realIHit[iRestHit];
798 x_poly_fake[n_poly_fake] =
x;
799 y_poly_fake[n_poly_fake] =
y;
800 z_poly_fake[n_poly_fake] = z;
807 TLine* line =
new TLine();
809 line->DrawLine(st.
z[0], -st.
Rmax[0], st.
z[0], st.
Rmax[0]);
811 TPolyMarker* pmyz =
new TPolyMarker(n_poly, z_poly, y_poly);
812 pmyz->SetMarkerColor(
mcolor[ista]);
817 TPolyMarker* pmyz_fake =
818 new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake);
819 pmyz_fake->SetMarkerColor(
mcolor[ista]);
821 pmyz_fake->SetMarkerSize(
HitSize);
826 line->DrawLine(st.
z[0], -st.
Rmax[0], st.
z[0], st.
Rmax[0]);
828 TPolyMarker* pmxz =
new TPolyMarker(n_poly, z_poly, x_poly);
829 pmxz->SetMarkerColor(
mcolor[ista]);
834 TPolyMarker* pmxz_fake =
835 new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake);
836 pmxz_fake->SetMarkerColor(
mcolor[ista]);
838 pmxz_fake->SetMarkerSize(
HitSize);
843 TEllipse* ellipse =
new TEllipse(0.0, 0.0, st.
Rmax[0]);
845 ellipse->SetFillStyle(0);
848 TPolyMarker* pmyx =
new TPolyMarker(n_poly, x_poly, y_poly);
849 pmyx->SetMarkerColor(
mcolor[ista]);
854 TPolyMarker* pmyx_fake =
855 new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake);
856 pmyx_fake->SetMarkerColor(
mcolor[ista]);
858 pmyx_fake->SetMarkerSize(
HitSize);
869 std::cin.get(symbol);
870 if (symbol ==
'r')
ask =
false;
871 if (symbol ==
'q') exit;
872 }
while (symbol !=
'\n');
901 system(
"mkdir L1CADraw -p");
922 tmp +=
"XYZView.pdf";