DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
View.h
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 #ifndef DDEVE_VIEW_H
14 #define DDEVE_VIEW_H
15 
16 // Framework include files
17 #include "DD4hep/Detector.h"
19 
20 // Eve include files
21 #include <TEveScene.h>
22 #include <TEveViewer.h>
23 
24 // C/C++ include files
25 #include <map>
26 #include <string>
27 
28 // Forward declarations
29 class TEveManager;
30 class TEveElementList;
31 
33 namespace dd4hep {
34 
35  // Forward declarations
36  class Display;
37  class EventHandler;
38 
40  /*
41  * \author M.Frank
42  * \version 1.0
43  * \ingroup DD4HEP_EVE
44  */
45  class View {
46  public:
47  typedef std::map<std::string, TEveElementList*> Topics;
48  protected:
51  TEveViewer *m_view;
53  TEveScene *m_geoScene;
55  TEveScene *m_eveScene;
59 
61  std::string m_name;
62 
66 
67  public:
69  virtual TEveElement* ImportGeoElement(TEveElement* element, TEveElementList* list);
71  virtual TEveElement* ImportGeoTopic(TEveElement* element, TEveElementList* list);
73  virtual TEveElement* ImportEventElement(TEveElement* element, TEveElementList* list);
74 
75  public:
77  View(Display* eve, const std::string& name);
79  virtual ~View();
81  const std::string& name() const { return m_name; }
82  const char* c_name() const { return m_name.c_str(); }
84  TEveViewer* viewer() const { return m_view; }
86  bool showGlobal() const { return m_showGlobal; }
88  void setShowGlobal(bool value) { m_showGlobal = value; }
90  virtual View& Build(TEveWindow* slot);
92  virtual void Initialize();
94  virtual View& Map(TEveWindow* slot);
95 
97  virtual View& CreateScenes();
99  virtual TEveElementList* AddToGlobalItems(const std::string& nam);
100 
103  TEveScene* geoScene() const { return m_geoScene; }
106  virtual View& CreateGeoScene();
107 
109  virtual void ConfigureGeometryFromInfo();
111  virtual void ConfigureGeometryFromGlobal();
113  virtual void ConfigureGeometry(const DisplayConfiguration::ViewConfig& config);
114 
116  virtual std::pair<bool,TEveElement*>
117  CreateGeometry(DetElement de, const DisplayConfiguration::Config& cfg);
119  virtual std::pair<bool,TEveElement*>
120  GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config& cfg);
121 
122 
124  virtual void ImportGeo(const std::string& topic, TEveElement* element);
126  virtual void ImportGeo(TEveElementList& topic, TEveElement* element);
128  virtual void ImportGeo(TEveElement* element);
130  virtual void ImportGeoTopics(const std::string& title);
132  virtual TEveElementList& GetGeoTopic(const std::string& name);
133 
134 
137  TEveScene* eveScene() const { return m_eveScene; }
140  virtual View& CreateEventScene();
142  virtual void ConfigureEventFromInfo();
144  virtual void ConfigureEventFromGlobal();
146  virtual void ConfigureEvent(const DisplayConfiguration::ViewConfig& config);
148  virtual void ImportEvent(TEveElement* element);
150  virtual void ImportEventTopics();
151 
154  };
155 } /* End namespace dd4hep */
156 #endif // DDEVE_VIEW_H
dd4hep::View::ConfigureGeometry
virtual void ConfigureGeometry(const DisplayConfiguration::ViewConfig &config)
Configure a single geometry view.
Definition: View.cpp:158
dd4hep::Display
The main class of the DDEve display.
Definition: Display.h:56
dd4hep::View::c_name
const char * c_name() const
Definition: View.h:82
dd4hep::View::geoScene
TEveScene * geoScene() const
Access to the Eve geometry scene.
Definition: View.h:104
dd4hep::View::ClassDef
ClassDef(View, 0)
Root implementation macro.
dd4hep::View::View
View(Display *eve, const std::string &name)
Initializing constructor.
Definition: View.cpp:39
dd4hep::View::m_eve
Display * m_eve
Definition: View.h:49
dd4hep::View::GetGlobalGeometry
virtual std::pair< bool, TEveElement * > GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config &cfg)
Access the global instance of the subdetector geometry.
Definition: View.cpp:122
Detector.h
dd4hep::View::ImportEvent
virtual void ImportEvent(TEveElement *element)
Call to import event elements into the main event scene.
Definition: View.cpp:288
DisplayConfiguration.h
dd4hep::View::ConfigureGeometryFromGlobal
virtual void ConfigureGeometryFromGlobal()
Configure a single geometry view by default from the global geometry scene with all subdetectors.
Definition: View.cpp:145
dd4hep::View::Map
virtual View & Map(TEveWindow *slot)
Map the view view to the slot.
Definition: View.cpp:334
dd4hep::View::CreateGeometry
virtual std::pair< bool, TEveElement * > CreateGeometry(DetElement de, const DisplayConfiguration::Config &cfg)
Create a new instance of the geometry of a sub-detector.
Definition: View.cpp:131
dd4hep::View::Topics
std::map< std::string, TEveElementList * > Topics
Definition: View.h:47
dd4hep::View::~View
virtual ~View()
Default destructor.
Definition: View.cpp:47
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::View::setShowGlobal
void setShowGlobal(bool value)
Set show globals.
Definition: View.h:88
TEveElementList
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:13
dd4hep::View::eveScene
TEveScene * eveScene() const
Access to the Eve event scene.
Definition: View.h:138
dd4hep::View::m_config
const DisplayConfiguration::ViewConfig * m_config
Definition: View.h:58
dd4hep::View::GetGeoTopic
virtual TEveElementList & GetGeoTopic(const std::string &name)
Access/Create an geometry topic by name.
Definition: View.cpp:295
dd4hep::View::ImportEventElement
virtual TEveElement * ImportEventElement(TEveElement *element, TEveElementList *list)
Call an element to a event element list.
Definition: View.cpp:107
dd4hep::View::name
const std::string & name() const
Access to the view name/title.
Definition: View.h:81
dd4hep::View::AddToGlobalItems
virtual TEveElementList * AddToGlobalItems(const std::string &nam)
Add the view to the global list of eve objects.
Definition: View.cpp:81
dd4hep::View::m_geoTopics
Topics m_geoTopics
Definition: View.h:63
slot
View TEveWindowSlot * slot
Definition: MultiView.cpp:28
dd4hep::View::ImportGeoElement
virtual TEveElement * ImportGeoElement(TEveElement *element, TEveElementList *list)
Call an element to a geometry element list.
Definition: View.cpp:92
dd4hep::View::CreateGeoScene
virtual View & CreateGeoScene()
Create the geometry scene.
Definition: View.cpp:324
dd4hep::View::CreateEventScene
virtual View & CreateEventScene()
Create the event scene.
Definition: View.cpp:314
dd4hep::View::ImportGeoTopic
virtual TEveElement * ImportGeoTopic(TEveElement *element, TEveElementList *list)
Call an element to a geometry element list.
Definition: View.cpp:102
dd4hep::View::ImportEventTopics
virtual void ImportEventTopics()
Import event typics after creation.
Definition: View.cpp:284
dd4hep::View::ConfigureEventFromInfo
virtual void ConfigureEventFromInfo()
Configure a view with event info. Used configuration if present.
Definition: View.cpp:230
dd4hep::View::ConfigureEventFromGlobal
virtual void ConfigureEventFromGlobal()
Configure an event view by default from the global event scene.
Definition: View.cpp:237
dd4hep::View::m_geoScene
TEveScene * m_geoScene
Reference to the geometry scene.
Definition: View.h:53
dd4hep::View::viewer
TEveViewer * viewer() const
Access to the Eve viewer.
Definition: View.h:84
dd4hep::View::ImportGeoTopics
virtual void ImportGeoTopics(const std::string &title)
Call to import geometry topics. If title is empty, do not add to global item list.
Definition: View.cpp:205
dd4hep::DisplayConfiguration::ViewConfig
View configuration.
Definition: DisplayConfiguration.h:119
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::View::m_global
TEveElementList * m_global
Reference to the global item (if added.
Definition: View.h:57
dd4hep::View::m_view
TEveViewer * m_view
Reference to the view.
Definition: View.h:51
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::showGlobal
bool showGlobal() const
Show global directory.
Definition: View.h:86
dd4hep::View
class View View.h DDEve/View.h
Definition: View.h:45
dd4hep::View::m_eveScene
TEveScene * m_eveScene
Reference to the event scene.
Definition: View.h:55
dd4hep::View::m_eveTopics
Topics m_eveTopics
Definition: View.h:64
dd4hep::View::m_showGlobal
bool m_showGlobal
Definition: View.h:65
dd4hep::View::ImportGeo
virtual void ImportGeo(const std::string &topic, TEveElement *element)
Call to import geometry elements into topics.
Definition: View.cpp:215
dd4hep::View::ConfigureEvent
virtual void ConfigureEvent(const DisplayConfiguration::ViewConfig &config)
Configure a single event scene view.
Definition: View.cpp:244