File indexing completed on 2025-01-30 09:17:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDEve/MultiView.h>
0016 #include <DDEve/Factories.h>
0017 #include <DDEve/DisplayConfiguration.h>
0018 #include <DD4hep/Plugins.h>
0019
0020 #include <iostream>
0021
0022 using namespace dd4hep;
0023
0024 ClassImp(MultiView)
0025 DECLARE_VIEW_FACTORY(MultiView)
0026
0027
0028 static void _build(Display* display, View* v, TEveWindowSlot* slot) {
0029 v->Build(slot);
0030 display->RegisterEvents(v);
0031 v->ConfigureGeometryFromInfo();
0032 v->ConfigureEventFromInfo();
0033 v->Initialize();
0034 }
0035
0036
0037 MultiView::MultiView(Display* eve, const std::string& nam) : View(eve, nam)
0038 {
0039 }
0040
0041
0042 MultiView::~MultiView() {
0043 }
0044
0045
0046 View& MultiView::Build(TEveWindow* slot) {
0047 typedef DisplayConfiguration::Configurations _C;
0048 typedef Display::ViewConfigurations _V;
0049 TEveWindowSlot* new_slot;
0050 View* v;
0051
0052
0053 TEveWindowPack *pack = ((TEveWindowSlot*)slot)->MakePack();
0054 pack->SetElementName(m_name.c_str());
0055 pack->SetHorizontal();
0056 pack->SetShowTitleBar(kFALSE);
0057
0058 CreateScenes().Map(new_slot = pack->NewSlot());
0059 pack = pack->NewSlot()->MakePack();
0060 pack->SetShowTitleBar(kFALSE);
0061
0062 _C panels;
0063 const _V& view_cfg = m_eve->viewConfigurations();
0064 _V::const_iterator icfg = view_cfg.find(m_name);
0065 if ( icfg != view_cfg.end() ) {
0066 const _C& c = (*icfg).second.subdetectors;
0067 for(_C::const_iterator i = c.begin(); i!=c.end();++i) {
0068 if ( (*i).type == DisplayConfiguration::PANEL ) panels.push_back(*i);
0069 }
0070 }
0071
0072 if ( panels.size()>0) {
0073 const DisplayConfiguration::Config& cfg = panels[0];
0074 std::string typ = "DD4hep_DDEve_"+cfg.use;
0075 v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str());
0076 }
0077 else {
0078 v = PluginService::Create<View*>("DD4hep_DDEve_RhoZProjection",m_eve,(m_name+" - RhoZ View").c_str());
0079 }
0080 (new_slot = pack->NewSlot())->MakeCurrent();
0081 _build(m_eve,v,new_slot);
0082
0083
0084 if ( panels.size()>1) {
0085 const DisplayConfiguration::Config& cfg = panels[1];
0086 std::string typ = "DD4hep_DDEve_"+cfg.use;
0087 v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str());
0088 }
0089 else {
0090 v = PluginService::Create<View*>("DD4hep_DDEve_RhoPhiProjection",m_eve,(m_name+" - RPhi View").c_str());
0091 }
0092 (new_slot = pack->NewSlot())->MakeCurrent();
0093 _build(m_eve,v,new_slot);
0094 return *this;
0095 }