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