Fork me on GitHub

source: git/display/DelphesDisplay.cc@ e5ea42e

Last change on this file since e5ea42e was 1fa50c2, checked in by Pavel Demin <pavel.demin@…>, 10 years ago

fix GPLv3 header

  • Property mode set to 100644
File size: 4.9 KB
Line 
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
20#include "TEveManager.h"
21#include "TEveViewer.h"
22#include "TGLViewer.h"
23#include "TGLWidget.h"
24#include "TEveScene.h"
25#include "TEveProjectionManager.h"
26#include "TEveProjectionAxes.h"
27#include "TEveBrowser.h"
28#include "TEveWindow.h"
29#include "TGTab.h"
30
31#include "TEveCalo2DGL.h"
32#include "TEveCalo3DGL.h"
33#include "TEveCaloLegoGL.h"
34#include "TEveCaloLegoOverlay.h"
35#include "TEveLegoEventHandler.h"
36
37#include "display/DelphesDisplay.h"
38
39//------------------------------------------------------------------------------
40
41DelphesDisplay::DelphesDisplay()
42{
43 TEveProjectionAxes *axes;
44 TEveWindowSlot *slot;
45 TEveWindowPack *packH, *pack0, *pack1;
46
47 fRPhiMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
48 fRhoZMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
49
50 fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry");
51 fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry");
52
53 fRPhiCaloScene = gEve->SpawnNewScene("RPhi Calorimeter");
54 fRhoZCaloScene = gEve->SpawnNewScene("RhoZ Calorimeter");
55 fLegoCaloScene = gEve->SpawnNewScene("Lego Calorimeter");
56
57 fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data");
58 fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data");
59
60 axes = new TEveProjectionAxes(fRPhiMgr);
61 fRPhiGeomScene->AddElement(axes);
62
63 axes = new TEveProjectionAxes(fRhoZMgr);
64 fRhoZGeomScene->AddElement(axes);
65
66 // close default tab
67 gEve->GetBrowser()->GetTabRight()->CloseTab(0);
68
69 // frames
70 slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
71 packH = slot->MakePack();
72
73 packH->SetElementName("Delphes Display");
74 packH->SetHorizontal();
75 packH->SetShowTitleBar(kFALSE);
76
77 pack0 = packH->NewSlot()->MakePack();
78 pack0->SetShowTitleBar(kFALSE);
79
80 pack1 = packH->NewSlot()->MakePack();
81 pack1->SetShowTitleBar(kFALSE);
82
83 pack1->NewSlot()->MakeCurrent();
84 f3DimView = gEve->SpawnNewViewer("3D View", "");
85 f3DimView->AddScene(gEve->GetGlobalScene());
86 f3DimView->AddScene(gEve->GetEventScene());
87
88 pack1->NewSlot()->MakeCurrent();
89 fLegoView = gEve->SpawnNewViewer("Lego View", "");
90 fLegoView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
91 fLegoView->AddScene(fLegoCaloScene);
92
93 pack0->NewSlot()->MakeCurrent();
94 fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
95 fRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
96 fRPhiView->AddScene(fRPhiGeomScene);
97 fRPhiView->AddScene(fRPhiCaloScene);
98 fRPhiView->AddScene(fRPhiEventScene);
99
100 pack0->NewSlot()->MakeCurrent();
101 fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
102 fRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
103 fRhoZView->AddScene(fRhoZGeomScene);
104 fRhoZView->AddScene(fRhoZCaloScene);
105 fRhoZView->AddScene(fRhoZEventScene);
106}
107
108//------------------------------------------------------------------------------
109
110DelphesDisplay::~DelphesDisplay()
111{
112}
113
114//------------------------------------------------------------------------------
115
116void DelphesDisplay::ImportGeomRPhi(TEveElement* el)
117{
118 fRPhiMgr->ImportElements(el, fRPhiGeomScene);
119}
120
121void DelphesDisplay::ImportGeomRhoZ(TEveElement* el)
122{
123 fRhoZMgr->ImportElements(el, fRhoZGeomScene);
124}
125
126void DelphesDisplay::ImportCaloRPhi(TEveCalo3D *calo)
127{
128 fRPhiMgr->ImportElements(calo, fRPhiCaloScene);
129}
130
131void DelphesDisplay::ImportCaloRhoZ(TEveCalo3D *calo)
132{
133 fRhoZMgr->ImportElements(calo, fRhoZCaloScene);
134}
135
136void DelphesDisplay::ImportCaloLego(TEveCaloLego *calo)
137{
138 TEveCaloLegoOverlay *overlay = new TEveCaloLegoOverlay();
139
140 overlay->SetCaloLego(calo);
141 fLegoView->GetGLViewer()->AddOverlayElement(overlay);
142
143 fLegoCaloScene->AddElement(calo);
144}
145
146void DelphesDisplay::ImportEventRPhi(TEveElement* el)
147{
148 fRPhiMgr->ImportElements(el, fRPhiEventScene);
149}
150
151void DelphesDisplay::ImportEventRhoZ(TEveElement* el)
152{
153 fRhoZMgr->ImportElements(el, fRhoZEventScene);
154}
155
156//---------------------------------------------------------------------------
157
158void DelphesDisplay::DestroyEventRPhi()
159{
160 fRPhiEventScene->DestroyElements();
161}
162
163void DelphesDisplay::DestroyEventRhoZ()
164{
165 fRhoZEventScene->DestroyElements();
166}
167//------------------------------------------------------------------------------
168
Note: See TracBrowser for help on using the repository browser.