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