File indexing completed on 2025-01-18 09:55:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDEVE_DISPLAY_H
0014 #define DDEVE_DISPLAY_H
0015
0016
0017 #include "DD4hep/Detector.h"
0018 #include "DD4hep/Printout.h"
0019 #include "DDEve/PopupMenu.h"
0020 #include "DDEve/EventHandler.h"
0021 #include "DDEve/DisplayConfiguration.h"
0022
0023
0024 #include <set>
0025
0026
0027 class TEveCalo3D;
0028 class TEveCaloDataHist;
0029 class TEveElementList;
0030 class TEveManager;
0031 class TEveElement;
0032 class TEveCaloViz;
0033 class TGMenuBar;
0034 class TGClient;
0035 class TFile;
0036
0037
0038 namespace dd4hep {
0039
0040
0041 class View;
0042 class ViewMenu;
0043 class DD4hepMenu;
0044 class EventHandler;
0045 class ViewConfiguration;
0046 class CalodataConfiguration;
0047 class GenericEventHandler;
0048 class DisplayConfiguration;
0049
0050
0051
0052
0053
0054
0055
0056 class Display : public EventConsumer {
0057 public:
0058 typedef DisplayConfiguration::ViewConfig ViewConfig;
0059 typedef DisplayConfiguration::Config DataConfig;
0060 typedef std::set<View*> Views;
0061 typedef std::set<DisplayConfiguration*> Configurations;
0062 typedef std::set<PopupMenu*> Menus;
0063 typedef std::map<std::string, TEveElementList*> Topics;
0064 typedef std::map<std::string, ViewConfig> ViewConfigurations;
0065 typedef std::map<std::string, DataConfig> DataConfigurations;
0066
0067
0068 struct CalodataContext {
0069 int slice = 0;
0070 TEveCalo3D* calo3D = 0;
0071 TEveCaloViz* caloViz = 0;
0072 TEveCaloDataHist* eveHist = 0;
0073 DisplayConfiguration::Config config;
0074
0075 CalodataContext() = default;
0076
0077 CalodataContext(const CalodataContext& c) = default;
0078
0079 CalodataContext& operator=(const CalodataContext& c) = default;
0080 };
0081
0082 typedef std::map<std::string, CalodataContext> Calodata;
0083
0084 protected:
0085
0086 TEveManager* m_eve = 0;
0087
0088 Detector* m_detDesc = 0;
0089
0090 GenericEventHandler* m_evtHandler = 0;
0091
0092 TEveElementList* m_geoGlobal = 0;
0093
0094 TEveElementList* m_eveGlobal = 0;
0095
0096 ViewMenu* m_viewMenu;
0097
0098 DD4hepMenu* m_dd4Menu;
0099
0100 Topics m_geoTopics;
0101
0102 Topics m_eveTopics;
0103
0104 Views m_eveViews;
0105
0106 Menus m_menus;
0107
0108 ViewConfigurations m_viewConfigs;
0109
0110 DataConfigurations m_calodataConfigs;
0111
0112 DataConfigurations m_collectionsConfigs;
0113
0114 Calodata m_calodata;
0115
0116 int m_visLevel;
0117
0118 int m_loadLevel;
0119
0120 std::string m_eventHandlerName;
0121
0122 public:
0123
0124 Display(TEveManager* eve);
0125
0126 virtual ~Display();
0127
0128
0129 Detector& detectorDescription() const;
0130
0131 TEveManager& manager() const { return *m_eve; }
0132
0133 const ViewConfigurations& viewConfigurations() const { return m_viewConfigs; }
0134
0135 void setVisLevel(int new_level) { m_visLevel = new_level; }
0136
0137 void setLoadLevel(int new_level) { m_loadLevel = new_level; }
0138
0139 std::string getEventHandlerName() { return m_eventHandlerName; }
0140
0141 void setEventHandlerName(const std::string& nam) { m_eventHandlerName = nam; }
0142
0143
0144 TGClient& client() const;
0145
0146
0147 void ChooseGeometry();
0148
0149 void LoadXML(const char* xmlFile);
0150
0151 void LoadGeometryRoot(const char* rootFile);
0152
0153 TFile* Open(const char* rootFile) const;
0154
0155
0156 GenericEventHandler& eventHandler() const;
0157
0158
0159 void MessageBox(PrintLevel level, const std::string& text, const std::string& title="") const;
0160
0161
0162 std::string OpenXmlFileDialog(const std::string& default_dir) const;
0163
0164
0165 std::string OpenEventFileDialog(const std::string& default_dir) const;
0166
0167
0168 void LoadGeoChildren(TEveElement* start, int levels, bool redraw);
0169
0170 void MakeNodesVisible(TEveElement* e, bool visible, int level);
0171
0172
0173 void ImportConfiguration(const DisplayConfiguration& config);
0174
0175
0176 const ViewConfig* GetViewConfiguration(const std::string& name) const;
0177
0178 const DataConfig* GetCalodataConfiguration(const std::string& name) const;
0179
0180 CalodataContext& GetCaloHistogram(const std::string& name);
0181
0182
0183 virtual void RegisterEvents(View* view);
0184
0185 virtual void UnregisterEvents(View* view);
0186
0187
0188 TEveElementList& GetGeo();
0189
0190 virtual TEveElementList& GetGeoTopic(const std::string& name);
0191
0192 virtual TEveElementList& GetGeoTopic(const std::string& name) const;
0193
0194
0195 void ImportGeo(TEveElement* el);
0196
0197 void ImportGeo(const std::string& topic, TEveElement* el);
0198
0199
0200 virtual TEveElementList& GetEveTopic(const std::string& name);
0201
0202 virtual TEveElementList& GetEveTopic(const std::string& name) const;
0203
0204
0205 void ImportEvent(TEveElement* el);
0206
0207 void ImportEvent(const std::string& topic, TEveElement* el);
0208
0209
0210 virtual void OnFileOpen(EventHandler& handler) override;
0211
0212 virtual void OnNewEvent(EventHandler& handler) override;
0213
0214
0215 virtual void BuildMenus(TGMenuBar* menuBar=0);
0216
0217 virtual void AddMenu(TGMenuBar* menuBar, PopupMenu* menu, int hints=kLHintsNormal);
0218
0219 ClassDefOverride(Display,0);
0220 };
0221 }
0222 #endif
0223