Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:18

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
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 /// Import Geometry data
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 /// Initializing constructor
0037 MultiView::MultiView(Display* eve, const std::string& nam) : View(eve, nam)
0038 {
0039 }
0040 
0041 /// Default destructor
0042 MultiView::~MultiView()  {
0043 }
0044 
0045 /// Build the projection view and map it to the given slot
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   // Viewers
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   /// First panel
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   /// Second panel
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 }