25 #include <TEveManager.h>
26 #include <TEveWindow.h>
28 #include <TGLViewer.h>
31 using namespace DD4hep;
34 static inline typename T::const_iterator
find(
const T& c,
const string&
s) {
35 for(
typename T::const_iterator i=c.begin(); i!=c.end(); ++i)
36 if ( (*i).name == s )
return i;
41 View::View(
Display* eve,
const string& nam)
42 : m_eve(eve), m_view(0), m_geoScene(0), m_eveScene(0), m_global(0), m_name(nam), m_showGlobal(false)
52 (*i).second->DestroyElements();
68 if ( evt ) evt->Repaint(kTRUE);
69 if ( geo ) geo->Repaint(kTRUE);
71 TGLViewer* glv =
viewer()->GetGLViewer();
72 glv->PostSceneBuildSetup(kTRUE);
73 glv->SetSmartRefresh(kFALSE);
75 glv->UseLightColorSet();
77 glv->UseDarkColorSet();
78 glv->RequestDraw(TGLRnrCtx::kLODHigh);
79 glv->SetSmartRefresh(kTRUE);
95 TEveScene*
s =
dynamic_cast<TEveScene*
>(el);
97 printf(
"ERROR: Adding a Scene [%s] to a list. This is BAD and causes crashes!\n",s->GetName());
99 if ( el ) list->AddElement(el);
110 TEveScene*
s =
dynamic_cast<TEveScene*
>(el);
112 printf(
"ERROR: Adding a Scene [%s] to a list. This is BAD and causes crashes!\n",s->GetName());
115 printout(
INFO,
"View",
"ImportElement %s [%s] into list: %s",
117 list->AddElement(el);
123 pair<bool,TEveElement*>
127 TEveElement* elt = global.FindChild(de.
name());
128 return pair<bool,TEveElement*>(
true,elt);
132 pair<bool,TEveElement*>
150 for(TEveElementList::List_i i=l->BeginChildren(); i!=l->EndChildren(); ++i)
155 for(TEveElementList::List_i i=l->BeginChildren(); i!=l->EndChildren(); ++i)
162 DisplayConfiguration::Configurations::const_iterator ic;
167 string nam = cfg.
name;
168 if ( nam ==
"global" ) {
178 Color_t col = ctx.
calo3D->GetDataSliceColor(ctx.
slice);
180 legend_y += a->GetTextSize();
181 dets += nam +
"(Calo3D) ";
184 DetElement::Children::const_iterator i = c.find(nam);
185 if ( i != c.end() ) {
189 pair<bool,TEveElement*>
e(
false,0);
194 if ( e.first && e.second ) {
197 dets += nam +
"(Geo) ";
202 printout(
INFO,
"ViewConfiguration",
"+++ Detectors:%s", dets.c_str());
209 printout(
INFO,
"ViewConfiguration",
"+++ Add topic %s",(*i).second->GetName());
240 for(TEveElementList::List_i i=l->BeginChildren(); i!=l->EndChildren(); ++i)
248 DisplayConfiguration::Configurations::const_iterator ic;
251 string nam = cfg.
name;
252 if ( nam ==
"global" ) {
261 TEveElement* child =
m_eve->
manager().GetEventScene()->FindChild(nam);
268 DetElement::Children::const_iterator i = c.find(nam);
274 TEveElement* child =
m_eve->
manager().GetEventScene()->FindChild(coll);
275 printout(
INFO,
"View",
"+++ Add detector event %s collection:%s data:%p scene:%p",
303 return *((*i).second);
317 string nam =
m_name+
" - Event Data";
318 string tool =
m_name+
" - Scene holding projected event-data for the view.";
327 string nam =
m_name+
" - Geometry";
328 string tool =
m_name+
" - Scene holding projected geometry for the view.";
Handle class to hold the information of a sensitive detector.
const ViewConfig * GetViewConfiguration(const std::string &name) const
Access a data filter by name. Data filters are used to customize views.
virtual DetElement world() const =0
Return reference to the top-most (world) detector element.
TEveManager & manager() const
Access to the EVE manager.
const char * name() const
Access the object name (or "" if not supported by the object)
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
TEveScene * geoScene() const
Access to the Eve geometry scene.
bool isValid() const
Check the validity of the object held by the handle.
virtual TEveElement * ImportEventElement(TEveElement *element, TEveElementList *list)
Call an element to a event element list.
std::string m_name
The name of the view.
Configurations subdetectors
virtual void ImportEvent(TEveElement *element)
Call to import event elements into the main event scene.
std::pair< bool, TEveElement * > LoadDetElement(Geometry::DetElement element, int levels, TEveElement *parent)
static void decrement(T *)
Decrement count according to type information.
virtual TEveElementList & GetGeoTopic(const std::string &name)
Access/Create an geometry topic by name.
CalodataContext & GetCaloHistogram(const std::string &name)
Access to calo data histograms by name as defined in the configuration.
Local implementation with overrides of the TEveElementList.
virtual void ConfigureEventFromInfo()
Configure a view with event info. Used configuration if present.
DisplayConfiguration::Config config
virtual void ImportGeoTopics(const std::string &title)
Call to import geometry topics. If title is empty, do not add to global item list.
const Children & children() const
Access to the list of children.
Geometry::LCDD & lcdd() const
Access to geometry hub.
virtual View & Map(TEveWindow *slot)
Map the view view to the slot.
virtual SensitiveDetector sensitiveDetector(const std::string &name) const =0
Retrieve a sensitive detector by it's name from the detector description.
static float DefaultMargin()
Default margin for placement in bottom left corner.
virtual std::pair< bool, TEveElement * > GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config &cfg)
Access the global instance of the subdetector geometry.
virtual void ImportGeo(const std::string &topic, TEveElement *element)
Call to import geometry elements into topics.
union DD4hep::DisplayConfiguration::Config::Values data
virtual void UnregisterEvents(View *view)
Unregister from the main event scene.
virtual void ConfigureGeometryFromInfo()
Configure a view with geo info. Used configuration if present.
View TEveWindowSlot * slot
const DisplayConfiguration::ViewConfig * m_config
virtual TEveElementList & GetGeoTopic(const std::string &name)
Access/Create an geometry topic by name.
TEveScene * m_eveScene
Reference to the event scene.
TEveViewer * m_view
Reference to the view.
virtual std::pair< bool, TEveElement * > CreateGeometry(DetElement de, const DisplayConfiguration::Config &cfg)
Create a new instance of the geometry of a sub-detector.
virtual TEveElementList * AddToGlobalItems(const std::string &nam)
Add the view to the global list of eve objects.
const char * GetName(T *p)
virtual void ConfigureGeometryFromGlobal()
Configure a single geometry view by default from the global geometry scene with all subdetectors...
class View View.h DDEve/View.h
virtual ~View()
Default destructor.
const char * c_name() const
static T::const_iterator find(const T &c, const string &s)
TEveScene * m_geoScene
Reference to the geometry scene.
virtual void ImportEventTopics()
Import event typics after creation.
TEveScene * eveScene() const
Access to the Eve event scene.
virtual View & CreateGeoScene()
Create the geometry scene.
TEveElementList * m_global
Reference to the global item (if added.
virtual View & Build(TEveWindow *slot)
Build the view view and map it to the given slot.
virtual View & CreateScenes()
Create the geometry and the event scene.
virtual TEveElement * ImportGeoTopic(TEveElement *element, TEveElementList *list)
Call an element to a geometry element list.
virtual void Initialize()
Initialize the view port.
static void increment(T *)
Increment count according to type information.
static float DefaultTextSize()
Default text size.
Handle class describing a detector element.
virtual void ConfigureEvent(const DisplayConfiguration::ViewConfig &config)
Configure a single event scene view.
Readout readout() const
Access readout structure of the sensitive detector.
TEveViewer * viewer() const
Access to the Eve viewer.
virtual void ConfigureGeometry(const DisplayConfiguration::ViewConfig &config)
Configure a single geometry view.
virtual View & CreateEventScene()
Create the event scene.
std::map< std::string, DetElement > Children
virtual TEveElement * ImportGeoElement(TEveElement *element, TEveElementList *list)
Call an element to a geometry element list.
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
virtual void ConfigureEventFromGlobal()
Configure an event view by default from the global event scene.
The main class of the DDEve display.
const std::string & name() const
Access to the view name/title.
Class to add annotations to eve viewers.