Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /pfRICH/Visualization/MultiView.C was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /// \file
0002 /// \ingroup tutorial_eve
0003 /// Multi-view (3d, rphi, rhoz) service class using EVE Window Manager.
0004 ///
0005 /// \macro_code
0006 ///
0007 /// \author Matevz Tadel
0008 
0009 #include <TEveManager.h>
0010 
0011 #include <TEveViewer.h>
0012 #include <TGLViewer.h>
0013 
0014 #include <TEveScene.h>
0015 
0016 #include <TEveProjectionManager.h>
0017 #include <TEveProjectionAxes.h>
0018 
0019 #include <TEveBrowser.h>
0020 #include <TEveWindow.h>
0021 
0022 // MultiView
0023 //
0024 // Structure encapsulating standard views: 3D, r-phi and rho-z.
0025 // Includes scenes and projection managers.
0026 //
0027 // Should be used in compiled mode.
0028 
0029 struct MultiView
0030 {
0031    TEveProjectionManager *fRPhiMgr;
0032    TEveProjectionManager *fRhoZMgr;
0033 
0034    TEveViewer            *f3DView;
0035    TEveViewer            *fRPhiView;
0036    TEveViewer            *fRhoZView;
0037 
0038    TEveScene             *fRPhiGeomScene;
0039    TEveScene             *fRhoZGeomScene;
0040    TEveScene             *fRPhiEventScene;
0041    TEveScene             *fRhoZEventScene;
0042 
0043    //---------------------------------------------------------------------------
0044 
0045    MultiView()
0046    {
0047       // Constructor --- creates required scenes, projection managers
0048       // and GL viewers.
0049 
0050       // Scenes
0051       //========
0052 
0053       fRPhiGeomScene  = gEve->SpawnNewScene("RPhi Geometry",
0054                                             "Scene holding projected geometry for the RPhi view.");
0055       fRhoZGeomScene  = gEve->SpawnNewScene("RhoZ Geometry",
0056                                             "Scene holding projected geometry for the RhoZ view.");
0057       fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
0058                                             "Scene holding projected event-data for the RPhi view.");
0059       fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
0060                                             "Scene holding projected event-data for the RhoZ view.");
0061 
0062 
0063       // Projection managers
0064       //=====================
0065 
0066       fRPhiMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
0067       gEve->AddToListTree(fRPhiMgr, kFALSE);
0068       {
0069          TEveProjectionAxes* a = new TEveProjectionAxes(fRPhiMgr);
0070          a->SetMainColor(kWhite);
0071          a->SetTitle("R-Phi");
0072          a->SetTitleSize(0.05);
0073          a->SetTitleFont(102);
0074          a->SetLabelSize(0.025);
0075          a->SetLabelFont(102);
0076          fRPhiGeomScene->AddElement(a);
0077       }
0078 
0079       fRhoZMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
0080       gEve->AddToListTree(fRhoZMgr, kFALSE);
0081       {
0082          TEveProjectionAxes* a = new TEveProjectionAxes(fRhoZMgr);
0083          a->SetMainColor(kWhite);
0084          a->SetTitle("Rho-Z");
0085          a->SetTitleSize(0.05);
0086          a->SetTitleFont(102);
0087          a->SetLabelSize(0.025);
0088          a->SetLabelFont(102);
0089          fRhoZGeomScene->AddElement(a);
0090       }
0091 
0092 
0093       // Viewers
0094       //=========
0095 
0096       TEveWindowSlot *slot = 0;
0097       TEveWindowPack *pack = 0;
0098 
0099       slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
0100       pack = slot->MakePack();
0101       pack->SetElementName("Multi View");
0102       pack->SetHorizontal();
0103       pack->SetShowTitleBar(kFALSE);
0104       pack->NewSlot()->MakeCurrent();
0105       f3DView = gEve->SpawnNewViewer("3D View", "");
0106       f3DView->AddScene(gEve->GetGlobalScene());
0107       f3DView->AddScene(gEve->GetEventScene());
0108 
0109       pack = pack->NewSlot()->MakePack();
0110       pack->SetShowTitleBar(kFALSE);
0111       pack->NewSlot()->MakeCurrent();
0112       fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
0113       fRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
0114       fRPhiView->AddScene(fRPhiGeomScene);
0115       fRPhiView->AddScene(fRPhiEventScene);
0116 
0117       pack->NewSlot()->MakeCurrent();
0118       fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
0119       fRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
0120       fRhoZView->AddScene(fRhoZGeomScene);
0121       fRhoZView->AddScene(fRhoZEventScene);
0122    }
0123 
0124    //---------------------------------------------------------------------------
0125 
0126    void SetDepth(Float_t d)
0127    {
0128       // Set current depth on all projection managers.
0129 
0130       fRPhiMgr->SetCurrentDepth(d);
0131       fRhoZMgr->SetCurrentDepth(d);
0132    }
0133 
0134    //---------------------------------------------------------------------------
0135 
0136    void ImportGeomRPhi(TEveElement* el)
0137    {
0138       fRPhiMgr->ImportElements(el, fRPhiGeomScene);
0139    }
0140 
0141    void ImportGeomRhoZ(TEveElement* el)
0142    {
0143       fRhoZMgr->ImportElements(el, fRhoZGeomScene);
0144    }
0145 
0146    void ImportEventRPhi(TEveElement* el)
0147    {
0148       fRPhiMgr->ImportElements(el, fRPhiEventScene);
0149    }
0150 
0151    void ImportEventRhoZ(TEveElement* el)
0152    {
0153       fRhoZMgr->ImportElements(el, fRhoZEventScene);
0154    }
0155 
0156    //---------------------------------------------------------------------------
0157 
0158    void DestroyEventRPhi()
0159    {
0160       fRPhiEventScene->DestroyElements();
0161    }
0162 
0163    void DestroyEventRhoZ()
0164    {
0165       fRhoZEventScene->DestroyElements();
0166    }
0167 };