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