DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
MultiView.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #include <DDEve/MultiView.h>
16 #include <DDEve/Factories.h>
18 #include <DD4hep/Plugins.h>
19 
20 #include <iostream>
21 
22 using namespace dd4hep;
23 
26 
27 static void _build(Display* display, View* v, TEveWindowSlot* slot) {
29  v->Build(slot);
30  display->RegisterEvents(v);
34 }
35 
37 MultiView::MultiView(Display* eve, const std::string& nam) : View(eve, nam)
38 {
39 }
40 
43 }
44 
46 View& MultiView::Build(TEveWindow* slot) {
48  typedef Display::ViewConfigurations _V;
49  TEveWindowSlot* new_slot;
50  View* v;
51 
52  // Viewers
53  TEveWindowPack *pack = ((TEveWindowSlot*)slot)->MakePack();
54  pack->SetElementName(m_name.c_str());
55  pack->SetHorizontal();
56  pack->SetShowTitleBar(kFALSE);
57 
58  CreateScenes().Map(new_slot = pack->NewSlot());
59  pack = pack->NewSlot()->MakePack();
60  pack->SetShowTitleBar(kFALSE);
61 
62  _C panels;
63  const _V& view_cfg = m_eve->viewConfigurations();
64  _V::const_iterator icfg = view_cfg.find(m_name);
65  if ( icfg != view_cfg.end() ) {
66  const _C& c = (*icfg).second.subdetectors;
67  for(_C::const_iterator i = c.begin(); i!=c.end();++i) {
68  if ( (*i).type == DisplayConfiguration::PANEL ) panels.push_back(*i);
69  }
70  }
72  if ( panels.size()>0) {
73  const DisplayConfiguration::Config& cfg = panels[0];
74  std::string typ = "DD4hep_DDEve_"+cfg.use;
75  v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str());
76  }
77  else {
78  v = PluginService::Create<View*>("DD4hep_DDEve_RhoZProjection",m_eve,(m_name+" - RhoZ View").c_str());
79  }
80  (new_slot = pack->NewSlot())->MakeCurrent();
81  _build(m_eve,v,new_slot);
82 
84  if ( panels.size()>1) {
85  const DisplayConfiguration::Config& cfg = panels[1];
86  std::string typ = "DD4hep_DDEve_"+cfg.use;
87  v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str());
88  }
89  else {
90  v = PluginService::Create<View*>("DD4hep_DDEve_RhoPhiProjection",m_eve,(m_name+" - RPhi View").c_str());
91  }
92  (new_slot = pack->NewSlot())->MakeCurrent();
93  _build(m_eve,v,new_slot);
94  return *this;
95 }
dd4hep::Display
The main class of the DDEve display.
Definition: Display.h:56
MultiView.h
dd4hep::View::m_eve
Display * m_eve
Definition: View.h:49
DECLARE_VIEW_FACTORY
#define DECLARE_VIEW_FACTORY(x)
Definition: Factories.h:30
v
View * v
Definition: MultiView.cpp:28
_C
DetElement::Children _C
Definition: GeometryWalk.cpp:64
dd4hep::MultiView
class MultiView MultiView.h DDEve/MultiView.h
Definition: MultiView.h:32
DisplayConfiguration.h
dd4hep::View::Map
virtual View & Map(TEveWindow *slot)
Map the view view to the slot.
Definition: View.cpp:334
Factories.h
dd4hep::View::Build
virtual View & Build(TEveWindow *slot)
Build the view view and map it to the given slot.
Definition: View.cpp:58
dd4hep::View::ConfigureGeometryFromInfo
virtual void ConfigureGeometryFromInfo()
Configure a view with geo info. Used configuration if present.
Definition: View.cpp:138
dd4hep::Display::ViewConfigurations
std::map< std::string, ViewConfig > ViewConfigurations
Definition: Display.h:64
dd4hep::Display::viewConfigurations
const ViewConfigurations & viewConfigurations() const
Access View configurations.
Definition: Display.h:133
slot
View TEveWindowSlot * slot
Definition: MultiView.cpp:28
dd4hep::MultiView::Build
virtual View & Build(TEveWindow *slot) override
Build the 3d view and map it to the given slot.
Definition: MultiView.cpp:46
Plugins.h
dd4hep::View::ConfigureEventFromInfo
virtual void ConfigureEventFromInfo()
Configure a view with event info. Used configuration if present.
Definition: View.cpp:230
dd4hep::DisplayConfiguration::Config
Container with full display configuration.
Definition: DisplayConfiguration.h:92
dd4hep::DisplayConfiguration::PANEL
@ PANEL
Definition: DisplayConfiguration.h:49
dd4hep::MultiView::~MultiView
virtual ~MultiView()
Default destructor.
Definition: MultiView.cpp:42
dd4hep::DisplayConfiguration::Config::name
std::string name
Definition: DisplayConfiguration.h:103
dd4hep::View::CreateScenes
virtual View & CreateScenes()
Create the geometry and the event scene.
Definition: View.cpp:306
dd4hep::View::m_name
std::string m_name
The name of the view.
Definition: View.h:61
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::View::Initialize
virtual void Initialize()
Initialize the view port.
Definition: View.cpp:63
dd4hep::View
class View View.h DDEve/View.h
Definition: View.h:45
ClassImp
ClassImp(MultiView) static void _build(Display *display
Import Geometry data.
dd4hep::MultiView::MultiView
MultiView(Display *eve, const std::string &name)
Initializing constructor.
Definition: MultiView.cpp:37
dd4hep::Display::RegisterEvents
virtual void RegisterEvents(View *view)
Register to the main event scene on new events.
Definition: Display.cpp:259
dd4hep::DisplayConfiguration::Configurations
std::vector< Config > Configurations
Definition: DisplayConfiguration.h:116
dd4hep::DisplayConfiguration::Config::use
std::string use
Definition: DisplayConfiguration.h:105