Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:22

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 #ifndef DDEVE_VIEW_H
0014 #define DDEVE_VIEW_H
0015 
0016 // Framework include files
0017 #include "DD4hep/Detector.h"
0018 #include "DDEve/DisplayConfiguration.h"
0019 
0020 // Eve include files
0021 #include <TEveScene.h>
0022 #include <TEveViewer.h>
0023 
0024 // C/C++ include files
0025 #include <map>
0026 #include <string>
0027 
0028 // Forward declarations
0029 class TEveManager;
0030 class TEveElementList;
0031 
0032 /// Namespace for the AIDA detector description toolkit
0033 namespace dd4hep {
0034 
0035   // Forward declarations
0036   class Display;
0037   class EventHandler;
0038 
0039   /// class View  View.h DDEve/View.h
0040   /*
0041    *  \author  M.Frank
0042    *  \version 1.0
0043    *  \ingroup DD4HEP_EVE
0044    */
0045   class View   {
0046   public:
0047     typedef std::map<std::string, TEveElementList*> Topics;
0048   protected:
0049     Display               *m_eve;
0050     /// Reference to the view
0051     TEveViewer            *m_view;
0052     /// Reference to the geometry scene
0053     TEveScene             *m_geoScene;
0054     /// Reference to the event scene
0055     TEveScene             *m_eveScene;
0056     /// Reference to the global item (if added
0057     TEveElementList       *m_global;
0058     const DisplayConfiguration::ViewConfig* m_config;
0059 
0060     /// The name of the view
0061     std::string            m_name;
0062 
0063     Topics m_geoTopics;
0064     Topics m_eveTopics;
0065     bool m_showGlobal;
0066 
0067   public:
0068     /// Call an element to a geometry element list
0069     virtual TEveElement* ImportGeoElement(TEveElement* element, TEveElementList* list);
0070     /// Call an element to a geometry element list
0071     virtual TEveElement* ImportGeoTopic(TEveElement* element, TEveElementList* list);
0072     /// Call an element to a event element list
0073     virtual TEveElement* ImportEventElement(TEveElement* element, TEveElementList* list);
0074 
0075   public:
0076     /// Initializing constructor
0077     View(Display* eve, const std::string& name);
0078     /// Default destructor
0079     virtual ~View();
0080     /// Access to the view name/title
0081     const std::string& name()  const { return m_name;         }
0082     const char* c_name() const       { return m_name.c_str(); }
0083     /// Access to the Eve viewer
0084     TEveViewer* viewer()  const      { return m_view;         }
0085     /// Show global directory
0086     bool showGlobal() const          { return m_showGlobal;   }
0087     /// Set show globals
0088     void setShowGlobal(bool value)   { m_showGlobal = value;  }
0089     /// Build the view view and map it to the given slot
0090     virtual View& Build(TEveWindow* slot);
0091     /// Initialize the view port
0092     virtual void Initialize();
0093     /// Map the view view to the slot
0094     virtual View& Map(TEveWindow* slot);
0095 
0096     /// Create the geometry and the event scene
0097     virtual View& CreateScenes();
0098     /// Add the view to the global list of eve objects
0099     virtual TEveElementList* AddToGlobalItems(const std::string& nam);
0100 
0101     /** Manipulation of the geometry scene */
0102 
0103     /// Access to the Eve geometry scene
0104     TEveScene* geoScene() const {   return m_geoScene; }
0105     /// Create the geometry scene
0106     virtual View& CreateGeoScene();
0107 
0108     /// Configure a view with geo info. Used configuration if present.
0109     virtual void ConfigureGeometryFromInfo();
0110     /// Configure a single geometry view by default from the global geometry scene with all subdetectors
0111     virtual void ConfigureGeometryFromGlobal();
0112     /// Configure a single geometry view
0113     virtual void ConfigureGeometry(const DisplayConfiguration::ViewConfig& config);
0114 
0115     /// Create a new instance of the geometry of a sub-detector
0116     virtual std::pair<bool,TEveElement*> 
0117     CreateGeometry(DetElement de, const DisplayConfiguration::Config& cfg);
0118     /// Access the global instance of the subdetector geometry
0119     virtual std::pair<bool,TEveElement*> 
0120     GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config& cfg);
0121 
0122 
0123     /// Call to import geometry elements into topics
0124     virtual void ImportGeo(const std::string& topic, TEveElement* element);
0125     /// Call to import geometry elements into topics
0126     virtual void ImportGeo(TEveElementList& topic, TEveElement* element);
0127     /// Call to import geometry elements into the main geometry  scene menu
0128     virtual void ImportGeo(TEveElement* element);
0129     /// Call to import geometry topics. If title is empty, do not add to global item list
0130     virtual void ImportGeoTopics(const std::string& title);
0131     /// Access/Create an geometry topic by name
0132     virtual TEveElementList& GetGeoTopic(const std::string& name);
0133 
0134 
0135     /** Manipulation of the event scene */
0136 
0137     /// Access to the Eve event scene
0138     TEveScene* eveScene() const {   return m_eveScene; }
0139     /// Create the event scene
0140     virtual View& CreateEventScene();
0141     /// Configure a view with event info. Used configuration if present.
0142     virtual void ConfigureEventFromInfo();
0143     /// Configure an event view by default from the global event scene
0144     virtual void ConfigureEventFromGlobal();
0145     /// Configure a single event scene view
0146     virtual void ConfigureEvent(const DisplayConfiguration::ViewConfig& config);
0147     /// Call to import event elements into the main event scene
0148     virtual void ImportEvent(TEveElement* element);
0149     /// Import event typics after creation
0150     virtual void ImportEventTopics();
0151 
0152     /// Root implementation macro
0153     ClassDef(View,0);
0154   };
0155 }      /* End namespace dd4hep   */
0156 #endif // DDEVE_VIEW_H