1 | /*
|
---|
2 | * Delphes: a framework for fast simulation of a generic collider experiment
|
---|
3 | * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include "TEveBrowser.h"
|
---|
20 | #include "TEveManager.h"
|
---|
21 | #include "TEveProjectionAxes.h"
|
---|
22 | #include "TEveProjectionManager.h"
|
---|
23 | #include "TEveScene.h"
|
---|
24 | #include "TEveViewer.h"
|
---|
25 | #include "TEveWindow.h"
|
---|
26 | #include "TGLViewer.h"
|
---|
27 | #include "TGLWidget.h"
|
---|
28 | #include "TGTab.h"
|
---|
29 |
|
---|
30 | #include "TEveCalo2DGL.h"
|
---|
31 | #include "TEveCalo3DGL.h"
|
---|
32 | #include "TEveCaloLegoGL.h"
|
---|
33 | #include "TEveCaloLegoOverlay.h"
|
---|
34 | #include "TEveLegoEventHandler.h"
|
---|
35 |
|
---|
36 | #include "display/DelphesDisplay.h"
|
---|
37 |
|
---|
38 | //------------------------------------------------------------------------------
|
---|
39 |
|
---|
40 | DelphesDisplay::DelphesDisplay()
|
---|
41 | {
|
---|
42 | TEveProjectionAxes *axes;
|
---|
43 | TEveWindowSlot *slot;
|
---|
44 | TEveWindowPack *packH, *pack0, *pack1;
|
---|
45 |
|
---|
46 | fRPhiMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
|
---|
47 | fRhoZMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
|
---|
48 |
|
---|
49 | fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry");
|
---|
50 | fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry");
|
---|
51 |
|
---|
52 | fRPhiCaloScene = gEve->SpawnNewScene("RPhi Calorimeter");
|
---|
53 | fRhoZCaloScene = gEve->SpawnNewScene("RhoZ Calorimeter");
|
---|
54 | fLegoCaloScene = gEve->SpawnNewScene("Lego Calorimeter");
|
---|
55 |
|
---|
56 | fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data");
|
---|
57 | fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data");
|
---|
58 |
|
---|
59 | axes = new TEveProjectionAxes(fRPhiMgr);
|
---|
60 | fRPhiGeomScene->AddElement(axes);
|
---|
61 |
|
---|
62 | axes = new TEveProjectionAxes(fRhoZMgr);
|
---|
63 | fRhoZGeomScene->AddElement(axes);
|
---|
64 |
|
---|
65 | // close default tab
|
---|
66 | gEve->GetBrowser()->GetTabRight()->CloseTab(0);
|
---|
67 |
|
---|
68 | // frames
|
---|
69 | slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
|
---|
70 | packH = slot->MakePack();
|
---|
71 |
|
---|
72 | packH->SetElementName("Delphes Display");
|
---|
73 | packH->SetHorizontal();
|
---|
74 | packH->SetShowTitleBar(kFALSE);
|
---|
75 |
|
---|
76 | pack0 = packH->NewSlot()->MakePack();
|
---|
77 | pack0->SetShowTitleBar(kFALSE);
|
---|
78 |
|
---|
79 | pack1 = packH->NewSlot()->MakePack();
|
---|
80 | pack1->SetShowTitleBar(kFALSE);
|
---|
81 |
|
---|
82 | pack1->NewSlot()->MakeCurrent();
|
---|
83 | f3DimView = gEve->SpawnNewViewer("3D View", "");
|
---|
84 | f3DimView->AddScene(gEve->GetGlobalScene());
|
---|
85 | f3DimView->AddScene(gEve->GetEventScene());
|
---|
86 |
|
---|
87 | pack1->NewSlot()->MakeCurrent();
|
---|
88 | fLegoView = gEve->SpawnNewViewer("Lego View", "");
|
---|
89 | fLegoView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
|
---|
90 | fLegoView->AddScene(fLegoCaloScene);
|
---|
91 |
|
---|
92 | pack0->NewSlot()->MakeCurrent();
|
---|
93 | fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
|
---|
94 | fRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
|
---|
95 | fRPhiView->AddScene(fRPhiGeomScene);
|
---|
96 | fRPhiView->AddScene(fRPhiCaloScene);
|
---|
97 | fRPhiView->AddScene(fRPhiEventScene);
|
---|
98 |
|
---|
99 | pack0->NewSlot()->MakeCurrent();
|
---|
100 | fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
|
---|
101 | fRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
|
---|
102 | fRhoZView->AddScene(fRhoZGeomScene);
|
---|
103 | fRhoZView->AddScene(fRhoZCaloScene);
|
---|
104 | fRhoZView->AddScene(fRhoZEventScene);
|
---|
105 | }
|
---|
106 |
|
---|
107 | //------------------------------------------------------------------------------
|
---|
108 |
|
---|
109 | DelphesDisplay::~DelphesDisplay()
|
---|
110 | {
|
---|
111 | }
|
---|
112 |
|
---|
113 | //------------------------------------------------------------------------------
|
---|
114 |
|
---|
115 | void DelphesDisplay::ImportGeomRPhi(TEveElement *el)
|
---|
116 | {
|
---|
117 | fRPhiMgr->ImportElements(el, fRPhiGeomScene);
|
---|
118 | }
|
---|
119 |
|
---|
120 | void DelphesDisplay::ImportGeomRhoZ(TEveElement *el)
|
---|
121 | {
|
---|
122 | fRhoZMgr->ImportElements(el, fRhoZGeomScene);
|
---|
123 | }
|
---|
124 |
|
---|
125 | void DelphesDisplay::ImportCaloRPhi(TEveCalo3D *calo)
|
---|
126 | {
|
---|
127 | fRPhiMgr->ImportElements(calo, fRPhiCaloScene);
|
---|
128 | }
|
---|
129 |
|
---|
130 | void DelphesDisplay::ImportCaloRhoZ(TEveCalo3D *calo)
|
---|
131 | {
|
---|
132 | fRhoZMgr->ImportElements(calo, fRhoZCaloScene);
|
---|
133 | }
|
---|
134 |
|
---|
135 | void DelphesDisplay::ImportCaloLego(TEveCaloLego *calo)
|
---|
136 | {
|
---|
137 | TEveCaloLegoOverlay *overlay = new TEveCaloLegoOverlay();
|
---|
138 |
|
---|
139 | overlay->SetCaloLego(calo);
|
---|
140 | fLegoView->GetGLViewer()->AddOverlayElement(overlay);
|
---|
141 |
|
---|
142 | fLegoCaloScene->AddElement(calo);
|
---|
143 | }
|
---|
144 |
|
---|
145 | void DelphesDisplay::ImportEventRPhi(TEveElement *el)
|
---|
146 | {
|
---|
147 | fRPhiMgr->ImportElements(el, fRPhiEventScene);
|
---|
148 | }
|
---|
149 |
|
---|
150 | void DelphesDisplay::ImportEventRhoZ(TEveElement *el)
|
---|
151 | {
|
---|
152 | fRhoZMgr->ImportElements(el, fRhoZEventScene);
|
---|
153 | }
|
---|
154 |
|
---|
155 | //---------------------------------------------------------------------------
|
---|
156 |
|
---|
157 | void DelphesDisplay::DestroyEventRPhi()
|
---|
158 | {
|
---|
159 | fRPhiEventScene->DestroyElements();
|
---|
160 | }
|
---|
161 |
|
---|
162 | void DelphesDisplay::DestroyEventRhoZ()
|
---|
163 | {
|
---|
164 | fRhoZEventScene->DestroyElements();
|
---|
165 | }
|
---|
166 | //------------------------------------------------------------------------------
|
---|