/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/EventDisplay/BesVisLib/BesVisLib-00-04-04/src/BesVisDisplay.cxx

Go to the documentation of this file.
00001 
00002 
00004 //                                                                      //
00005 // BesVisDisplay                                                          //
00006 //                                                                      //
00007 // Utility class to display ATLAS outline, tracks, clusters, jets,..    //
00008 //                                                                      //
00010 
00011 #include <iostream>
00012 #include <sstream>
00013 #include <TROOT.h>
00014 #include <TEnv.h>
00015 #include <TButton.h>
00016 #include <TCanvas.h>
00017 #include <TPad.h>
00018 #include <TColor.h>
00019 #include <TAttImage.h>
00020 #include <TView.h>
00021 #include <TArc.h>
00022 #include <TText.h>
00023 #include <TPaveLabel.h>
00024 #include <TPaveText.h>
00025 #include <TList.h>
00026 #include <TDiamond.h>
00027 #include <TNode.h>
00028 #include <TTUBE.h>
00029 #include <TMath.h>
00030 #include <X3DBuffer.h>
00031 #include <TVirtualGeoPainter.h>
00032 #include <TControlBar.h>
00033 #include <TImage.h>
00034 #include <TASImage.h>
00035 #include <TGeoManager.h>
00036 #include <TGeoMaterial.h>
00037 #include <TGeoMedium.h>
00038 #include <TGeoVolume.h>
00039 #include <TGeoMatrix.h>
00040 #include <TGeoBBox.h>
00041 #include <TGeoTube.h>
00042 #include <TGeoArb8.h>
00043 #include <TViewerX3D.h>
00044 
00045 #include "BesVisLib/BesPolygon2D.h"
00046 #include "BesVisLib/BesCircle2D.h"
00047 #include "BesVisLib/BesVisDisplay.h"
00048 #include "BesVisLib/BesEvent.h"
00049 #include "BesVisLib/BesTView.h"
00050 
00051 BesVisDisplay *gDisplay = 0;
00052 
00053 using namespace std;
00054 
00055 #ifndef __CINT__
00056 ClassImp(BesVisDisplay)
00057 #endif
00058 
00059 //_____________________________________________________________________________
00060 BesVisDisplay::BesVisDisplay() : TQObject()
00061 {
00062 
00063 }
00064 
00065 //_____________________________________________________________________________
00066 BesVisDisplay::BesVisDisplay(const char *title) : TQObject(),
00067         fBesGeometry(0),
00068         fMdcROOTGeo(0),
00069         fTofROOTGeo(0),
00070         fEmcROOTGeo(0),
00071         fMucROOTGeo(0),
00072         fMdcCon(0),
00073         fTofCon(0),
00074         fEmcCon(0),
00075         fMucCon(0),
00076         fAllVis(0),
00077         fQuarterVis(0),
00078         fHalfVis(0),
00079         fNoEndVis(0)
00080 {
00081 
00082 }
00083 
00084 //_____________________________________________________________________________
00085 BesVisDisplay::~BesVisDisplay()
00086 {
00087 
00088 }
00089 
00090 //_____________________________________________________________________________
00091 void BesVisDisplay::SetCanvas(TCanvas *c)
00092 {
00093     if (c != 0) {
00094         fCanvas = c;
00095     }
00096     else {
00097         fCanvas = new TCanvas("Canvas", " ",0,0,1024,768);
00098     }
00099 }
00100 
00101 void BesVisDisplay::Init()
00102 {
00103     fDisplayMode = 0;
00104     fCanvas->cd();
00105     //fCanvas->SetEditable(kFALSE);
00106     fCanvas->SetFillColor(10);
00107 
00108     // pad 3D
00109     fPad3D     = new TPad("Pad3D",     "Pad3D",     0.75, 0.75,  0.9, 0.9);
00110     fPad3D->SetFillColor(TColor::GetColor(204,204,204));
00111     fPad3D->SetFillColor(16);
00112     fPad3D->Draw();
00113 
00114     // pad Header
00115     fPadHeader = new TPad("PadHeader", "PadHeader", 0.0, 0.68, 1.0, 1.0);
00116     fPadHeader->Draw();
00117     fPadHeader->cd();
00118 
00119     TString fp = gEnv->GetValue("Root.TTFontPath", "");
00120     TString bc = fp + "/BlackChancery.ttf";
00121     TString ar = fp + "/arial.ttf";
00122 
00123     string besvisPath = getenv("BESVISLIBROOT");
00124     TString filePath(besvisPath);
00125     filePath += "/icons/";
00126 
00127     fHeaderHImage = TImage::Open(filePath + "HeaderH.gif");
00128     fHeaderHImage->SetEditable(kTRUE);
00129     //fHeaderHImage->Draw("same");
00130     fHeaderVImage = TImage::Open(filePath + "HeaderV.gif");
00131     fHeaderVImage->SetEditable(kTRUE);
00132     // fHeaderVImage->Draw("same");
00133     fHeaderImage = TImage::Open(filePath + "Header.gif");
00134     fHeaderImage->DrawText(620, 15, "BesVis", 30,
00135                            gROOT->GetColor(2)->AsHexString(),
00136                            bc, TImage::kShadeBelow);
00137     fHeaderImage->SetConstRatio(false);
00138     fHeaderImage->Draw("same");
00139 
00140     fBesHeader = new BesHeader(0,0,1,1, "br");
00141     fBesHeader->SetTextSize(0.1);
00142     fBesHeader->SetFillColor(28);
00143     fBesHeader->SetFillStyle(0);
00144     fBesHeader->SetBorderSize(4);
00145 
00146     fLatticeWidth=0.185;
00147     fTextSizeTitle=0.08;
00148     fTextSizeTime=0.07;
00149     fTextSizeData=0.05;
00150     fTextSizeFlt=0.02;
00151     fCoordx=0.01;
00152     fCoordy=0.8;
00153     fDistanceOfRows=0.01;
00154 
00155     fMdcOn = true;
00156     fTofOn = true;
00157     fEmcOn = true;
00158 
00159     Connect(fBesHeader,"TransferMdcOn(Bool_t)","BesVisDisplay",this,"SetMdcOn(Bool_t)");
00160     Connect(fBesHeader,"TransferTofOn(Bool_t)","BesVisDisplay",this,"SetTofOn(Bool_t)");
00161     Connect(fBesHeader,"TransferEmcOn(Bool_t)","BesVisDisplay",this,"SetEmcOn(Bool_t)");
00162 
00163     DrawHeader();
00164 
00165     // pad XY
00166     fPadXY     = new TPad("PadXY",     "PadXY",     0.0,  0.0,   0.5, 0.68);
00167     fPadXY->Draw();
00168 
00169     // pad ZR
00170     fPadZR     = new TPad("PadZR",     "PadZR",     0.5,  0.0,   1.0, 0.68);
00171     fPadZR->Draw();
00172 
00173     /*
00174     fPad3D->SetBorderMode(0);
00175     fPad3D->SetBorderSize(3);
00176     fPadHeader->SetBorderMode(1);
00177     fPadHeader->SetBorderSize(3);
00178     fPadXY->SetBorderMode(2);
00179     fPadXY->SetBorderSize(3);
00180     fPadZR->SetBorderMode(3);
00181     fPadZR->SetBorderSize(3);
00182     */
00183 }
00184 
00185 //_____________________________________________________________________________
00186 void BesVisDisplay::Reset()
00187 {
00188     if (fPadXY) {
00189         fPadXY->cd();
00190         ((BesView*)fPadXY->GetView())->Reset();
00191     }
00192     if (fPadZR) {
00193         fPadZR->cd();
00194         ((BesView*)fPadZR->GetView())->Reset();
00195     }
00196     if (fPad3D) {
00197         fPad3D->cd();
00198         ((BesView*)fPad3D->GetView())->Reset();
00199     }
00200 
00201     SwitchDisplayMode(fDisplayMode);
00202 }
00203 
00204 //_____________________________________________________________________________
00205 
00206 void BesVisDisplay::InitGeometryFromGDML(const TString fPath)
00207 {
00208     if ( gBesGeometry ) delete gBesGeometry;
00209     fBesGeometry = new BesGeometry();
00210     gBesGeometry = fBesGeometry;
00211     fBesGeometry->InitFromGDML(fPath);
00212     fBesGeometry->SetDefaultVis();
00213 
00214     // should be deleted after BesView completed;
00215     fMdcROOTGeo = fBesGeometry->GetMdcROOTGeo();   //here liang
00216     fTofROOTGeo = fBesGeometry->GetTofROOTGeo();   //here liang
00217     fEmcROOTGeo = fBesGeometry->GetEmcROOTGeo();   //here liang
00218     fMucROOTGeo = fBesGeometry->GetMucROOTGeo();
00219 }
00220 
00221 //_____________________________________________________________________________
00222 
00223 void BesVisDisplay::InitGeometryFromROOT(TGeoVolume *volBes)
00224 {
00225     if ( gBesGeometry ) delete gBesGeometry;
00226     fBesGeometry = new BesGeometry();
00227     gBesGeometry = fBesGeometry;
00228     fBesGeometry->InitFromROOT(volBes);
00229 
00230     // should be deleted after BesView completed;
00231     fMdcROOTGeo = fBesGeometry->GetMdcROOTGeo();
00232     fTofROOTGeo = fBesGeometry->GetTofROOTGeo();
00233     fEmcROOTGeo = fBesGeometry->GetEmcROOTGeo();
00234     fMucROOTGeo = fBesGeometry->GetMucROOTGeo();
00235 }
00236 
00237 void BesVisDisplay::DrawHeader()
00238 {
00239     fPadHeader->cd();
00240     //fPadHeader->Clear();
00241 
00242     //TASImage asImage("HeaderH2.gif");
00243     //Pixmap_t pic = asImage.GetPixmap();
00244 
00245     //cout << "mode " << fDisplayMode << endl;
00246     // draw text over image with funny font
00247     if (fDisplayMode == 0 || fDisplayMode == 4) {
00248         fHeaderImage->Zoom(161, 649, 635, 174);  // (x Offset, y Offset, width, height)
00249         //fHeaderImage->Scale(800, 200);
00250     }
00251     else {
00252         fHeaderImage->Zoom(600, 324, 164, 473);
00253         //fHeaderImage->Scale(200, 600);
00254     }
00255 
00256     // draw text over image with foreground specified by pixmap
00257     //img->DrawText(250, 350, "goodbye cruel world ...", 24, 0, ar, TImage::kPlain, "fore.xpm");
00258 
00259     fBesHeader->Clear();
00260     //fBesHeader->AddText("Commented");
00261 
00262     if (!gEvent) {
00263         fBesHeader->AddText("No Event Info");
00264     }
00265     else {
00266         // old coordinates
00267         Double_t coordx=fCoordx;
00268         Double_t coordy=fCoordy;
00269 
00270         // Get data
00271         Long64_t runno   = gEvent->GetRun();
00272         Long64_t eventno = gEvent->GetEvent();
00273         Int_t year    = gEvent->GetYear();
00274         Int_t month   = gEvent->GetMonth();
00275         Int_t day     = gEvent->GetDay();
00276         Int_t hour    = gEvent->GetHour();
00277         Int_t min     = gEvent->GetMin();
00278         Int_t sec     = gEvent->GetSec();
00279 
00280         // Add title
00281         if (IsVHeader()) {
00282           coordx = 0.1;
00283           coordy = 0.90;
00284         }
00285         else             {
00286             coordx = 0.02;
00287             coordy = 0.9;
00288         }
00289         char title1[20];
00290         sprintf(title1, "Run %ld ",  runno);
00291         TText* ttitle1 = fBesHeader->AddText(coordx,coordy,title1);
00292         ttitle1->SetTextSize(fTextSizeTitle);
00293         ttitle1->SetTextColor(1);
00294         ttitle1->SetTextAlign(12);
00295 
00296         if (IsVHeader()) {
00297             coordx = 0.1;
00298             coordy = 0.86;
00299         }
00300         else             {
00301             coordx = 0.02;
00302             coordy = 0.82;
00303         }
00304         char title2[20];
00305         sprintf(title2, "Event %ld ",  eventno);
00306         TText* ttitle2 = fBesHeader->AddText(coordx,coordy,title2);
00307         ttitle2->SetTextSize(fTextSizeTitle);
00308         ttitle2->SetTextColor(1);
00309         ttitle2->SetTextAlign(12);
00310 
00311         // Add date
00312         if (IsVHeader()) {
00313             coordx = 0.1;
00314             coordy = 0.83;
00315         }
00316         else {
00317             coordx = 0.02;
00318             coordy = 0.72;
00319         }
00320 
00321         char titleEvTime[30];
00322         if(fabs(gEvent->GetHeader().GetEvTime())>0.0001){
00323             double esTimeConst = 230;// sub in T0 of each layer in MDC calibration
00324             sprintf(titleEvTime, "Estime:%5.1fns", gEvent->GetHeader().GetEvTime()-esTimeConst);
00325         }else{
00326             sprintf(titleEvTime, "Estime:0 ns");
00327         }
00328         TText* ttitleEvTime = fBesHeader->AddText(coordx,coordy,titleEvTime);
00329         ttitleEvTime->SetTextSize(fTextSizeTime);
00330         ttitleEvTime->SetTextFont(52);
00331         ttitleEvTime->SetTextColor(1);
00332         ttitleEvTime->SetTextAlign(12);
00333 
00334         // Add date
00335         if (IsVHeader()) {
00336             coordx = 0.1;
00337             coordy = 0.81;
00338         }
00339         else {
00340             coordx = 0.2;
00341             coordy = 0.72;
00342         }
00343 
00344         char titleEvTimeStat[30];
00345         sprintf(titleEvTimeStat, "    stat:%3d", gEvent->GetHeader().GetEvTimeStatus());
00346         TText* ttitleEvTimeStat = fBesHeader->AddText(coordx,coordy,titleEvTimeStat);
00347         ttitleEvTimeStat->SetTextSize(fTextSizeTime);
00348         ttitleEvTimeStat->SetTextFont(52);
00349         ttitleEvTimeStat->SetTextColor(1);
00350         ttitleEvTimeStat->SetTextAlign(12);
00351 
00352         // Add date
00353         if (IsVHeader()) {
00354             coordx = 0.1;
00355             coordy = 0.79;
00356         }
00357         else {
00358             coordx = 0.4;
00359             coordy = 0.72;
00360         }
00361 
00362         char titleEvTimeQ[30];
00363         sprintf(titleEvTimeQ, "  quality:%3.1f", gEvent->GetHeader().GetEvTimeQuality());
00364         TText* ttitleEvTimeQ = fBesHeader->AddText(coordx,coordy,titleEvTimeQ);
00365         ttitleEvTimeQ->SetTextSize(fTextSizeTime);
00366         ttitleEvTimeQ->SetTextFont(52);
00367         ttitleEvTimeQ->SetTextColor(1);
00368         ttitleEvTimeQ->SetTextAlign(12);
00369 
00370         // Add date
00371         if (IsVHeader()) {
00372             coordx = 0.1;
00373             coordy = 0.76;
00374         }
00375         else {
00376             coordx = 0.02;
00377             coordy = 0.60;
00378         }
00379 
00380         char date[70];
00381         sprintf(date,"date: %4d-%02d-%02d ", year,month,day);
00382         TText* tdate = fBesHeader->AddText(coordx,coordy,date);
00383         tdate->SetTextSize(fTextSizeTime);
00384         tdate->SetTextFont(52);
00385         tdate->SetTextColor(1);
00386         tdate->SetTextAlign(12);
00387 
00388         // Add time
00389         if (IsVHeader()) {
00390             coordx = 0.1;
00391             coordy = 0.74;
00392         }
00393         else {
00394             coordx = 0.25;
00395             coordy = 0.60;
00396         }
00397         char time[70];
00398         sprintf(time,"time: %02d:%02d:%02d", hour,min,sec);
00399         TText* ttime=fBesHeader->AddText(coordx,coordy,time);
00400         ttime->SetTextSize(fTextSizeTime);
00401         ttime->SetTextFont(52);
00402         ttime->SetTextColor(1);
00403         ttime->SetTextAlign(12);
00404 
00405         // string for contents
00406         TString info;
00407         vector<TString> statusCon;
00408 
00409         char data[25];
00410         if (gEvent->GetMC()) sprintf(data, "MC=Yes");
00411         else                 sprintf(data, "MC=No");
00412         statusCon.push_back(TString(data));
00413 
00414         vector<Int_t> trigChannelVector = gEvent->GetHeader().GetTrigChannelVector();
00415         vector<Int_t> trigConditionVector = gEvent->GetHeader().GetTrigConditionVector();
00416         Int_t timeType = gEvent->GetHeader().GetTimeType();
00417         //************************************
00418         sprintf(data, "Time Type: %d", timeType);
00419         statusCon.push_back(TString(data));
00420         if (IsVHeader()) {
00421             coordx = 0.10;
00422             coordy = 0.71;
00423         }
00424         else             {
00425             coordx = 0.02;
00426             coordy = 0.50;
00427         }
00428         for (Int_t i = 0; i < (Int_t)statusCon.size(); i++) {
00429           TText* ttitle=fBesHeader->AddText(coordx,coordy,statusCon[i].Data());
00430           if (IsVHeader()) coordy -= 0.02 ;
00431           else coordx += 0.2;
00432           ttitle->SetTextSize(fTextSizeData);
00433           ttitle->SetTextFont(62);
00434           ttitle->SetTextColor(1);
00435           ttitle->SetTextAlign(12);
00436         }
00437         vector<TString> infoCon;
00438         //cout << "BesVisDisplay::time Type: " << timeType << endl;
00439         vector<Int_t>::iterator pTrigVector;
00440         for (pTrigVector = trigConditionVector.begin(); 
00441             pTrigVector != trigConditionVector.end(); 
00442             pTrigVector++){
00443           //cout << "BesVisDisplay::trigCondition: " << *pTrigVector << endl;
00444         }
00445         //for (pTrigVector = trigChannelVector.begin(); 
00446         //    pTrigVector != trigChannelVector.end(); 
00447         //    pTrigVector++){
00448           //sprintf(data, "Trig Channel_00");
00449           //infoCon.push_back(TString(data));
00450           //sprintf(data, "Trig Channel_01");
00451           //infoCon.push_back(TString(data));
00452           //sprintf(data, "Trig Channel_02");
00453           //infoCon.push_back(TString(data));
00454           //sprintf(data, "Trig Channel_03");
00455           //infoCon.push_back(TString(data));
00456           //sprintf(data, "Trig Channel_04");
00457           //infoCon.push_back(TString(data));
00458           //sprintf(data, "Trig Channel_05");
00459           //infoCon.push_back(TString(data));
00460           //sprintf(data, "Trig Channel_06");
00461           //infoCon.push_back(TString(data));
00462           //sprintf(data, "Trig Channel_07");
00463           //infoCon.push_back(TString(data));
00464           //sprintf(data, "Trig Channel_08");
00465           //infoCon.push_back(TString(data));
00466           //sprintf(data, "Trig Channel_09");
00467           //infoCon.push_back(TString(data));
00468           //sprintf(data, "Trig Channel_10");
00469           //infoCon.push_back(TString(data));
00470           //sprintf(data, "Trig Channel_11");
00471           //infoCon.push_back(TString(data));
00472           //sprintf(data, "Trig Channel_12");
00473           //infoCon.push_back(TString(data));
00474           //sprintf(data, "Trig Channel_13");
00475           //infoCon.push_back(TString(data));
00476           //sprintf(data, "Trig Channel_14");
00477           //infoCon.push_back(TString(data));
00478           //sprintf(data, "Trig Channel_15");
00479           //infoCon.push_back(TString(data));
00480           //cout << "BesVisDisplay::trigChannel: " << *pTrigVector << endl;
00481         //}
00482         //************************************
00483 
00484         //if (GetMdcOn()) {
00485         //    //Float_t p  = gEvent->GetHeader().GetP();
00486         //    //Float_t pt = gEvent->GetHeader().GetPt();
00487         //    //Float_t px = gEvent->GetHeader().GetPx();
00488         //    //Float_t py = gEvent->GetHeader().GetPy();
00489         //    //Float_t pz = gEvent->GetHeader().GetPz();
00490 
00491         //    //sprintf(data, "P= %-.3fGeV", p);
00492         //    //infoCon.push_back(TString(data));
00493         //    //sprintf(data, "Pt= %-.3fGeV", pt);
00494         //    //infoCon.push_back(TString(data));
00495         //    //sprintf(data, "Px= %-.3fGeV", px);
00496         //    //infoCon.push_back(TString(data));
00497         //    //sprintf(data, "Py= %-.3fGeV", py);
00498         //    //infoCon.push_back(TString(data));
00499         //    //sprintf(data, "Pz= %-.3fGeV", pz);
00500         //    //infoCon.push_back(TString(data));
00501         //}
00502 
00503         //if (GetTofOn()) {
00504         //    Float_t t  = gEvent->GetHeader().GetT();
00505 
00506         //    sprintf(data, "tofMin= %-.3fns", t);
00507         //    infoCon.push_back(TString(data));
00508         //}
00509 
00510         //if (GetEmcOn()) {
00511         //    Float_t e  = gEvent->GetHeader().GetE();
00512 
00513         //    sprintf(data, "ECal= %-.3fGeV", e);
00514         //    infoCon.push_back(TString(data));
00515         //}
00516 
00527 
00542         Int_t npr;
00543         Float_t rowH;
00544         Float_t textSize = fTextSizeData;
00545         if (IsVHeader()) {
00546             fCoordx = 0.10;
00547             fCoordy = 0.70;
00548             npr = 1;
00549             rowH = 0.04;
00550             textSize *= 1.2;
00551         }
00552         else             {
00553             fCoordx = 0.02;
00554             fCoordy = 0.50;
00555             npr = 4;
00556             rowH = 0.1;
00557         }
00558 
00559         pTrigVector = trigChannelVector.begin(); 
00560         for (Int_t i = 0; i < (Int_t)infoCon.size(); i++) {
00561             coordx = fCoordx + (i%npr)*(1.0/npr);
00562             coordy = fCoordy - (i/npr)*rowH;
00563 
00564             if (*pTrigVector == i){
00565               TString temp = infoCon[i] + " ON";
00566               TText* tdata=fBesHeader->AddText(coordx,coordy,temp.Data());
00567               tdata->SetTextSize(textSize);
00568               tdata->SetTextFont(62);
00569               tdata->SetTextColor(2);
00570               tdata->SetTextAlign(12);
00571               pTrigVector++;
00572             }
00573             else {
00574               TString temp = infoCon[i] + " OFF";
00575               TText* tdata=fBesHeader->AddText(coordx,coordy,temp.Data());
00576               tdata->SetTextSize(textSize);
00577               tdata->SetTextFont(62);
00578               tdata->SetTextColor(1);
00579               tdata->SetTextAlign(12);
00580             }
00581         }
00582 
00583     }
00584 
00585     fBesHeader->Draw("same");
00586 
00587     fPadHeader->SetEditable(kFALSE);
00588     fPadHeader->Modified();
00589     fPadHeader->Update();
00590     fCanvas->cd();
00591 }
00592 
00593 //_____________________________________________________________________________
00594 
00595 void BesVisDisplay::SetMdcOn(Bool_t MdcOn)
00596 {
00597     fMdcOn = MdcOn;
00598     //fBesHeader->SetMdcOn(MdcOn);
00599     DrawHeader();
00600 }
00601 
00602 //_____________________________________________________________________________
00603 
00604 void BesVisDisplay::SetTofOn(Bool_t TofOn)
00605 {
00606     fTofOn = TofOn;
00607     //fBesHeader->SetTofOn(TofOn);
00608     DrawHeader();
00609 }
00610 
00611 //_____________________________________________________________________________
00612 
00613 void BesVisDisplay::SetEmcOn(Bool_t EmcOn)
00614 {
00615     fEmcOn = EmcOn;
00616     //fBesHeader->SetEmcOn(EmcOn);
00617     DrawHeader();
00618 }
00619 
00620 //_____________________________________________________________________________
00621 
00622 void BesVisDisplay::SwitchDisplayMode(Int_t mode)
00623 {
00624     SetDisplayMode(mode);
00625     ResizePad();
00626     fCanvas->Update();
00627 }
00628 
00629 //_____________________________________________________________________________
00630 void BesVisDisplay::ResizePad()
00631 {
00632     fCanvas->cd();
00633     Double_t xlowH = -0.11, xupH = -0.1, ylowH = -0.11, yupH = -0.1;
00634     Int_t width  = fCanvas->GetWw();
00635     Int_t height = fCanvas->GetWh();
00636     Double_t hVSw = Double_t(height)/width;
00637     Double_t x2D = 1.0-hVSw;
00638     //cout << "Canvas width " << width << " height " << height << " x2D " << x2D << endl;
00639     Double_t y2D = 0.5/hVSw;
00640     Double_t x3D = (1.0/3)/hVSw;
00641 
00642     switch ( fDisplayMode ) {
00643     case 0 : // 2D XY+ZR
00644         fPadHeader->SetPad(0.0,  y2D,  1.0,  1.0);
00645         fPadXY    ->SetPad(0.0,  0.0,  0.5,  y2D);
00646         fPadZR    ->SetPad(0.5,  0.0,  1.0,  y2D);
00647         fPad3D    ->SetPad(xlowH, ylowH, xupH, yupH);
00648         break;
00649     case 1 : // 2D XY
00650         fPadHeader->SetPad(0.0, 0.0,  x2D, 1.0);
00651         fPadXY    ->SetPad(x2D, 0.0,  1.0, 1.0);
00652         fPadZR    ->SetPad(xlowH, ylowH, xupH, yupH);
00653         fPad3D    ->SetPad(xlowH, ylowH, xupH, yupH);
00654         break;
00655     case 2 : // 2D ZR
00656         fPadHeader->SetPad(0.0, 0.0,  x2D, 1.0);
00657         fPadXY    ->SetPad(xlowH, ylowH, xupH, yupH);
00658         fPadZR    ->SetPad(x2D, 0.0,  1.0,  1.0);
00659         fPad3D    ->SetPad(xlowH, ylowH, xupH, yupH);
00660         break;
00661     case 3 : // 3D
00662         fPadHeader->SetPad(0.0, 0.0,  x2D, 1.0);
00663         fPadXY    ->SetPad(xlowH, ylowH, xupH, yupH);
00664         fPadZR    ->SetPad(xlowH, ylowH, xupH, yupH);
00665         fPad3D    ->SetPad(x2D, 0.0,  1.0,  1.0);
00666         break;
00667     case 4 : // 2D+3D
00668         //fPadHeader->SetPad(xlowH, ylowH, xupH, yupH);
00669         fPadHeader->SetPad(0.0,   2*x3D, 1.0,  1.0);
00670         fPadXY    ->SetPad(0.0,   x3D,   1.0/3, 2*x3D);
00671         fPadZR    ->SetPad(0.0,   0.0,   1.0/3, x3D);
00672         fPad3D    ->SetPad(1.0/3, 0.0,   1.0,   2*x3D);
00673         break;
00674     default :
00675         return;
00676     }
00677 
00678     //fPadHeader->Update();
00679     DrawHeader();
00680 
00681     switch ( fDisplayMode ) {
00682     case 0 : // 2D XY+ZR
00683         fPadXY->cd();
00684         fPadXY->Update();
00685         fPadZR->Update();
00686         break;
00687     case 1 : // 2D XY
00688         fPadXY->cd();
00689         fPadXY->Update();
00690         break;
00691     case 2 : // 2D ZR
00692         fPadZR->cd();
00693         fPadZR->Update();
00694         break;
00695     case 3 : // 3D
00696         fPad3D->cd();
00697         fPad3D->Update();
00698         break;
00699     case 4 : // 2D+3D
00700         fPad3D->cd();
00701         fPad3D->Update();
00702         break;
00703     default :
00704         return;
00705     }
00706 }
00707 
00708 void BesVisDisplay::SwitchPad()
00709 {
00710     if (fDisplayMode == 0) {
00711         if ((TPad*)gPad == fPadXY) fPadZR->cd();
00712         else fPadXY->cd();
00713     }
00714 
00715     if (fDisplayMode == 4) {
00716         if ((TPad*)gPad == fPadXY) fPadZR->cd();
00717         else if ((TPad*)gPad == fPadZR) fPad3D->cd();
00718         else fPadXY->cd();
00719     }
00720 
00721     fCanvas->Update();
00722 }
00723 
00724 
00725 //_____________________________________________________________________________
00726 void BesVisDisplay::DisplayTrigger(Int_t trig)
00727 {
00728 //    Display trigger parameters for current event
00729     trig = 1;
00730 
00731     if (trig) fEM1->SetFillColor(kGreen);
00732     else fEM1->SetFillColor(kRed);
00733     if (trig) fPH1->SetFillColor(kGreen);
00734     else fPH1->SetFillColor(kRed);
00735     if (trig) fEM2->SetFillColor(kGreen);
00736     else fEM2->SetFillColor(kRed);
00737     if (trig) fMU1->SetFillColor(kGreen);
00738     else fMU1->SetFillColor(kRed);
00739     if (trig) fMU2->SetFillColor(kGreen);
00740     else fMU2->SetFillColor(kRed);
00741     if (trig) fEMU->SetFillColor(kGreen);
00742     else fEMU->SetFillColor(kRed);
00743     if (trig) fJT1->SetFillColor(kGreen);
00744     else fJT1->SetFillColor(kRed);
00745     if (trig) fJT3->SetFillColor(kGreen);
00746     else fJT3->SetFillColor(kRed);
00747     if (trig) fJT4->SetFillColor(kGreen);
00748     else fJT4->SetFillColor(kRed);
00749     if (trig) fALL->SetFillColor(kGreen);
00750     else fALL->SetFillColor(kRed);
00751     fTrigPad->Modified();
00752 }
00753 
00754 //______________________________________________________________________________
00755 Int_t BesVisDisplay::DistancetoPrimitive(Int_t px, Int_t py)
00756 {
00757 // Compute distance from point px,py to objects in event
00758 
00759     if (fBesHeader) return fBesHeader->DistancetoPrimitive(px, py)-10;
00760     else return 9999;
00761 
00762     if (gPad == fTrigPad) {
00763         gPad->SetCursor(kCross);
00764         return 0;
00765     }
00766 
00767     const Int_t big = 9999;
00768     Int_t dist = big;
00769     Float_t xmin = gPad->GetX1();
00770     Float_t xmax = gPad->GetX2();
00771     Float_t dx   = 0.05*(xmax - xmin);
00772     Float_t x    = gPad->AbsPixeltoX(px);
00773     if (x < xmin+dx || x > xmax-dx) return dist;
00774 
00775     // scan list of particles
00776     //dist = fParticle->DistancetoPrimitive(px, py);
00777     //if (dist <= 0) return 0;
00778 
00779     // scan list of fruits
00780     /*
00781       TIter nextf(fFruits);
00782     BesVisFruit *fruit;
00783     while((fruit=(BesVisFruit*)nextf())) {
00784        dist = fruit->DistancetoPrimitive(px, py);
00785        if (dist < 5) {
00786           gPad->SetSelected(fruit->Fruit());
00787           gPad->SetCursor(kCross);
00788           return 0;
00789        }
00790     }
00791     */
00792 
00793     /*
00794     // scan list of detectors (currently only one tube)
00795     dist = fNodin->DistancetoPrimitive(px, py);
00796     if (gPad->GetCanvas()->GetSelected() == gPad->GetView()) {
00797        gPad->SetSelected(this);
00798     }
00799     */
00800 
00801     return 0;
00802 }
00803 
00804 //_____________________________________________________________________________
00805 void BesVisDisplay::Draw(Option_t *)
00806 {
00807 //    Insert current event in graphics pad list
00808 
00809     //fPad->cd();
00810 
00811     //fCanvas->Range(0,0,1,1);
00812     Draw2D();
00813     Draw3D();
00814     SwitchDisplayMode(0);
00815     //DrawView(fTheta, fPhi);
00816     //fPad->x3d();
00817     /*
00818     TViewerX3D *x3dPad = new TViewerX3D(fPad);
00819     x3dPad->CreateScene("x3d");
00820     //x3dPad->SetForegroundColor(x3dPad->GetWhitePixel());
00821     //x3dPad->SetBackgroundColor(x3dPad->GetWhitePixel());
00822     x3dPad->Show();
00823     */
00824 
00825     // Display the event number and title
00826     //fPad->cd();
00827     //DrawTitle();
00828 }
00829 
00830 //_____________________________________________________________________________
00831 void BesVisDisplay::Draw2D(Option_t *)
00832 {
00833     cout << "Create 2D View " << endl;
00834     fPadXY->cd();
00835     fPadXY->Clear();
00836     Draw2DXY();
00837     fPadXY->Update();
00838 
00839     fPadZR->cd();
00840     fPadZR->Clear();
00841     Draw2DZR();
00842     fPadZR->Update();
00843 
00844     //DrawTitle();
00845 
00846     //fPad->SetEditable(kFALSE);
00847 }
00848 
00849 //_____________________________________________________________________________
00850 void BesVisDisplay::Draw3D(Option_t *)
00851 {
00852     cout << "enter BesVisDisplay::Draw3D()" << endl; // added by tianhl to debug shutdown
00853 
00854     fPad3D->cd();
00855     fPad3D->Clear();
00856 
00857     f3DView = new BesView();
00858     f3DView->View3D();
00859 }
00860 
00861 //_____________________________________________________________________________
00862 void BesVisDisplay::Draw2DXY(Option_t *)
00863 {
00864     fxyView = new BesView();
00865     fxyView->ViewXY();
00866 }
00867 
00868 
00869 //_____________________________________________________________________________
00870 void BesVisDisplay::Draw2DZR(Option_t *)
00871 {
00872     fzrView = new BesView();
00873     fzrView->ViewZR();
00874 }
00875 
00876 //_____________________________________________________________________________
00877 void BesVisDisplay::DrawAllViews()
00878 {
00879 //    Draw front,top,side and 30 deg views
00880 
00881     fDrawAllViews = kTRUE;
00882     fPad->cd();
00883     fPad->SetFillColor(15);
00884     fPad->Clear();
00885     fPad->Divide(2,2);
00886 
00887     // draw 30 deg view
00888     fPad->cd(1);
00889     DrawView(30, 30);
00890     DrawTitle();
00891 
00892     // draw front view
00893     fPad->cd(2);
00894     DrawView(0, 180); //0,-90, 0
00895     DrawTitle("Front");
00896 
00897     // draw top view
00898     fPad->cd(3);
00899     DrawView(90, 90);
00900     DrawTitle("Top");
00901 
00902     // draw side view
00903     fPad->cd(4);
00904     DrawView(90, 0);
00905     DrawTitle("Side");
00906 
00907     fPad->cd(2);
00908 }
00909 
00910 //_____________________________________________________________________________
00911 void BesVisDisplay::DrawTitle(Option_t *option)
00912 {
00913 //    Draw the event title
00914 
00915     Float_t xmin = gPad->GetX1();
00916     Float_t xmax = gPad->GetX2();
00917     Float_t ymin = gPad->GetY1();
00918     Float_t ymax = gPad->GetY2();
00919     Float_t dx   = xmax-xmin;
00920     Float_t dy   = ymax-ymin;
00921     if (strlen(option) == 0) {
00922         TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
00923         title->SetBit(kCanDelete);
00924         title->SetFillColor(42);
00925         title->Draw();
00926         char ptitle[100];
00927         //sprintf(ptitle,"Pythia event: %d, Run:%d",gBesVisast->Event(), gBesVisast->Run());
00928         //sprintf(ptitle,"Monte Carlo event: %d",gBesVisast->Event());
00929         sprintf(ptitle,"Monte Carlo event");
00930         title->AddText(ptitle);
00931         //sprintf(ptitle,"Pythia Mode: %s",gBesVisast->MCMaker()->GetTitle());
00932         //title->AddText(ptitle);
00933     } else {
00934         TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
00935         label->SetBit(kCanDelete);
00936         label->SetFillColor(42);
00937         label->Draw();
00938     }
00939 }
00940 
00941 //_____________________________________________________________________________
00942 void BesVisDisplay::DrawView(Float_t theta, Float_t phi)
00943 {
00944 //    Draw a view of ATLAS
00945 
00946     //fPad3D->SetFillColor(10);
00947     // Display ATLAS outline
00948     gPad->Clear();
00949 
00950     //TImage *i1 = TImage::Open("rose512.jpg");
00951     //i1->SetConstRatio(kFALSE);
00952     //gPad->cd();
00953     //i1->Draw();
00954 
00955     Int_t iret;
00956     BesTView *view = new BesTView(1);
00957     view->SetRange(-0.5*fBesR, -0.5*fBesR, -0.5*fBesZ, 0.5*fBesR, 0.5*fBesR, 0.5*fBesZ);
00958     view->ZoomView(gPad, 1.2);
00959 
00960     //fNodin->Draw("same");
00961     //fBes->Draw("same");
00962     fBesGeometry->Draw("3D");
00963 
00964     // add itself to the list
00965     //AppendPad();
00966 
00967     //Loop on all makers to add their products to the pad
00968     /*
00969       TIter next(gBesVisast->Makers());
00970     BesVisMaker *maker;
00971     while ((maker = (BesVisMaker*)next())) {
00972        maker->Draw();
00973     }
00974     */
00975 
00976     //view->SetView(phi, theta, 90, iret);  //previous side view necessary
00977     view->SetView(phi, theta, 270, iret);
00978     //view->SetParralel();  //-----------liangyt
00979     view->SetParallel();
00980     //use SetParallel() instead of depreciated function TView::SetParralel()
00981     //changed by tianhl at Mon Aug 20 2007
00982     //view->SetPerspective();
00983     //view->ShowAxis();
00984 
00985     //DrawViewRange(0, 0, 0, 2500);
00986 }
00987 
00988 //_____________________________________________________________________________
00989 void BesVisDisplay::DrawViewRange(Double_t x0, Double_t y0, Double_t z0,
00990                                   Double_t zoomSize)
00991 {
00992 //    Draw a view of some place
00993 
00994     gPad->GetView()->SetRange(x0 - 0.5*zoomSize, y0 - 0.5*zoomSize, z0 - 0.5*zoomSize,
00995                               x0 + 0.5*zoomSize, y0 + 0.5*zoomSize, z0 + 0.5*zoomSize);
00996 }
00997 
00998 //_____________________________________________________________________________
00999 void BesVisDisplay::DrawViewGL()
01000 {
01001 //    Draw current view using OPENGL
01002 
01003     TPad *pad = (TPad*)gPad->GetPadSave();
01004     pad->cd();
01005     TView *view = pad->GetView();
01006     if (!view) return;
01007     pad->x3d("OPENGL");//-----------liangyt
01008 }
01009 
01010 //_____________________________________________________________________________
01011 void BesVisDisplay::DrawViewX3D()
01012 {
01013 //    Draw current view using X3D
01014 
01015     TPad *pad = (TPad*)gPad->GetPadSave();
01016     pad->cd();
01017     TView *view = pad->GetView();
01018     if (!view) return;
01019     pad->x3d();//-----------liangyt
01020 }
01021 
01022 //_____________________________________________________________________________
01023 void BesVisDisplay::DrawViewRaytracer(Float_t theta, Float_t phi, Float_t psi)
01024 {
01025     //TCanvas *rayCanvas = new TCanvas("rayCanvas", "Raytracer Canvas", 10, 10, 800, 800);
01026     TCanvas *rayCanvas = new TCanvas("rayCanvas", "Raytracer Canvas", 10, 10, 800, 800);
01027     rayCanvas->cd();
01028 
01029 
01030     //TPad *rayPad = new TPad("rayPad", "Raytracer display",0.,0.,1,1);
01031     //rayPad->Draw();
01032     //rayPad->Modified();
01033     gPad->SetFillColor(1);
01034 
01035     //rayPad->SetBorderSize(2);
01036     //rayPad->cd();
01037     //fMucGeo->GetVolMuc()->Draw();
01038     //fBes->Draw();
01039 
01040     TView *view = gPad->GetView();
01041     //view->SetPerspective();
01042     int iret;
01043     view->ZoomView(gPad, 1.5);
01044     view->SetView(phi, theta, psi, iret);
01045     //   |
01046     //  \|/
01047 
01048     //gGeoManager->GetGeomPainter()->SetBombFactors(2, 2, 2, 2);
01049     //gGeoManager->GetGeomPainter()->SetExplodedView(3);
01050 
01051     gGeoManager->GetGeomPainter()->SetRaytracing(kTRUE);
01052 
01053     rayCanvas->Modified();
01054     rayCanvas->Update();
01055     //rayPad->Modified();
01056     //rayPad->Update();
01057 
01058     stringstream sPicCount;
01059     sPicCount << fRayPicCount << ".gif";
01060     string str = sPicCount.str();
01061 
01062     gPad->SaveAs(str.c_str());
01063     fRayPicCount++;
01064 }
01065 
01066 void BesVisDisplay::DrawViewX3D(char option)
01067 {
01068     TCanvas *x3dCanvas = new TCanvas("x3dCanvas", "X3dtracer Canvas", 10, 10, 800, 800);
01069     x3dCanvas->cd();
01070 
01071     gPad->SetFillColor(1);
01072     //x3dPad->SetBorderSize(2);
01073     //x3dPad->cd();
01074 
01075     //fBes->Draw("x3d");
01076 
01077     //TView *view = gPad->GetView();
01078     //view->SetPerspective();
01079     //int iret;
01080     //view->ZoomView(gPad, 1.2);
01081     //view->SetView(30, 60, 270, iret);
01082 
01083 
01084     //gPad->x3d();//-----------liangyt
01085     gPad->GetViewer3D();
01086     //use TPad::GetViewer3D() instead of depreciated function TPad::x3d()
01087     //changed by tianhl at Mon Aug 20 2007
01088     //TViewerX3D *x3d = (TViewerX3D*)gPad->GetViewer3D();
01089 
01090     //TViewerX3D *x3d = new TViewerX3D(x3dCanvas, "");
01091     //x3d->ExecCommand(0,0,option);
01092 
01093     //for (Int_t i=0;i<500;i++) {
01094     //Int_t px = i%500;
01095     //Int_t py = (2*i)%200;
01096     //x3d->ExecCommand(px,py,0);  //rotate
01097     //if (i%20 >10) x3d->ExecCommand(px,py,'j'); //zoom
01098     //if (i%20 <10) x3d->ExecCommand(px,py,'k'); //unzoom
01099     //}
01100 
01101 
01102     stringstream sPicCount;
01103     fRayPicCount = 0;
01104     sPicCount << fRayPicCount << ".gif";
01105     string str = sPicCount.str();
01106 
01107     gPad->SaveAs(str.c_str());
01108     fRayPicCount++;
01109 }
01110 
01111 void BesVisDisplay::DrawImageSequence(Int_t thetaStart, Int_t thetaStep)
01112 {
01113     /*
01114      fRayPicCount = 0;
01115      //for(int i = thetaStart; i < thetaStart + 360; i += thetaStep) {
01116      //DrawViewRaytracer(i, 30, 270);
01117      //}
01118      for (int i = 0; i < fTofROOTGeo->GetScinNb(0); i++) {
01119        for (int j=0; j < 20; j++) {
01120          fTofROOTGeo->GetPhysicalScin(1, i*20+j)->SetVisibility(1);
01121        }
01122        DrawViewRaytracer(30, 30, 270);
01123      }
01124     */
01125 }
01126 
01127 //______________________________________________________________________________
01128 void BesVisDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
01129 {
01130 //*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
01131 //*-*                  =========================================
01132 
01133     if (gPad->GetView()) {
01134         gPad->GetView()->ExecuteRotateView(event, px, py);
01135     }
01136 }
01137 
01138 //_____________________________________________________________________________
01139 void BesVisDisplay::GetEvent(Long64_t event)
01140 {
01141 //    Read event in memory
01142 
01143     //   gBesVisast->GetEvent(event);
01144 
01145     //Draw();
01146 
01147     //gGeoManager->ClearAttributes();
01148     SetMdcFiredCell();
01149     SetTofFiredCell();
01150     SetEmcFiredCell();
01151     SetMucFiredCell();
01152 }
01153 
01154 //_____________________________________________________________________________
01155 void BesVisDisplay::Paint(Option_t *)
01156 {
01157 //    Paint miscellaneous items
01158 
01159 }
01160 
01161 //_____________________________________________________________________________
01162 void BesVisDisplay::PaintFruit(TObject *obj, Float_t eta, Float_t phi, Float_t pt, Int_t type, Option_t *option)
01163 {
01164     //    Display fruit from obj
01165     /*
01166       if (fDrawClusters) {
01167       if (!fFruits) fFruits = new TList();
01168       BesVisFruit *fruit = new BesVisFruit(obj, eta, phi, pt, type);
01169       fFruits->Add(fruit);
01170       fruit->Paint(option);
01171     }
01172     */
01173 }
01174 
01175 //_____________________________________________________________________________
01176 void BesVisDisplay::PaintParticles(Option_t *option)
01177 {
01178     //if (fDrawParticles) fParticle->Paint(option);
01179 }
01180 
01181 //_____________________________________________________________________________
01182 void BesVisDisplay::SetPTcut(Float_t ptcut)
01183 {
01184     fPTcut = ptcut;
01185 
01186     if (fDrawAllViews) {
01187         fPad->cd(1);
01188         gPad->Modified();
01189         fPad->cd(2);
01190         gPad->Modified();
01191         fPad->cd(3);
01192         gPad->Modified();
01193         fPad->cd(4);
01194         gPad->Modified();
01195         fPad->cd();
01196     }
01197 }
01198 
01199 //_____________________________________________________________________________
01200 void BesVisDisplay::SetPTcutEGMUNU(Float_t ptcut)
01201 {
01202     fPTcutEGMUNU = ptcut;
01203 
01204     if (fDrawAllViews) {
01205         fPad->cd(1);
01206         gPad->Modified();
01207         fPad->cd(2);
01208         gPad->Modified();
01209         fPad->cd(3);
01210         gPad->Modified();
01211         fPad->cd(4);
01212         gPad->Modified();
01213         fPad->cd();
01214     }
01215 }
01216 
01217 //_____________________________________________________________________________
01218 void BesVisDisplay::SetView(Float_t theta, Float_t phi)
01219 {
01220 //  change viewing angles for current event
01221 
01222     fPad->cd();
01223     fDrawAllViews = kFALSE;
01224     fPhi   = phi;
01225     fTheta = theta;
01226     Int_t iret;
01227 
01228     TView *view = gPad->GetView();
01229     if (view) view->SetView(fPhi, fTheta, 0, iret);
01230     else      Draw();
01231 
01232     gPad->Modified();
01233 }
01234 
01235 //_____________________________________________________________________________
01236 void BesVisDisplay::ShowNextEvent(Int_t delta)
01237 {
01238 //  Display (current event_number+delta)
01239 //    delta =  1  shown next event
01240 //    delta = -1 show previous event
01241 
01242     //fTheta += 10;
01243     //fPhi += 10;
01244     if (delta) {
01245         //gBesVisast->Clear();
01246         //Int_t current_event = gBesVisast->Event();
01247         //Int_t new_event     = current_event + delta;
01248         //gBesVisast->GetEvent(new_event);
01249         //GetEvent(new_event);
01250     }
01251     fPad->cd();
01252     Draw();
01253 }
01254 
01255 //_____________________________________________________________________________
01256 void BesVisDisplay::SetMdcFiredCell()
01257 {
01258     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};
01259     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};
01260 
01261     for (int i = 0; i < 135; i++) {
01262         fMdcROOTGeo->GetPhysicalReplica(layer[i], replica[i])->SetVisibility(1);
01263         if (layer[i] > 35) fMdcROOTGeo->GetPhysicalReplica(layer[i]+7, replica[i])->SetVisibility(1);
01264         std::cout << layer[i] << "  " << replica[i] << std::endl;
01265     }
01266 }
01267 
01268 //_____________________________________________________________________________
01269 void BesVisDisplay::SetTofFiredCell()
01270 {
01271     int part[7] = {1,1,1,2,2,1,1,};
01272     int scin[7] = {31,32,57,31,32,59,21};
01273 
01274     std::cout << "set tof fired cell" << std::endl;
01275     for (int i = 0; i < 7; i++) {
01276         fTofROOTGeo->GetPhysicalScin(part[i], 0, scin[i])->SetVisibility(1);
01277         std::cout << part[i] << "  " << scin[i] << std::endl;
01278     }
01279 }
01280 
01281 //_____________________________________________________________________________
01282 void BesVisDisplay::SetEmcFiredCell()
01283 {
01284     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};
01285     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};
01286 
01287     for (int i = 0; i < 26; i++) {
01288         fEmcROOTGeo->GetPhysicalCrystal(1, phi[i], theta[i])->SetVisibility(1);
01289         std::cout << "1" << "  " << phi[i] << " " << theta[i] << std::endl;
01290     }
01291 }
01292 
01293 //_____________________________________________________________________________
01294 void BesVisDisplay::SetMucFiredCell()
01295 {
01296     vector<int> cellCon;
01297 
01298     int part[11] = {1,1,1,1,1,1,1,1,1,1,1};
01299     int seg[11]  = {6,6,2,2,2,2,2,2,2,2,2};
01300     int gap[11]  = {0, 1, 0, 1, 2, 2, 3, 4, 5, 6, 7};
01301     int strip[11]= {2,20,20,29,21,22,27,25,25,30,22};
01302 
01303     for (int i = 0; i < 11; i++) {
01304         fMucROOTGeo->GetPhysicalStrip(part[i], seg[i], gap[i], strip[i])->SetVisibility(1);
01305         std::cout << " " << part[i] << " " << seg[i] << " " << gap[i] << " " << strip[i] << std::endl;
01306     }
01307 }
01308 
01309 //______________________________________________________________________________
01310 void BesVisDisplay::SizeFruit() const
01311 {
01312     const Int_t npoints = 2;
01313     gSize3D.numPoints += npoints;
01314     gSize3D.numSegs   += (npoints-1);
01315     gSize3D.numPolys  += 0;
01316 }
01317 
01318 //______________________________________________________________________________
01319 void BesVisDisplay::SizeParticles() const
01320 {
01321     //if (fDrawParticles)  fParticle->SizeParticles();
01322     //printf("numPoints=%d, numSegs=%d, numPolys=%d\n",gSize3D.numPoints,gSize3D.numSegs,gSize3D.numPolys);
01323 }
01324 
01325 
01326 //_____________________________________________________________________________
01327 void BesVisDisplay::Clear(Option_t *)
01328 {
01329 //    Delete graphics temporary objects
01330 
01331 }
01332 

Generated on Tue Nov 29 23:12:04 2016 for BOSS_7.0.2 by  doxygen 1.4.7