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
Display.h
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 #ifndef DD4HEP_DDEVE_DISPLAY_H
15 #define DD4HEP_DDEVE_DISPLAY_H
16 
17 // Framework include files
18 #include "DD4hep/LCDD.h"
19 #include "DD4hep/Printout.h"
20 #include "DDEve/PopupMenu.h"
21 #include "DDEve/EventHandler.h"
23 
24 // C/C++ include files
25 #include <set>
26 
27 // Forward declarations
28 class TEveCalo3D;
29 class TEveCaloDataHist;
30 class TEveElementList;
31 class TEveManager;
32 class TEveElement;
33 class TEveCaloViz;
34 class TGMenuBar;
35 class TGClient;
36 class TFile;
37 
39 namespace DD4hep {
40 
41  // Forward declarations
42  class View;
43  class ViewMenu;
44  class DD4hepMenu;
45  class EventHandler;
46  class ViewConfiguration;
47  class CalodataConfiguration;
48  class GenericEventHandler;
49  class DisplayConfiguration;
50 
52  /*
53  * \author M.Frank
54  * \version 1.0
55  * \ingroup DD4HEP_EVE
56  */
57  class Display : public EventConsumer {
58  public:
61  typedef std::set<View*> Views;
62  typedef std::set<DisplayConfiguration*> Configurations;
63  typedef std::set<PopupMenu*> Menus;
64  typedef std::map<std::string, TEveElementList*> Topics;
65  typedef std::map<std::string, ViewConfig> ViewConfigurations;
66  typedef std::map<std::string, DataConfig> DataConfigurations;
67 
68  struct CalodataContext {
69  int slice;
70  TEveCalo3D* calo3D;
71  TEveCaloViz* caloViz;
72  TEveCaloDataHist* eveHist;
77  };
78  typedef std::map<std::string, CalodataContext> Calodata;
79 
80  protected:
82  TEveManager* m_eve;
105  std::string m_eventHandlerName;
106  public:
108  Display(TEveManager* eve);
110  virtual ~Display();
111 
113  Geometry::LCDD& lcdd() const;
115  TEveManager& manager() const { return *m_eve; }
119  void setVisLevel(int new_level) { m_visLevel = new_level; }
121  void setLoadLevel(int new_level) { m_loadLevel = new_level; }
123  void setEventHandlerName(std::string eventHandlerName) {m_eventHandlerName = eventHandlerName;}
125  std::string getEventHandlerName() {return m_eventHandlerName;}
126 
128  TGClient& client() const;
129 
131  void ChooseGeometry();
133  void LoadXML(const char* xmlFile);
135  void LoadGeometryRoot(const char* rootFile);
137  TFile* Open(const char* rootFile) const;
138 
141 
143  void MessageBox(PrintLevel level, const std::string& text, const std::string& title="") const;
144 
146  std::string OpenXmlFileDialog(const std::string& default_dir) const;
147 
149  std::string OpenEventFileDialog(const std::string& default_dir) const;
150 
152  void LoadGeoChildren(TEveElement* start, int levels, bool redraw);
154  void MakeNodesVisible(TEveElement* e, bool visible, int level);
155 
157  void ImportConfiguration(const DisplayConfiguration& config);
158 
160  const ViewConfig* GetViewConfiguration(const std::string& name) const;
162  const DataConfig* GetCalodataConfiguration(const std::string& name) const;
164  CalodataContext& GetCaloHistogram(const std::string& name);
165 
167  virtual void RegisterEvents(View* view);
169  virtual void UnregisterEvents(View* view);
170 
174  virtual TEveElementList& GetGeoTopic(const std::string& name);
176  virtual TEveElementList& GetGeoTopic(const std::string& name) const;
177 
179  void ImportGeo(TEveElement* el);
181  void ImportGeo(const std::string& topic, TEveElement* el);
182 
184  virtual TEveElementList& GetEveTopic(const std::string& name);
186  virtual TEveElementList& GetEveTopic(const std::string& name) const;
187 
189  void ImportEvent(TEveElement* el);
191  void ImportEvent(const std::string& topic, TEveElement* el);
192 
194  virtual void OnNewEvent(EventHandler* handler);
195 
197  virtual void BuildMenus(TGMenuBar* bar=0);
199  virtual void AddMenu(TGMenuBar* bar, PopupMenu* menu, int hints=kLHintsNormal);
200 
201  ClassDef(Display,0);
202  };
203 
204 
205 } /* End namespace DD4hep */
206 
207 
208 #endif /* DD4HEP_DDEVE_DISPLAY_H */
209 
DataConfigurations m_calodataConfigs
Definition: Display.h:96
std::map< std::string, TEveElementList * > Topics
Definition: Display.h:64
const ViewConfig * GetViewConfiguration(const std::string &name) const
Access a data filter by name. Data filters are used to customize views.
Definition: Display.cpp:268
Calodata m_calodata
Container with calorimeter data (projections)
Definition: Display.h:99
ViewMenu * m_viewMenu
Definition: Display.h:89
Topics m_eveTopics
Definition: Display.h:92
Views m_eveViews
Definition: Display.h:93
ViewConfigurations m_viewConfigs
Definition: Display.h:95
void LoadGeoChildren(TEveElement *start, int levels, bool redraw)
Load 'levels' Children into the geometry scene.
Definition: Display.cpp:533
TEveManager & manager() const
Access to the EVE manager.
Definition: Display.h:115
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:10
void ImportEvent(TEveElement *el)
Call to import top level event elements.
Definition: Display.cpp:528
DataConfigurations m_collectionsConfigs
Definition: Display.h:97
TEveCaloDataHist * eveHist
Definition: Display.h:72
ClassDef(Display, 0)
DD4hep Menu for the ROOT browser.
Definition: DD4hepMenu.h:38
void setVisLevel(int new_level)
Set Vis level in geo manager (either from XML or BEFORE XML file was loaded)
Definition: Display.h:119
DisplayConfiguration::Config DataConfig
Definition: Display.h:60
void setLoadLevel(int new_level)
Set Eve Geometry load level in manager (either from XML or BEFORE XML file was loaded) ...
Definition: Display.h:121
CalodataContext & GetCaloHistogram(const std::string &name)
Access to calo data histograms by name as defined in the configuration.
Definition: Display.cpp:217
Event handler base class. Interface to all DDEve I/O actions.
Definition: EventHandler.h:66
DisplayConfiguration::Config config
Definition: Display.h:73
virtual ~Display()
Default destructor.
Definition: Display.cpp:132
Geometry::LCDD & lcdd() const
Access to geometry hub.
Definition: Display.cpp:179
return e
Definition: Volumes.cpp:297
const ViewConfigurations & viewConfigurations() const
Access View configurations.
Definition: Display.h:117
PrintLevel
Definition: Printout.h:47
TEveManager * m_eve
Reference to TEve manager.
Definition: Display.h:82
virtual void UnregisterEvents(View *view)
Unregister from the main event scene.
Definition: Display.cpp:285
virtual void OnNewEvent(EventHandler *handler)
EventConsumer overload: Consumer event data.
Definition: Display.cpp:376
virtual TEveElementList & GetGeoTopic(const std::string &name)
Access/Create an geometry topic by name.
Definition: Display.cpp:471
const DataConfig * GetCalodataConfiguration(const std::string &name) const
Access a data filter by name. Data filters are used to customize views.
Definition: Display.cpp:274
Event handler base class. Interface to all DDEve I/O actions.
std::set< PopupMenu * > Menus
Definition: Display.h:63
TFile * Open(const char *rootFile) const
Open ROOT file.
Definition: Display.cpp:369
virtual void AddMenu(TGMenuBar *bar, PopupMenu *menu, int hints=kLHintsNormal)
Add new menu to the main menu bar.
Definition: Display.cpp:197
class View View.h DDEve/View.h
Definition: View.h:46
DisplayConfiguration DisplayConfiguration.h DDEve/DisplayConfiguration.h.
std::string getEventHandlerName()
Get Event Handler Plugin name.
Definition: Display.h:125
virtual void RegisterEvents(View *view)
Register to the main event scene on new events.
Definition: Display.cpp:280
void ChooseGeometry()
Load geometry with panel.
Definition: Display.cpp:174
GenericEventHandler * m_evtHandler
Reference to the event reader object.
Definition: Display.h:86
GenericEventHandler & eventHandler() const
Access to the event reader.
Definition: Display.cpp:189
void ImportGeo(TEveElement *el)
Call to import geometry elements.
Definition: Display.cpp:513
void LoadGeometryRoot(const char *rootFile)
Load geometry from compact xml file.
Definition: Display.cpp:169
std::string OpenXmlFileDialog(const std::string &default_dir) const
Popup XML file chooser. returns chosen file name; empty on cancel.
Definition: Display.cpp:313
std::map< std::string, ViewConfig > ViewConfigurations
Definition: Display.h:65
void MakeNodesVisible(TEveElement *e, bool visible, int level)
Make a set of nodes starting from a top element (in-)visible with a given depth.
Definition: Display.cpp:597
Topics m_geoTopics
Definition: Display.h:91
class PopupMenu PopupMenu.h DDEve/PopupMenu.h
Definition: PopupMenu.h:37
TEveElementList * m_geoGlobal
Definition: Display.h:87
std::map< std::string, DataConfig > DataConfigurations
Definition: Display.h:66
void setEventHandlerName(std::string eventHandlerName)
Set Event Handler Plugin name.
Definition: Display.h:123
void ImportConfiguration(const DisplayConfiguration &config)
Import configuration parameters.
Definition: Display.cpp:204
void LoadXML(const char *xmlFile)
Load geometry from compact xml file.
Definition: Display.cpp:152
virtual TEveElementList & GetEveTopic(const std::string &name)
Access/Create an event topic by name.
Definition: Display.cpp:492
static const double bar
Definition: DD4hepUnits.h:180
std::string OpenEventFileDialog(const std::string &default_dir) const
Popup ROOT file chooser. returns chosen file name; empty on cancel.
Definition: Display.cpp:334
void MessageBox(PrintLevel level, const std::string &text, const std::string &title="") const
Open standard message box.
Definition: Display.cpp:293
TEveElementList & GetGeo()
Access / Create global geometry element.
Definition: Display.cpp:462
int m_loadLevel
Load level for the eve geometry.
Definition: Display.h:103
class ViewMenu ViewMenu.h DDEve/ViewMenu.h
Definition: ViewMenu.h:37
TGClient & client() const
Access to X-client.
Definition: Display.cpp:184
The main interface to the DD4hep detector description package.
Definition: LCDD.h:82
std::set< DisplayConfiguration * > Configurations
Definition: Display.h:62
virtual void BuildMenus(TGMenuBar *bar=0)
Build the DDEve specific menues. Default bar is the ROOT browser's bar.
Definition: Display.cpp:354
Geometry::LCDD * m_lcdd
Reference to geometry hub.
Definition: Display.h:84
std::string m_eventHandlerName
Name of the event handler plugin.
Definition: Display.h:105
int m_visLevel
TGeoManager visualisation level.
Definition: Display.h:101
Display(TEveManager *eve)
Standard constructor.
Definition: Display.cpp:111
std::set< View * > Views
Definition: Display.h:61
The main class of the DDEve display.
Definition: Display.h:57
DisplayConfiguration::ViewConfig ViewConfig
Definition: Display.h:59
DD4hepMenu * m_dd4Menu
Definition: Display.h:90
CalodataContext & operator=(const CalodataContext &c)
Definition: Display.cpp:99
std::map< std::string, CalodataContext > Calodata
Definition: Display.h:78
Menus m_menus
Definition: Display.h:94
TEveElementList * m_eveGlobal
Definition: Display.h:88