DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiView.cpp
Go to the documentation of this file.
1 // $Id: $
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include "DDEve/MultiView.h"
17 #include "DDEve/Factories.h"
19 #include "DD4hep/Plugins.h"
20 
21 #include <iostream>
22 
23 using namespace std;
24 using namespace DD4hep;
25 
28 
30 static void _build(Display* display, View* v, TEveWindowSlot* slot) {
31  v->Build(slot);
32  display->RegisterEvents(v);
33  v->ConfigureGeometryFromInfo();
34  v->ConfigureEventFromInfo();
35  v->Initialize();
36 }
37 
39 MultiView::MultiView(Display* eve, const string& nam) : View(eve, nam)
40 {
41 }
42 
45 }
46 
48 View& MultiView::Build(TEveWindow* slot) {
50  typedef Display::ViewConfigurations _V;
51  TEveWindowSlot* new_slot;
52  View* v;
53 
54  // Viewers
55  TEveWindowPack *pack = ((TEveWindowSlot*)slot)->MakePack();
56  pack->SetElementName(m_name.c_str());
57  pack->SetHorizontal();
58  pack->SetShowTitleBar(kFALSE);
59 
60  CreateScenes().Map(new_slot = pack->NewSlot());
61  pack = pack->NewSlot()->MakePack();
62  pack->SetShowTitleBar(kFALSE);
63 
64  _C panels;
65  const _V& view_cfg = m_eve->viewConfigurations();
66  _V::const_iterator icfg = view_cfg.find(m_name);
67  if ( icfg != view_cfg.end() ) {
68  const _C& c = (*icfg).second.subdetectors;
69  for(_C::const_iterator i = c.begin(); i!=c.end();++i) {
70  if ( (*i).type == DisplayConfiguration::PANEL ) panels.push_back(*i);
71  }
72  }
74  if ( panels.size()>0) {
75  const DisplayConfiguration::Config& cfg = panels[0];
76  string typ = "DD4hep__"+cfg.use;
77  v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str());
78  }
79  else {
80  v = PluginService::Create<View*>("DD4hep_DDEve_RhoZProjection",m_eve,(m_name+" - RhoZ View").c_str());
81  }
82  (new_slot = pack->NewSlot())->MakeCurrent();
83  _build(m_eve,v,new_slot);
84 
86  if ( panels.size()>1) {
87  const DisplayConfiguration::Config& cfg = panels[1];
88  string typ = "DD4hep__"+cfg.use;
89  v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str());
90  }
91  else {
92  v = PluginService::Create<View*>("DD4hep_DDEve_RhoPhiProjection",m_eve,(m_name+" - RPhi View").c_str());
93  }
94  (new_slot = pack->NewSlot())->MakeCurrent();
95  _build(m_eve,v,new_slot);
96  return *this;
97 }
Display * m_eve
Definition: View.h:53
#define DECLARE_VIEW_FACTORY(x)
Definition: Factories.h:31
std::string m_name
The name of the view.
Definition: View.h:65
DetElement::Children _C
ClassImp(MultiView) static void _build(Display *display
Import Geometry data.
std::vector< Config > Configurations
virtual View & Map(TEveWindow *slot)
Map the view view to the slot.
Definition: View.cpp:335
const ViewConfigurations & viewConfigurations() const
Access View configurations.
Definition: Display.h:117
View TEveWindowSlot * slot
Definition: MultiView.cpp:30
class View View.h DDEve/View.h
Definition: View.h:46
std::map< std::string, ViewConfig > ViewConfigurations
Definition: Display.h:65
virtual View & CreateScenes()
Create the geometry and the event scene.
Definition: View.cpp:307
virtual ~MultiView()
Default destructor.
Definition: MultiView.cpp:44
virtual View & Build(TEveWindow *slot)
Build the 3d view and map it to the given slot.
Definition: MultiView.cpp:48
View * v
Definition: MultiView.cpp:30
class MultiView MultiView.h DDEve/MultiView.h
Definition: MultiView.h:33
The main class of the DDEve display.
Definition: Display.h:57