CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
BesVisDisplay.cxx
Go to the documentation of this file.
1
2
3//////////////////////////////////////////////////////////////////////////
4// //
5// BesVisDisplay //
6// //
7// Utility class to display ATLAS outline, tracks, clusters, jets,.. //
8// //
9//////////////////////////////////////////////////////////////////////////
10
11#include <iostream>
12#include <sstream>
13#include <TROOT.h>
14#include <TEnv.h>
15#include <TButton.h>
16#include <TCanvas.h>
17#include <TPad.h>
18#include <TColor.h>
19#include <TAttImage.h>
20#include <TView.h>
21#include <TArc.h>
22#include <TText.h>
23#include <TPaveLabel.h>
24#include <TPaveText.h>
25#include <TList.h>
26#include <TDiamond.h>
27#include <TNode.h>
28#include <TTUBE.h>
29#include <TMath.h>
30#include <X3DBuffer.h>
31#include <TVirtualGeoPainter.h>
32#include <TControlBar.h>
33#include <TImage.h>
34#include <TASImage.h>
35#include <TGeoManager.h>
36#include <TGeoMaterial.h>
37#include <TGeoMedium.h>
38#include <TGeoVolume.h>
39#include <TGeoMatrix.h>
40#include <TGeoBBox.h>
41#include <TGeoTube.h>
42#include <TGeoArb8.h>
43#include <TViewerX3D.h>
44
48#include "BesVisLib/BesEvent.h"
49#include "BesVisLib/BesTView.h"
50
52
53using namespace std;
54
55#ifndef __CINT__
57#endif
58
59//_____________________________________________________________________________
61{
62
63}
64
65//_____________________________________________________________________________
66BesVisDisplay::BesVisDisplay(const char *title) : TQObject(),
67 fBesGeometry(0),
68 fCgemROOTGeo(0), //Long Peixun's update: for CGEM
69 fMdcROOTGeo(0),
70 fTofROOTGeo(0),
71 fEmcROOTGeo(0),
72 fMucROOTGeo(0),
73 fMdcCon(0),
74 fTofCon(0),
75 fEmcCon(0),
76 fMucCon(0),
77 fAllVis(0),
78 fQuarterVis(0),
79 fHalfVis(0),
80 fNoEndVis(0)
81{
82
83}
84
85//_____________________________________________________________________________
87{
88
89}
90
91//_____________________________________________________________________________
93{
94 if (c != 0) {
95 fCanvas = c;
96 }
97 else {
98 fCanvas = new TCanvas("Canvas", " ",0,0,1024,768);
99 }
100}
101
103{
104 fDisplayMode = 0;
105 //Long Peixun's update: Initialize flag of header visibility
106 fVisHeader = 1;
107 fCanvas->cd();
108 //fCanvas->SetEditable(kFALSE);
109 fCanvas->SetFillColor(10);
110
111 // pad 3D
112 fPad3D = new TPad("Pad3D", "Pad3D", 0.75, 0.75, 0.9, 0.9);
113 //Long Peixun's update: Back color of 3D view -> White
114 //fPad3D->SetFillColor(TColor::GetColor(204,204,204));
115 //fPad3D->SetFillColor(16);
116 fPad3D->Draw();
117
118 // pad Header
119 fPadHeader = new TPad("PadHeader", "PadHeader", 0.0, 0.68, 1.0, 1.0);
120 fPadHeader->Draw();
121 fPadHeader->cd();
122
123 TString fp = gEnv->GetValue("Root.TTFontPath", "");
124 TString bc = fp + "/BlackChancery.ttf";
125 TString ar = fp + "/arial.ttf";
126
127 string besvisPath = getenv("BESVISLIBROOT");
128 TString filePath(besvisPath);
129 filePath += "/icons/";
130
131 fHeaderHImage = TImage::Open(filePath + "HeaderH.gif");
132 fHeaderHImage->SetEditable(kTRUE);
133 //fHeaderHImage->Draw("same");
134 fHeaderVImage = TImage::Open(filePath + "HeaderV.gif");
135 fHeaderVImage->SetEditable(kTRUE);
136 // fHeaderVImage->Draw("same");
137 fHeaderImage = TImage::Open(filePath + "Header.gif");
138 fHeaderImage->DrawText(620, 15, "BesVis", 30,
139 gROOT->GetColor(2)->AsHexString(),
140 bc, TImage::kShadeBelow);
141 fHeaderImage->SetConstRatio(false);
142 fHeaderImage->Draw("same");
143
144 fBesHeader = new BesHeader(0,0,1,1, "br");
145 fBesHeader->SetTextSize(0.1);
146 fBesHeader->SetFillColor(28);
147 fBesHeader->SetFillStyle(0);
148 fBesHeader->SetBorderSize(4);
149
150 fLatticeWidth=0.185;
151 fTextSizeTitle=0.08;
152 fTextSizeTime=0.07;
153 fTextSizeData=0.05;
154 fTextSizeFlt=0.02;
155 fCoordx=0.01;
156 fCoordy=0.8;
157 fDistanceOfRows=0.01;
158
159 fMdcOn = true;
160 fTofOn = true;
161 fEmcOn = true;
162
163 Connect(fBesHeader,"TransferMdcOn(Bool_t)","BesVisDisplay",this,"SetMdcOn(Bool_t)");
164 Connect(fBesHeader,"TransferTofOn(Bool_t)","BesVisDisplay",this,"SetTofOn(Bool_t)");
165 Connect(fBesHeader,"TransferEmcOn(Bool_t)","BesVisDisplay",this,"SetEmcOn(Bool_t)");
166
167 DrawHeader();
168
169 // pad XY
170 fPadXY = new TPad("PadXY", "PadXY", 0.0, 0.0, 0.5, 0.68);
171 fPadXY->Draw();
172
173 // pad ZR
174 fPadZR = new TPad("PadZR", "PadZR", 0.5, 0.0, 1.0, 0.68);
175 fPadZR->Draw();
176
177 //Long Peixun's update: for CGEM Unfolded display
178 fPadCgemUF[0] = new TPad("PadCgemUF0", "PadCgemUF0", 0.0, 0.0, 0.5, 0.68);
179 fPadCgemUF[1] = new TPad("PadCgemUF1", "PadCgemUF1", 0.0, 0.0, 0.5, 0.68);
180 fPadCgemUF[2] = new TPad("PadCgemUF2", "PadCgemUF2", 0.0, 0.0, 0.5, 0.68);
181 fPadCgemUF[0]->Draw();
182 fPadCgemUF[1]->Draw();
183 fPadCgemUF[2]->Draw();
184 fCgemUFViewLayer = 0;
185
186 /*
187 fPad3D->SetBorderMode(0);
188 fPad3D->SetBorderSize(3);
189 fPadHeader->SetBorderMode(1);
190 fPadHeader->SetBorderSize(3);
191 fPadXY->SetBorderMode(2);
192 fPadXY->SetBorderSize(3);
193 fPadZR->SetBorderMode(3);
194 fPadZR->SetBorderSize(3);
195 */
196}
197
198//_____________________________________________________________________________
199//Long Peixun's update: Consider NULL pointer
201{
202 if (fPadXY) {
203 fPadXY->cd();
204 BesView* view = dynamic_cast<BesView*>(fPadXY->GetView());
205 if (view) view->Reset();
206 }
207 if (fPadZR) {
208 fPadZR->cd();
209 BesView* view = dynamic_cast<BesView*>(fPadZR->GetView());
210 if (view) view->Reset();
211 }
212 if (fPad3D) {
213 fPad3D->cd();
214 BesView* view = dynamic_cast<BesView*>(fPad3D->GetView());
215 if (view) view->Reset();
216 }
217
218 //Long Peixun's update: add CGEM UF view
219 for (int i = 0; i < 3; ++i)
220 {
221 if (fPadCgemUF[i])
222 {
223 fPadCgemUF[i]->cd();
224 BesView* view = dynamic_cast<BesView*>(fPadCgemUF[i]->GetView());
225 if (view) view->Reset();
226 }
227 }
228
229 SwitchDisplayMode(fDisplayMode);
230}
231
232//_____________________________________________________________________________
233//Long Peixun's update: Refresh all pads
235{
236 if (fPadXY) {
237 fPadXY->cd();
238 BesView* view = dynamic_cast<BesView*>(fPadXY->GetView());
239 if (view) view->Refresh();
240 }
241 if (fPadZR) {
242 fPadZR->cd();
243 BesView* view = dynamic_cast<BesView*>(fPadZR->GetView());
244 if (view) view->Refresh();
245 }
246 if (fPad3D) {
247 fPad3D->cd();
248 BesView* view = dynamic_cast<BesView*>(fPad3D->GetView());
249 if (view) view->Refresh();
250 }
251
252 //Long Peixun's update: add CGEM UF view
253 for (int i = 0; i < 3; ++i)
254 {
255 if (fPadCgemUF[i])
256 {
257 fPadCgemUF[i]->cd();
258 BesView* view = dynamic_cast<BesView*>(fPadCgemUF[i]->GetView());
259 if (view) view->Refresh();
260 }
261 }
262
263 SwitchDisplayMode(fDisplayMode);
264}
265
266//_____________________________________________________________________________
267
268void BesVisDisplay::InitGeometryFromGDML(const TString fPath, bool mrpc, bool cgem)
269{
270 if ( gBesGeometry ) delete gBesGeometry;
271 fBesGeometry = new BesGeometry();
272 gBesGeometry = fBesGeometry;
273 fBesGeometry->InitFromGDML(fPath, mrpc, cgem);
274 fBesGeometry->SetDefaultVis();
275
276 // should be deleted after BesView completed;
277 fCgemROOTGeo = fBesGeometry->GetCgemROOTGeo(); //Long Peixun's update: for CGEM
278 fMdcROOTGeo = fBesGeometry->GetMdcROOTGeo(); //here liang
279 fTofROOTGeo = fBesGeometry->GetTofROOTGeo(); //here liang
280 fEmcROOTGeo = fBesGeometry->GetEmcROOTGeo(); //here liang
281 fMucROOTGeo = fBesGeometry->GetMucROOTGeo();
282}
283
284//_____________________________________________________________________________
285
287{
288 if ( gBesGeometry ) delete gBesGeometry;
289 fBesGeometry = new BesGeometry();
290 gBesGeometry = fBesGeometry;
291 fBesGeometry->InitFromROOT(volBes);
292
293 // should be deleted after BesView completed;
294 fCgemROOTGeo = fBesGeometry->GetCgemROOTGeo(); //Long Peixun's update: for CGEM
295 fMdcROOTGeo = fBesGeometry->GetMdcROOTGeo();
296 fTofROOTGeo = fBesGeometry->GetTofROOTGeo();
297 fEmcROOTGeo = fBesGeometry->GetEmcROOTGeo();
298 fMucROOTGeo = fBesGeometry->GetMucROOTGeo();
299}
300
302{
303 fPadHeader->cd();
304 //fPadHeader->Clear();
305
306 //TASImage asImage("HeaderH2.gif");
307 //Pixmap_t pic = asImage.GetPixmap();
308
309 //cout << "mode " << fDisplayMode << endl;
310 // draw text over image with funny font
311 if (!IsVHeader()) //Long Peixun's update: replace by IsVHeader()
312 {
313 fHeaderImage->Zoom(161, 649, 635, 174); // (x Offset, y Offset, width, height)
314 //fHeaderImage->Scale(800, 200);
315 }
316 else {
317 fHeaderImage->Zoom(600, 324, 164, 473);
318 //fHeaderImage->Scale(200, 600);
319 }
320
321 // draw text over image with foreground specified by pixmap
322 //img->DrawText(250, 350, "goodbye cruel world ...", 24, 0, ar, TImage::kPlain, "fore.xpm");
323
324 fBesHeader->Clear();
325 //fBesHeader->AddText("Commented");
326
327 if (!gEvent) {
328 fBesHeader->AddText("No Event Info");
329 }
330 else {
331 // old coordinates
332 Double_t coordx=fCoordx;
333 Double_t coordy=fCoordy;
334
335 // Get data
336 Long64_t runno = gEvent->GetRun();
337 Long64_t eventno = gEvent->GetEvent();
338 Int_t year = gEvent->GetYear();
339 Int_t month = gEvent->GetMonth();
340 Int_t day = gEvent->GetDay();
341 Int_t hour = gEvent->GetHour();
342 Int_t min = gEvent->GetMin();
343 Int_t sec = gEvent->GetSec();
344
345 // Add run no.
346 if (IsVHeader()) {
347 coordx = 0.1;
348 coordy = 0.88; //Long Peixun's update: 0.90 -> 0.88
349 }
350 else {
351 coordx = 0.02;
352 coordy = 0.88; //Long Peixun's update: 0.90 -> 0.88
353 }
354 char title1[20];
355 sprintf(title1, "Run %ld ", runno);
356 TText* ttitle1 = fBesHeader->AddText(coordx,coordy,title1);
357 ttitle1->SetTextSize(fTextSizeTitle);
358 ttitle1->SetTextColor(1);
359 ttitle1->SetTextAlign(12);
360
361 // Add event no.
362 if (IsVHeader()) {
363 coordx = 0.1;
364 coordy = 0.81; //Long Peixun's update: 0.86 -> 0.81
365 }
366 else {
367 coordx = 0.02;
368 coordy = 0.76; //Long Peixun's update: 0.82 -> 0.76
369 }
370 char title2[20];
371 sprintf(title2, "Event %ld ", eventno);
372 TText* ttitle2 = fBesHeader->AddText(coordx,coordy,title2);
373 ttitle2->SetTextSize(fTextSizeTitle);
374 ttitle2->SetTextColor(1);
375 ttitle2->SetTextAlign(12);
376
377 // Add estime
378 if (IsVHeader()) {
379 coordx = 0.1;
380 coordy = 0.74; //Long Peixun's update: 0.83 -> 0.74
381 }
382 else {
383 coordx = 0.02;
384 coordy = 0.63; //Long Peixun's update: 0.72 -> 0.63
385 }
386 char titleEvTime[30];
387
388 //Long Peixun's update: if this event is not a rec event, don't show estime
390 {
391 if (fabs(gEvent->GetHeader().GetEvTime())>0.0001)
392 {
393 double esTimeConst = 230; // sub in T0 of each layer in MDC calibration
394 sprintf(titleEvTime, "Estime:%5.1fns", gEvent->GetHeader().GetEvTime() - esTimeConst);
395 }
396 else sprintf(titleEvTime, "Estime:0 ns");
397 }
398 else sprintf(titleEvTime, "Estime: -");
399
400 TText* ttitleEvTime = fBesHeader->AddText(coordx,coordy,titleEvTime);
401 ttitleEvTime->SetTextSize(fTextSizeTime);
402 ttitleEvTime->SetTextFont(52);
403 ttitleEvTime->SetTextColor(1);
404 ttitleEvTime->SetTextAlign(12);
405
406 // Add stat
407 if (IsVHeader()) {
408 coordx = 0.1;
409 coordy = 0.69; //Long Peixun's update: 0.81 -> 0.69
410 }
411 else {
412 coordx = 0.2;
413 coordy = 0.63; //Long Peixun's update: 0.72 -> 0.63
414 }
415 char titleEvTimeStat[30];
416
417 //Long Peixun's update: if this event is not a rec event, don't show status
419 {
420 sprintf(titleEvTimeStat, " stat:%3d", gEvent->GetHeader().GetEvTimeStatus());
421 }
422 else sprintf(titleEvTimeStat, " stat: -");
423
424 TText* ttitleEvTimeStat = fBesHeader->AddText(coordx,coordy,titleEvTimeStat);
425 ttitleEvTimeStat->SetTextSize(fTextSizeTime);
426 ttitleEvTimeStat->SetTextFont(52);
427 ttitleEvTimeStat->SetTextColor(1);
428 ttitleEvTimeStat->SetTextAlign(12);
429
430 // Add quality
431 if (IsVHeader()) {
432 coordx = 0.1;
433 coordy = 0.64; //Long Peixun's update: 0.79 -> 0.64
434 }
435 else {
436 coordx = 0.4;
437 coordy = 0.63; //Long Peixun's update: 0.72 -> 0.63
438 }
439 char titleEvTimeQ[30];
440
441 //Long Peixun's update: if this event is not a rec event, don't show quality
443 {
444 sprintf(titleEvTimeQ, " quality:%3.1f", gEvent->GetHeader().GetEvTimeQuality());
445 }
446 else sprintf(titleEvTimeQ, " quality: -");
447
448 TText* ttitleEvTimeQ = fBesHeader->AddText(coordx,coordy,titleEvTimeQ);
449 ttitleEvTimeQ->SetTextSize(fTextSizeTime);
450 ttitleEvTimeQ->SetTextFont(52);
451 ttitleEvTimeQ->SetTextColor(1);
452 ttitleEvTimeQ->SetTextAlign(12);
453
454 // Add date
455 if (IsVHeader()) {
456 coordx = 0.1;
457 coordy = 0.57; //Long Peixun's update: 0.76 -> 0.57
458 }
459 else {
460 coordx = 0.02;
461 coordy = 0.51; //Long Peixun's update: 0.60 -> 0.51
462 }
463 char date[70];
464 sprintf(date,"date: %4d-%02d-%02d ", year,month,day);
465 TText* tdate = fBesHeader->AddText(coordx,coordy,date);
466 tdate->SetTextSize(fTextSizeTime);
467 tdate->SetTextFont(52);
468 tdate->SetTextColor(1);
469 tdate->SetTextAlign(12);
470
471 // Add time
472 if (IsVHeader()) {
473 coordx = 0.1;
474 coordy = 0.52; //Long Peixun's update: 0.69 -> 0.52
475 }
476 else {
477 coordx = 0.25;
478 coordy = 0.51; //Long Peixun's update: 0.60 -> 0.51
479 }
480 char time[70];
481 sprintf(time,"time: %02d:%02d:%02d", hour,min,sec);
482 TText* ttime=fBesHeader->AddText(coordx,coordy,time);
483 ttime->SetTextSize(fTextSizeTime);
484 ttime->SetTextFont(52);
485 ttime->SetTextColor(1);
486 ttime->SetTextAlign(12);
487
488 // string for contents
489 TString info;
490 vector<TString> statusCon;
491
492 char data[25];
493 if (gEvent->GetMC()) sprintf(data, "MC=Yes");
494 else sprintf(data, "MC=No");
495 statusCon.push_back(TString(data));
496
497 vector<Int_t> trigChannelVector = gEvent->GetHeader().GetTrigChannelVector();
498 vector<Int_t> trigConditionVector = gEvent->GetHeader().GetTrigConditionVector();
499 Int_t timeType = gEvent->GetHeader().GetTimeType();
500 //************************************
501 sprintf(data, "Time Type: %d", timeType);
502 statusCon.push_back(TString(data));
503 if (IsVHeader()) {
504 coordx = 0.10;
505 coordy = 0.45; //Long Peixun's update: 0.71 -> 0.45
506 }
507 else {
508 coordx = 0.02;
509 coordy = 0.38; //Long Peixun's update: 0.50 -> 0.38
510 }
511 for (Int_t i = 0; i < (Int_t)statusCon.size(); i++) {
512 TText* ttitle=fBesHeader->AddText(coordx,coordy,statusCon[i].Data());
513 if (IsVHeader()) coordy -= 0.04; //Long Peixun's update: 0.02 -> 0.04
514 else coordx += 0.2;
515 ttitle->SetTextSize(fTextSizeData);
516 ttitle->SetTextFont(62);
517 ttitle->SetTextColor(1);
518 ttitle->SetTextAlign(12);
519 }
520 vector<TString> infoCon;
521 //cout << "BesVisDisplay::time Type: " << timeType << endl;
522 vector<Int_t>::iterator pTrigVector;
523 //Long Peixun's update: Annotate "for"
524 // for (pTrigVector = trigConditionVector.begin();
525 // pTrigVector != trigConditionVector.end();
526 // pTrigVector++){
527 // //cout << "BesVisDisplay::trigCondition: " << *pTrigVector << endl;
528 // }
529 //for (pTrigVector = trigChannelVector.begin();
530 // pTrigVector != trigChannelVector.end();
531 // pTrigVector++){
532 //sprintf(data, "Trig Channel_00");
533 //infoCon.push_back(TString(data));
534 //sprintf(data, "Trig Channel_01");
535 //infoCon.push_back(TString(data));
536 //sprintf(data, "Trig Channel_02");
537 //infoCon.push_back(TString(data));
538 //sprintf(data, "Trig Channel_03");
539 //infoCon.push_back(TString(data));
540 //sprintf(data, "Trig Channel_04");
541 //infoCon.push_back(TString(data));
542 //sprintf(data, "Trig Channel_05");
543 //infoCon.push_back(TString(data));
544 //sprintf(data, "Trig Channel_06");
545 //infoCon.push_back(TString(data));
546 //sprintf(data, "Trig Channel_07");
547 //infoCon.push_back(TString(data));
548 //sprintf(data, "Trig Channel_08");
549 //infoCon.push_back(TString(data));
550 //sprintf(data, "Trig Channel_09");
551 //infoCon.push_back(TString(data));
552 //sprintf(data, "Trig Channel_10");
553 //infoCon.push_back(TString(data));
554 //sprintf(data, "Trig Channel_11");
555 //infoCon.push_back(TString(data));
556 //sprintf(data, "Trig Channel_12");
557 //infoCon.push_back(TString(data));
558 //sprintf(data, "Trig Channel_13");
559 //infoCon.push_back(TString(data));
560 //sprintf(data, "Trig Channel_14");
561 //infoCon.push_back(TString(data));
562 //sprintf(data, "Trig Channel_15");
563 //infoCon.push_back(TString(data));
564 //cout << "BesVisDisplay::trigChannel: " << *pTrigVector << endl;
565 //}
566 //************************************
567
568 //if (GetMdcOn()) {
569 // //Float_t p = gEvent->GetHeader().GetP();
570 // //Float_t pt = gEvent->GetHeader().GetPt();
571 // //Float_t px = gEvent->GetHeader().GetPx();
572 // //Float_t py = gEvent->GetHeader().GetPy();
573 // //Float_t pz = gEvent->GetHeader().GetPz();
574
575 // //sprintf(data, "P= %-.3fGeV", p);
576 // //infoCon.push_back(TString(data));
577 // //sprintf(data, "Pt= %-.3fGeV", pt);
578 // //infoCon.push_back(TString(data));
579 // //sprintf(data, "Px= %-.3fGeV", px);
580 // //infoCon.push_back(TString(data));
581 // //sprintf(data, "Py= %-.3fGeV", py);
582 // //infoCon.push_back(TString(data));
583 // //sprintf(data, "Pz= %-.3fGeV", pz);
584 // //infoCon.push_back(TString(data));
585 //}
586
587 //if (GetTofOn()) {
588 // Float_t t = gEvent->GetHeader().GetT();
589
590 // sprintf(data, "tofMin= %-.3fns", t);
591 // infoCon.push_back(TString(data));
592 //}
593
594 //if (GetEmcOn()) {
595 // Float_t e = gEvent->GetHeader().GetE();
596
597 // sprintf(data, "ECal= %-.3fGeV", e);
598 // infoCon.push_back(TString(data));
599 //}
600
601 ////sprintf(data, "MDC Track(GeV): ");
602 ////infoCon.push_back(TString(data));
603 ////sprintf(data, "P1=0.945");
604 ////infoCon.push_back(TString(data));
605 ////sprintf(data, "P2=0.702");
606 ////infoCon.push_back(TString(data));
607 ////sprintf(data, "P3=0.421");
608 ////infoCon.push_back(TString(data));
609 ////sprintf(data, "P4=1.048");
610 ////infoCon.push_back(TString(data));
611
612 ////sprintf(data, "EMC Cluster(MeV):");
613 ////infoCon.push_back(TString(data));
614 ////sprintf(data, "E1=151.91");
615 ////infoCon.push_back(TString(data));
616 ////sprintf(data, "E2=226.00");
617 ////infoCon.push_back(TString(data));
618 ////sprintf(data, "E3=295.91");
619 ////infoCon.push_back(TString(data));
620 ////sprintf(data, "E4=165.27");
621 ////infoCon.push_back(TString(data));
622 ////sprintf(data, "E5=48.68");
623 ////infoCon.push_back(TString(data));
624 ////sprintf(data, "E6=193.98");
625 ////infoCon.push_back(TString(data));
626 Int_t npr;
627 Float_t rowH;
628 Float_t textSize = fTextSizeData;
629 if (IsVHeader()) {
630 fCoordx = 0.10;
631 fCoordy = 0.35; //Long Peixun's update: 0.70 -> 0.35
632 npr = 1;
633 rowH = 0.04;
634 textSize *= 1.2;
635 }
636 else {
637 fCoordx = 0.02;
638 fCoordy = 0.38; //Long Peixun's update: 0.50 -> 0.38
639 npr = 4;
640 rowH = 0.1;
641 }
642
643 pTrigVector = trigChannelVector.begin();
644 for (Int_t i = 0; i < (Int_t)infoCon.size(); i++) {
645 coordx = fCoordx + (i%npr)*(1.0/npr);
646 coordy = fCoordy - (i/npr)*rowH;
647
648 if (*pTrigVector == i){
649 TString temp = infoCon[i] + " ON";
650 TText* tdata=fBesHeader->AddText(coordx,coordy,temp.Data());
651 tdata->SetTextSize(textSize);
652 tdata->SetTextFont(62);
653 tdata->SetTextColor(2);
654 tdata->SetTextAlign(12);
655 pTrigVector++;
656 }
657 else {
658 TString temp = infoCon[i] + " OFF";
659 TText* tdata=fBesHeader->AddText(coordx,coordy,temp.Data());
660 tdata->SetTextSize(textSize);
661 tdata->SetTextFont(62);
662 tdata->SetTextColor(1);
663 tdata->SetTextAlign(12);
664 }
665 }
666
667 }
668
669 fBesHeader->Draw("same");
670
671 fPadHeader->SetEditable(kFALSE);
672 fPadHeader->Modified();
673 fPadHeader->Update();
674 fCanvas->cd();
675}
676
677//_____________________________________________________________________________
678
679void BesVisDisplay::SetMdcOn(Bool_t MdcOn)
680{
681 fMdcOn = MdcOn;
682 //fBesHeader->SetMdcOn(MdcOn);
683 DrawHeader();
684}
685
686//_____________________________________________________________________________
687
688void BesVisDisplay::SetTofOn(Bool_t TofOn)
689{
690 fTofOn = TofOn;
691 //fBesHeader->SetTofOn(TofOn);
692 DrawHeader();
693}
694
695//_____________________________________________________________________________
696
697void BesVisDisplay::SetEmcOn(Bool_t EmcOn)
698{
699 fEmcOn = EmcOn;
700 //fBesHeader->SetEmcOn(EmcOn);
701 DrawHeader();
702}
703
704//_____________________________________________________________________________
705
707{
708 SetDisplayMode(mode);
709 ResizePad();
710 fCanvas->Update();
711}
712
713//_____________________________________________________________________________
715{
716 fCanvas->cd();
717 Double_t xlowH = -0.11, xupH = -0.1, ylowH = -0.11, yupH = -0.1;
718 Int_t width = fCanvas->GetWw();
719 Int_t height = fCanvas->GetWh();
720 Double_t hVSw = Double_t(height)/width;
721 Double_t x2D = 1.0-hVSw;
722 //cout << "Canvas width " << width << " height " << height << " x2D " << x2D << endl;
723 Double_t y2D = 0.5/hVSw;
724 Double_t x3D = (1.0/3)/hVSw;
725
726 //Long Peixun's update: Add CGEM Unfolded display pad setting
727 switch ( fDisplayMode ) {
728 case 0 : // 2D XY+ZR
729 fPadHeader->SetPad(0.0, y2D, 1.0, 1.0);
730 fPadXY ->SetPad(0.0, 0.0, 0.5, y2D);
731 fPadZR ->SetPad(0.5, 0.0, 1.0, y2D);
732 fPad3D ->SetPad(xlowH, ylowH, xupH, yupH);
733 fPadCgemUF[0]->SetPad(xlowH, ylowH, xupH, yupH);
734 fPadCgemUF[1]->SetPad(xlowH, ylowH, xupH, yupH);
735 fPadCgemUF[2]->SetPad(xlowH, ylowH, xupH, yupH);
736 break;
737 case 1 : // 2D XY
738 fPadHeader->SetPad(0.0, 0.0, x2D, 1.0);
739 fPadXY ->SetPad(x2D, 0.0, 1.0, 1.0);
740 fPadZR ->SetPad(xlowH, ylowH, xupH, yupH);
741 fPad3D ->SetPad(xlowH, ylowH, xupH, yupH);
742 fPadCgemUF[0]->SetPad(xlowH, ylowH, xupH, yupH);
743 fPadCgemUF[1]->SetPad(xlowH, ylowH, xupH, yupH);
744 fPadCgemUF[2]->SetPad(xlowH, ylowH, xupH, yupH);
745 break;
746 case 2 : // 2D ZR
747 fPadHeader->SetPad(0.0, 0.0, x2D, 1.0);
748 fPadXY ->SetPad(xlowH, ylowH, xupH, yupH);
749 fPadZR ->SetPad(x2D, 0.0, 1.0, 1.0);
750 fPad3D ->SetPad(xlowH, ylowH, xupH, yupH);
751 fPadCgemUF[0]->SetPad(xlowH, ylowH, xupH, yupH);
752 fPadCgemUF[1]->SetPad(xlowH, ylowH, xupH, yupH);
753 fPadCgemUF[2]->SetPad(xlowH, ylowH, xupH, yupH);
754 break;
755 case 3 : // 3D
756 fPadHeader->SetPad(0.0, 0.0, x2D, 1.0);
757 fPadXY ->SetPad(xlowH, ylowH, xupH, yupH);
758 fPadZR ->SetPad(xlowH, ylowH, xupH, yupH);
759 fPad3D ->SetPad(x2D, 0.0, 1.0, 1.0);
760 fPadCgemUF[0]->SetPad(xlowH, ylowH, xupH, yupH);
761 fPadCgemUF[1]->SetPad(xlowH, ylowH, xupH, yupH);
762 fPadCgemUF[2]->SetPad(xlowH, ylowH, xupH, yupH);
763 break;
764 case 4 : // 2D+3D
765 //fPadHeader->SetPad(xlowH, ylowH, xupH, yupH);
766 fPadHeader->SetPad(0.0, 2*x3D, 1.0, 1.0);
767 fPadXY ->SetPad(0.0, x3D, 1.0/3, 2*x3D);
768 fPadZR ->SetPad(0.0, 0.0, 1.0/3, x3D);
769 fPad3D ->SetPad(1.0/3, 0.0, 1.0, 2*x3D);
770 fPadCgemUF[0]->SetPad(xlowH, ylowH, xupH, yupH);
771 fPadCgemUF[1]->SetPad(xlowH, ylowH, xupH, yupH);
772 fPadCgemUF[2]->SetPad(xlowH, ylowH, xupH, yupH);
773 break;
774 case 5: //Long Peixun's update: CGEM UF one layer
775 fPadHeader->SetPad(0.0, 0.0, x2D, 1.0);
776 fPadXY ->SetPad(xlowH, ylowH, xupH, yupH);
777 fPadZR ->SetPad(xlowH, ylowH, xupH, yupH);
778 fPad3D ->SetPad(xlowH, ylowH, xupH, yupH);
779 fPadCgemUF[0]->SetPad(xlowH, ylowH, xupH, yupH);
780 fPadCgemUF[1]->SetPad(xlowH, ylowH, xupH, yupH);
781 fPadCgemUF[2]->SetPad(xlowH, ylowH, xupH, yupH);
782 fPadCgemUF[fCgemUFViewLayer]->SetPad(x2D, 0.0, 1.0, 1.0);
783 break;
784 case 6: //Long Peixun's update: CGEM UF three layers
785 fPadHeader->SetPad(0.0, y2D, 1.0, 1.0);
786 fPadXY ->SetPad(xlowH, ylowH, xupH, yupH);
787 fPadZR ->SetPad(xlowH, ylowH, xupH, yupH);
788 fPad3D ->SetPad(xlowH, ylowH, xupH, yupH);
789 fPadCgemUF[0]->SetPad(0.0, 0.0, 0.3333, y2D);
790 fPadCgemUF[1]->SetPad(0.3333, 0.0, 0.6667, y2D);
791 fPadCgemUF[2]->SetPad(0.6667, 0.0, 1.0, y2D);
792 break;
793 default :
794 return;
795 }
796
797 //Long Peixun's update: Add Header visibility control
798 if (!fVisHeader) fPadHeader->SetPad(xlowH * 10, ylowH * 10, xupH * 10, yupH * 10);
799
800 //fPadHeader->Update();
801 DrawHeader();
802
803 switch ( fDisplayMode ) {
804 case 0 : // 2D XY+ZR
805 fPadXY->cd();
806 fPadXY->Update();
807 fPadZR->Update();
808 break;
809 case 1 : // 2D XY
810 fPadXY->cd();
811 fPadXY->Update();
812 break;
813 case 2 : // 2D ZR
814 fPadZR->cd();
815 fPadZR->Update();
816 break;
817 case 3 : // 3D
818 fPad3D->cd();
819 fPad3D->Update();
820 break;
821 case 4 : // 2D+3D
822 fPad3D->cd();
823 fPad3D->Update();
824 break;
825 case 5: //Long Peixun's update: CGEM UF one layer
826 fPadCgemUF[fCgemUFViewLayer]->cd();
827 fPadCgemUF[fCgemUFViewLayer]->Update();
828 break;
829 case 6: //Long Peixun's update: CGEM UF three layers
830 fPadCgemUF[fCgemUFViewLayer]->cd();
831 fPadCgemUF[fCgemUFViewLayer]->Update();
832 break;
833 //Long Peixun's update: remove useless code
834 }
835}
836
838{
839 if (fDisplayMode == 0) {
840 if ((TPad*)gPad == fPadXY) fPadZR->cd();
841 else fPadXY->cd();
842 }
843
844 if (fDisplayMode == 4) {
845 if ((TPad*)gPad == fPadXY) fPadZR->cd();
846 else if ((TPad*)gPad == fPadZR) fPad3D->cd();
847 else fPadXY->cd();
848 }
849
850 //Long Peixun's update: CGEM UF view switch
851 if (fDisplayMode == 5)
852 {
853 if (fCgemUFViewLayer == 2) SetCurrentCgemLayer(0);
854 else SetCurrentCgemLayer(fCgemUFViewLayer + 1);
855 ResizePad();
856 }
857 if (fDisplayMode == 6)
858 {
859 if ((TPad*)gPad == fPadCgemUF[0])
860 {
861 fPadCgemUF[1]->cd();
863 }
864 else if ((TPad*)gPad == fPadCgemUF[1])
865 {
866 fPadCgemUF[2]->cd();
868 }
869 else
870 {
871 fPadCgemUF[0]->cd();
873 }
874 }
875
876 fCanvas->Update();
877}
878
879
880//_____________________________________________________________________________
882{
883// Display trigger parameters for current event
884 trig = 1;
885
886 if (trig) fEM1->SetFillColor(kGreen);
887 else fEM1->SetFillColor(kRed);
888 if (trig) fPH1->SetFillColor(kGreen);
889 else fPH1->SetFillColor(kRed);
890 if (trig) fEM2->SetFillColor(kGreen);
891 else fEM2->SetFillColor(kRed);
892 if (trig) fMU1->SetFillColor(kGreen);
893 else fMU1->SetFillColor(kRed);
894 if (trig) fMU2->SetFillColor(kGreen);
895 else fMU2->SetFillColor(kRed);
896 if (trig) fEMU->SetFillColor(kGreen);
897 else fEMU->SetFillColor(kRed);
898 if (trig) fJT1->SetFillColor(kGreen);
899 else fJT1->SetFillColor(kRed);
900 if (trig) fJT3->SetFillColor(kGreen);
901 else fJT3->SetFillColor(kRed);
902 if (trig) fJT4->SetFillColor(kGreen);
903 else fJT4->SetFillColor(kRed);
904 if (trig) fALL->SetFillColor(kGreen);
905 else fALL->SetFillColor(kRed);
906 fTrigPad->Modified();
907}
908
909//______________________________________________________________________________
910Int_t BesVisDisplay::DistancetoPrimitive(Int_t px, Int_t py)
911{
912// Compute distance from point px,py to objects in event
913
914 if (fBesHeader) return fBesHeader->DistancetoPrimitive(px, py)-10;
915 else return 9999;
916
917 if (gPad == fTrigPad) {
918 gPad->SetCursor(kCross);
919 return 0;
920 }
921
922 const Int_t big = 9999;
923 Int_t dist = big;
924 Float_t xmin = gPad->GetX1();
925 Float_t xmax = gPad->GetX2();
926 Float_t dx = 0.05*(xmax - xmin);
927 Float_t x = gPad->AbsPixeltoX(px);
928 if (x < xmin+dx || x > xmax-dx) return dist;
929
930 // scan list of particles
931 //dist = fParticle->DistancetoPrimitive(px, py);
932 //if (dist <= 0) return 0;
933
934 // scan list of fruits
935 /*
936 TIter nextf(fFruits);
937 BesVisFruit *fruit;
938 while((fruit=(BesVisFruit*)nextf())) {
939 dist = fruit->DistancetoPrimitive(px, py);
940 if (dist < 5) {
941 gPad->SetSelected(fruit->Fruit());
942 gPad->SetCursor(kCross);
943 return 0;
944 }
945 }
946 */
947
948 /*
949 // scan list of detectors (currently only one tube)
950 dist = fNodin->DistancetoPrimitive(px, py);
951 if (gPad->GetCanvas()->GetSelected() == gPad->GetView()) {
952 gPad->SetSelected(this);
953 }
954 */
955
956 return 0;
957}
958
959//_____________________________________________________________________________
960void BesVisDisplay::Draw(Option_t *)
961{
962// Insert current event in graphics pad list
963
964 //fPad->cd();
965
966 //fCanvas->Range(0,0,1,1);
967 Draw2D();
968 Draw3D();
969 DrawCgemUF();
971 //DrawView(fTheta, fPhi);
972 //fPad->x3d();
973 /*
974 TViewerX3D *x3dPad = new TViewerX3D(fPad);
975 x3dPad->CreateScene("x3d");
976 //x3dPad->SetForegroundColor(x3dPad->GetWhitePixel());
977 //x3dPad->SetBackgroundColor(x3dPad->GetWhitePixel());
978 x3dPad->Show();
979 */
980
981 // Display the event number and title
982 //fPad->cd();
983 //DrawTitle();
984}
985
986//_____________________________________________________________________________
987void BesVisDisplay::Draw2D(Option_t *)
988{
989 cout << "Create 2D View " << endl;
990 fPadXY->cd();
991 fPadXY->Clear();
992 Draw2DXY();
993 fPadXY->Update();
994
995 fPadZR->cd();
996 fPadZR->Clear();
997 Draw2DZR();
998 fPadZR->Update();
999
1000 //DrawTitle();
1001
1002 //fPad->SetEditable(kFALSE);
1003}
1004
1005//_____________________________________________________________________________
1007{
1008 cout << "enter BesVisDisplay::Draw3D()" << endl; // added by tianhl to debug shutdown
1009
1010 fPad3D->cd();
1011 fPad3D->Clear();
1012
1013 f3DView = new BesView();
1014 f3DView->View3D();
1015}
1016
1017//_____________________________________________________________________________
1019{
1020 fxyView = new BesView();
1021 fxyView->ViewXY();
1022}
1023
1024
1025//_____________________________________________________________________________
1027{
1028 fzrView = new BesView();
1029 fzrView->ViewZR();
1030}
1031
1032//_____________________________________________________________________________
1034{
1035// Draw front,top,side and 30 deg views
1036
1037 fDrawAllViews = kTRUE;
1038 fPad->cd();
1039 fPad->SetFillColor(15);
1040 fPad->Clear();
1041 fPad->Divide(2,2);
1042
1043 // draw 30 deg view
1044 fPad->cd(1);
1045 DrawView(30, 30);
1046 DrawTitle();
1047
1048 // draw front view
1049 fPad->cd(2);
1050 DrawView(0, 180); //0,-90, 0
1051 DrawTitle("Front");
1052
1053 // draw top view
1054 fPad->cd(3);
1055 DrawView(90, 90);
1056 DrawTitle("Top");
1057
1058 // draw side view
1059 fPad->cd(4);
1060 DrawView(90, 0);
1061 DrawTitle("Side");
1062
1063 fPad->cd(2);
1064}
1065
1066//_____________________________________________________________________________
1067//Long Peixun's update: for CGEM UF view
1068void BesVisDisplay::DrawCgemUF(Option_t *option)
1069{
1070 cout << "Create CGEM UF View " << endl;
1071 for (int l = 0; l < 3; ++l)
1072 {
1073 fPadCgemUF[l]->cd();
1074 fPadCgemUF[l]->Clear();
1075 DrawCgemUFLayer(l);
1076 fPadCgemUF[l]->Update();
1077 }
1078}
1079
1080//_____________________________________________________________________________
1081//Long Peixun's update: Construct each layer of CGEM UF view
1082void BesVisDisplay::DrawCgemUFLayer(int layer, Option_t *option)
1083{
1084 if (layer < 0 || layer > 2) return;
1085 fCgemUFView[layer] = new BesView();
1086 fCgemUFView[layer]->ViewCgemUF(layer);
1087}
1088
1089//_____________________________________________________________________________
1090void BesVisDisplay::DrawTitle(Option_t *option)
1091{
1092// Draw the event title
1093
1094 Float_t xmin = gPad->GetX1();
1095 Float_t xmax = gPad->GetX2();
1096 Float_t ymin = gPad->GetY1();
1097 Float_t ymax = gPad->GetY2();
1098 Float_t dx = xmax-xmin;
1099 Float_t dy = ymax-ymin;
1100 if (strlen(option) == 0) {
1101 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
1102 title->SetBit(kCanDelete);
1103 title->SetFillColor(42);
1104 title->Draw();
1105 char ptitle[100];
1106 //sprintf(ptitle,"Pythia event: %d, Run:%d",gBesVisast->Event(), gBesVisast->Run());
1107 //sprintf(ptitle,"Monte Carlo event: %d",gBesVisast->Event());
1108 sprintf(ptitle,"Monte Carlo event");
1109 title->AddText(ptitle);
1110 //sprintf(ptitle,"Pythia Mode: %s",gBesVisast->MCMaker()->GetTitle());
1111 //title->AddText(ptitle);
1112 } else {
1113 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
1114 label->SetBit(kCanDelete);
1115 label->SetFillColor(42);
1116 label->Draw();
1117 }
1118}
1119
1120//_____________________________________________________________________________
1122{
1123// Draw a view of ATLAS
1124
1125 //fPad3D->SetFillColor(10);
1126 // Display ATLAS outline
1127 gPad->Clear();
1128
1129 //TImage *i1 = TImage::Open("rose512.jpg");
1130 //i1->SetConstRatio(kFALSE);
1131 //gPad->cd();
1132 //i1->Draw();
1133
1134 Int_t iret;
1135 BesTView *view = new BesTView(1);
1136 view->SetRange(-0.5*fBesR, -0.5*fBesR, -0.5*fBesZ, 0.5*fBesR, 0.5*fBesR, 0.5*fBesZ);
1137 view->ZoomView(gPad, 1.2);
1138 view->AdjustPad(); //Long Peixun's update: Adjust Pad
1139
1140 //fNodin->Draw("same");
1141 //fBes->Draw("same");
1142 fBesGeometry->Draw("3D");
1143
1144 // add itself to the list
1145 //AppendPad();
1146
1147 //Loop on all makers to add their products to the pad
1148 /*
1149 TIter next(gBesVisast->Makers());
1150 BesVisMaker *maker;
1151 while ((maker = (BesVisMaker*)next())) {
1152 maker->Draw();
1153 }
1154 */
1155
1156 //view->SetView(phi, theta, 90, iret); //previous side view necessary
1157 view->SetView(phi, theta, 270, iret);
1158 //view->SetParralel(); //-----------liangyt
1159 view->SetParallel();
1160 //use SetParallel() instead of depreciated function TView::SetParralel()
1161 //changed by tianhl at Mon Aug 20 2007
1162 //view->SetPerspective();
1163 //view->ShowAxis();
1164
1165 //DrawViewRange(0, 0, 0, 2500);
1166}
1167
1168//_____________________________________________________________________________
1169void BesVisDisplay::DrawViewRange(Double_t x0, Double_t y0, Double_t z0,
1170 Double_t zoomSize)
1171{
1172// Draw a view of some place
1173
1174 gPad->GetView()->SetRange(x0 - 0.5*zoomSize, y0 - 0.5*zoomSize, z0 - 0.5*zoomSize,
1175 x0 + 0.5*zoomSize, y0 + 0.5*zoomSize, z0 + 0.5*zoomSize);
1176}
1177
1178//_____________________________________________________________________________
1180{
1181// Draw current view using OPENGL
1182
1183 TPad *pad = (TPad*)gPad->GetPadSave();
1184 pad->cd();
1185 TView *view = pad->GetView();
1186 if (!view) return;
1187 pad->x3d("OPENGL");//-----------liangyt
1188}
1189
1190//_____________________________________________________________________________
1192{
1193// Draw current view using X3D
1194
1195 TPad *pad = (TPad*)gPad->GetPadSave();
1196 pad->cd();
1197 TView *view = pad->GetView();
1198 if (!view) return;
1199 pad->x3d();//-----------liangyt
1200}
1201
1202//_____________________________________________________________________________
1204{
1205 //TCanvas *rayCanvas = new TCanvas("rayCanvas", "Raytracer Canvas", 10, 10, 800, 800);
1206 TCanvas *rayCanvas = new TCanvas("rayCanvas", "Raytracer Canvas", 10, 10, 800, 800);
1207 rayCanvas->cd();
1208
1209
1210 //TPad *rayPad = new TPad("rayPad", "Raytracer display",0.,0.,1,1);
1211 //rayPad->Draw();
1212 //rayPad->Modified();
1213 gPad->SetFillColor(1);
1214
1215 //rayPad->SetBorderSize(2);
1216 //rayPad->cd();
1217 //fMucGeo->GetVolMuc()->Draw();
1218 //fBes->Draw();
1219
1220 TView *view = gPad->GetView();
1221 //view->SetPerspective();
1222 int iret;
1223 view->ZoomView(gPad, 1.5);
1224 view->SetView(phi, theta, psi, iret);
1225 // |
1226 // \|/
1227
1228 //gGeoManager->GetGeomPainter()->SetBombFactors(2, 2, 2, 2);
1229 //gGeoManager->GetGeomPainter()->SetExplodedView(3);
1230
1231 gGeoManager->GetGeomPainter()->SetRaytracing(kTRUE);
1232
1233 rayCanvas->Modified();
1234 rayCanvas->Update();
1235 //rayPad->Modified();
1236 //rayPad->Update();
1237
1238 stringstream sPicCount;
1239 sPicCount << fRayPicCount << ".gif";
1240 string str = sPicCount.str();
1241
1242 gPad->SaveAs(str.c_str());
1243 fRayPicCount++;
1244}
1245
1247{
1248 TCanvas *x3dCanvas = new TCanvas("x3dCanvas", "X3dtracer Canvas", 10, 10, 800, 800);
1249 x3dCanvas->cd();
1250
1251 gPad->SetFillColor(1);
1252 //x3dPad->SetBorderSize(2);
1253 //x3dPad->cd();
1254
1255 //fBes->Draw("x3d");
1256
1257 //TView *view = gPad->GetView();
1258 //view->SetPerspective();
1259 //int iret;
1260 //view->ZoomView(gPad, 1.2);
1261 //view->SetView(30, 60, 270, iret);
1262
1263
1264 //gPad->x3d();//-----------liangyt
1265 gPad->GetViewer3D();
1266 //use TPad::GetViewer3D() instead of depreciated function TPad::x3d()
1267 //changed by tianhl at Mon Aug 20 2007
1268 //TViewerX3D *x3d = (TViewerX3D*)gPad->GetViewer3D();
1269
1270 //TViewerX3D *x3d = new TViewerX3D(x3dCanvas, "");
1271 //x3d->ExecCommand(0,0,option);
1272
1273 //for (Int_t i=0;i<500;i++) {
1274 //Int_t px = i%500;
1275 //Int_t py = (2*i)%200;
1276 //x3d->ExecCommand(px,py,0); //rotate
1277 //if (i%20 >10) x3d->ExecCommand(px,py,'j'); //zoom
1278 //if (i%20 <10) x3d->ExecCommand(px,py,'k'); //unzoom
1279 //}
1280
1281
1282 stringstream sPicCount;
1283 fRayPicCount = 0;
1284 sPicCount << fRayPicCount << ".gif";
1285 string str = sPicCount.str();
1286
1287 gPad->SaveAs(str.c_str());
1288 fRayPicCount++;
1289}
1290
1291void BesVisDisplay::DrawImageSequence(Int_t thetaStart, Int_t thetaStep)
1292{
1293 /*
1294 fRayPicCount = 0;
1295 //for(int i = thetaStart; i < thetaStart + 360; i += thetaStep) {
1296 //DrawViewRaytracer(i, 30, 270);
1297 //}
1298 for (int i = 0; i < fTofROOTGeo->GetScinNb(0); i++) {
1299 for (int j=0; j < 20; j++) {
1300 fTofROOTGeo->GetPhysicalScin(1, i*20+j)->SetVisibility(1);
1301 }
1302 DrawViewRaytracer(30, 30, 270);
1303 }
1304 */
1305}
1306
1307//______________________________________________________________________________
1308void BesVisDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
1309{
1310//*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
1311//*-* =========================================
1312
1313 if (gPad->GetView()) {
1314 gPad->GetView()->ExecuteRotateView(event, px, py);
1315 }
1316}
1317
1318//_____________________________________________________________________________
1319void BesVisDisplay::GetEvent(Long64_t event)
1320{
1321// Read event in memory
1322
1323 // gBesVisast->GetEvent(event);
1324
1325 //Draw();
1326
1327 //gGeoManager->ClearAttributes();
1332}
1333
1334//_____________________________________________________________________________
1335void BesVisDisplay::Paint(Option_t *)
1336{
1337// Paint miscellaneous items
1338
1339}
1340
1341//_____________________________________________________________________________
1342void BesVisDisplay::PaintFruit(TObject *obj, Float_t eta, Float_t phi, Float_t pt, Int_t type, Option_t *option)
1343{
1344 // Display fruit from obj
1345 /*
1346 if (fDrawClusters) {
1347 if (!fFruits) fFruits = new TList();
1348 BesVisFruit *fruit = new BesVisFruit(obj, eta, phi, pt, type);
1349 fFruits->Add(fruit);
1350 fruit->Paint(option);
1351 }
1352 */
1353}
1354
1355//_____________________________________________________________________________
1356void BesVisDisplay::PaintParticles(Option_t *option)
1357{
1358 //if (fDrawParticles) fParticle->Paint(option);
1359}
1360
1361//_____________________________________________________________________________
1363{
1364 fPTcut = ptcut;
1365
1366 if (fDrawAllViews) {
1367 fPad->cd(1);
1368 gPad->Modified();
1369 fPad->cd(2);
1370 gPad->Modified();
1371 fPad->cd(3);
1372 gPad->Modified();
1373 fPad->cd(4);
1374 gPad->Modified();
1375 fPad->cd();
1376 }
1377}
1378
1379//_____________________________________________________________________________
1381{
1382 fPTcutEGMUNU = ptcut;
1383
1384 if (fDrawAllViews) {
1385 fPad->cd(1);
1386 gPad->Modified();
1387 fPad->cd(2);
1388 gPad->Modified();
1389 fPad->cd(3);
1390 gPad->Modified();
1391 fPad->cd(4);
1392 gPad->Modified();
1393 fPad->cd();
1394 }
1395}
1396
1397//_____________________________________________________________________________
1399{
1400// change viewing angles for current event
1401
1402 fPad->cd();
1403 fDrawAllViews = kFALSE;
1404 fPhi = phi;
1405 fTheta = theta;
1406 Int_t iret;
1407
1408 TView *view = gPad->GetView();
1409 if (view) view->SetView(fPhi, fTheta, 0, iret);
1410 else Draw();
1411
1412 gPad->Modified();
1413}
1414
1415//_____________________________________________________________________________
1417{
1418// Display (current event_number+delta)
1419// delta = 1 shown next event
1420// delta = -1 show previous event
1421
1422 //fTheta += 10;
1423 //fPhi += 10;
1424 if (delta) {
1425 //gBesVisast->Clear();
1426 //Int_t current_event = gBesVisast->Event();
1427 //Int_t new_event = current_event + delta;
1428 //gBesVisast->GetEvent(new_event);
1429 //GetEvent(new_event);
1430 }
1431 fPad->cd();
1432 Draw();
1433}
1434
1435//_____________________________________________________________________________
1437{
1438 int layer[135] = {0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10,11,12,13,14,15,16,17,18,19,19,20,21,22,22,23,24,25,26,27,28,29,29,30,31,32,33,34,35,36,37,38,39,40,41,41,42,0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42};
1439 int replica[135] = {12 ,13 ,14 ,17 ,19 ,23 ,25 ,25 ,25 ,26 ,29 ,30 ,33 ,34 ,38 ,38 ,44 ,44 ,48 ,48 ,49 ,51 ,52 ,51 ,52 ,52 ,62 ,63 ,63 ,63 ,68 ,68 ,69 ,68 ,69 ,79 ,80 ,79 ,80 ,91 ,91 ,91 ,92 ,103,103,104,103,4 ,7 ,9 ,4 ,9 ,4 ,9 ,9 ,8 ,8 ,55 ,56 ,63 ,64 ,71 ,71 ,82 ,82 ,89 ,90 ,99 ,100,99 ,100,120,120,120,120,130,131,130,131,151,151,151,151,166,166,167,166,167,187,188,188,7 ,9 ,9 ,12 ,13 ,15 ,16 ,17 ,17 ,17 ,20 ,20 ,22 ,23 ,25 ,26 ,29 ,30 ,32 ,33 ,34 ,35 ,34 ,35 ,42 ,42 ,42 ,42 ,45 ,46 ,46 ,46 ,46 ,53 ,54 ,53 ,54 ,61 ,62 ,61 ,62 ,69 ,70 ,70};
1440
1441 for (int i = 0; i < 135; i++) {
1442 fMdcROOTGeo->GetPhysicalReplica(layer[i], replica[i])->SetVisibility(1);
1443 if (layer[i] > 35) fMdcROOTGeo->GetPhysicalReplica(layer[i]+7, replica[i])->SetVisibility(1);
1444 std::cout << layer[i] << " " << replica[i] << std::endl;
1445 }
1446}
1447
1448//_____________________________________________________________________________
1450{
1451 int part[7] = {1,1,1,2,2,1,1,};
1452 int scin[7] = {31,32,57,31,32,59,21};
1453
1454 std::cout << "set tof fired cell" << std::endl;
1455 for (int i = 0; i < 7; i++) {
1456 fTofROOTGeo->GetPhysicalScin(part[i], 0, scin[i])->SetVisibility(1);
1457 std::cout << part[i] << " " << scin[i] << std::endl;
1458 }
1459}
1460
1461//_____________________________________________________________________________
1463{
1464 int theta[26] = {3,3,2,9,9,8,5,7,6,10,10,7,8,9,9,9,37,2,7,7,4,4,5,5,15,15};
1465 int phi[26] = {45,46,46,80,81,80,83,81,81,81,80,80,81,82,83,84,17,84,77,78,79,80,80,79,31,32};
1466
1467 for (int i = 0; i < 26; i++) {
1468 fEmcROOTGeo->GetPhysicalCrystal(1, phi[i], theta[i])->SetVisibility(1);
1469 std::cout << "1" << " " << phi[i] << " " << theta[i] << std::endl;
1470 }
1471}
1472
1473//_____________________________________________________________________________
1475{
1476 vector<int> cellCon;
1477
1478 int part[11] = {1,1,1,1,1,1,1,1,1,1,1};
1479 int seg[11] = {6,6,2,2,2,2,2,2,2,2,2};
1480 int gap[11] = {0, 1, 0, 1, 2, 2, 3, 4, 5, 6, 7};
1481 int strip[11]= {2,20,20,29,21,22,27,25,25,30,22};
1482
1483 for (int i = 0; i < 11; i++) {
1484 fMucROOTGeo->GetPhysicalStrip(part[i], seg[i], gap[i], strip[i])->SetVisibility(1);
1485 std::cout << " " << part[i] << " " << seg[i] << " " << gap[i] << " " << strip[i] << std::endl;
1486 }
1487}
1488
1489//______________________________________________________________________________
1491{
1492 const Int_t npoints = 2;
1493 gSize3D.numPoints += npoints;
1494 gSize3D.numSegs += (npoints-1);
1495 gSize3D.numPolys += 0;
1496}
1497
1498//______________________________________________________________________________
1500{
1501 //if (fDrawParticles) fParticle->SizeParticles();
1502 //printf("numPoints=%d, numSegs=%d, numPolys=%d\n",gSize3D.numPoints,gSize3D.numSegs,gSize3D.numPolys);
1503}
1504
1505
1506//_____________________________________________________________________________
1507void BesVisDisplay::Clear(Option_t *)
1508{
1509// Delete graphics temporary objects
1510
1511}
1512
1513//_____________________________________________________________________________
1514//Long Peixun's update: Set visibility of header
1516{
1517 fVisHeader = val;
1518 ResizePad();
1519}
R__EXTERN BesEvent * gEvent
Definition: BesEvent.h:318
R__EXTERN BesGeometry * gBesGeometry
Definition: BesGeometry.h:118
BesVisDisplay * gDisplay
ClassImp(BesVisDisplay) BesVisDisplay
float Float_t
TTree * data
Double_t x[10]
Double_t time
Double_t GetEvTime()
vector< Int_t > & GetTrigChannelVector()
Int_t GetEvTimeStatus()
vector< Int_t > & GetTrigConditionVector()
Bool_t GetEventRec()
Int_t GetTimeType()
Double_t GetEvTimeQuality()
Int_t GetSec()
Definition: BesEvent.h:304
Int_t GetMin()
Definition: BesEvent.h:301
Int_t GetMonth()
Definition: BesEvent.h:292
Int_t GetMC()
Definition: BesEvent.h:307
Int_t GetDay()
Definition: BesEvent.h:295
Int_t GetHour()
Definition: BesEvent.h:298
Int_t GetYear()
Definition: BesEvent.h:289
BesEventHeader GetHeader()
Definition: BesEvent.h:310
Long64_t GetRun()
Definition: BesEvent.h:283
Long64_t GetEvent()
Definition: BesEvent.h:286
CgemROOTGeo * GetCgemROOTGeo()
Definition: BesGeometry.h:47
virtual void SetDefaultVis()
EmcROOTGeo * GetEmcROOTGeo()
Definition: BesGeometry.h:50
virtual void InitFromGDML(const TString fPath, bool mrpc=false, bool cgem=false)
Definition: BesGeometry.cxx:67
MdcROOTGeo * GetMdcROOTGeo()
Definition: BesGeometry.h:48
virtual void Draw(Option_t *option="3D")
virtual void InitFromROOT(TGeoVolume *volBes)
MucROOTGeo * GetMucROOTGeo()
Definition: BesGeometry.h:51
TofROOTGeo * GetTofROOTGeo()
Definition: BesGeometry.h:49
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Definition: BesHeader.cxx:42
virtual void SetBorderSize(Int_t bordersize=4)
Definition: BesHeader.h:53
virtual void Clear(Option_t *option="")
Definition: BesHeader.h:42
virtual void ZoomView(TVirtualPad *pad=0, Double_t zoomFactor=1.25)
Definition: BesTView.cxx:1778
virtual void SetRange(const Double_t *min, const Double_t *max)
Definition: BesTView.cxx:1454
static void AdjustPad(TVirtualPad *pad=0)
Definition: BesTView.cxx:1668
virtual void SetParallel()
Definition: BesTView.cxx:1433
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)
Definition: BesTView.cxx:1526
void ViewCgemUF(int layer)
Definition: BesView.h:82
void ViewXY()
Definition: BesView.h:79
void Refresh()
Definition: BesView.cxx:1015
void Reset()
Definition: BesView.cxx:990
void ViewZR()
Definition: BesView.h:80
void View3D()
Definition: BesView.h:78
virtual void SizeFruit() const
virtual void DrawViewRaytracer(Float_t theta, Float_t phi, Float_t psi)
void Draw3D(Option_t *option="")
virtual void SetMdcOn(Bool_t MdcOn)
virtual void PaintParticles(Option_t *option="")
virtual void Reset()
virtual void SetTofOn(Bool_t TofOn)
virtual void SetPTcut(Float_t ptcut=0.4)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual void SwitchPad()
void Draw2DZR(Option_t *option="")
void DrawCgemUFLayer(int layer, Option_t *option="")
void SetDisplayMode(Int_t mode)
virtual void SizeParticles() const
void SetCurrentCgemLayer(int layer)
virtual void DrawViewGL()
virtual void DrawView(Float_t theta, Float_t phi)
void DrawImageSequence(Int_t thetaStart, Int_t thetaStep)
virtual ~BesVisDisplay()
virtual void ResizePad()
virtual void SetPTcutEGMUNU(Float_t ptcut=5)
virtual void InitGeometryFromGDML(const TString fPath, bool mrpc=false, bool cgem=false)
virtual void Clear(Option_t *option="")
virtual void DrawHeader()
virtual void Draw(Option_t *option="")
virtual void InitGeometryFromROOT(TGeoVolume *bes)
virtual void Paint(Option_t *option="")
virtual void ShowNextEvent(Int_t delta=1)
virtual void DrawViewX3D()
virtual void DrawTitle(Option_t *option="")
virtual void Refresh()
virtual void SetVisHeader(Bool_t val)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual void SwitchDisplayMode(Int_t mode)
virtual void SetCanvas(TCanvas *c=0)
virtual void SetView(Float_t theta, Float_t phi)
virtual void DrawAllViews()
Bool_t IsVHeader()
void DrawViewRange(Double_t x0, Double_t y0, Double_t z0, Double_t zoomSize)
void DrawCgemUF(Option_t *option="")
virtual void SetEmcOn(Bool_t EmcOn)
virtual void GetEvent(Long64_t event)
void Draw2D(Option_t *option="")
virtual void DisplayTrigger(Int_t trig)
virtual void PaintFruit(TObject *obj, Float_t eta, Float_t phi, Float_t pt, Int_t type, Option_t *option="")
void Draw2DXY(Option_t *option="")
TGeoPhysicalNode * GetPhysicalCrystal(int part, int phi, int theta)
Get crystal physical node;.
TGeoPhysicalNode * GetPhysicalReplica(int layer, int replica)
Get replica physical node;.
TGeoPhysicalNode * GetPhysicalStrip(int part, int seg, int gap, int strip)
Get strip physical node;.
TGeoPhysicalNode * GetPhysicalScin(int part, int scin)
Get scintillator physical node;.
c1_1 Draw()