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
Projection.cpp
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 
15 // Framework include files
16 #include "DD4hep/Printout.h"
17 #include "DDEve/Projection.h"
18 #include "DDEve/Display.h"
19 #include "DDEve/Utilities.h"
20 
21 // Eve include files
22 #include <TEveManager.h>
23 #include <TEveBrowser.h>
24 #include <TEveWindow.h>
25 #include <TGLViewer.h>
26 
27 using namespace std;
28 using namespace DD4hep;
29 
31 Projection::Projection(Display* eve, const string& nam)
32  : View(eve, nam), m_projMgr(0), m_axis(0)
33 {
34 }
35 
38 }
39 
40 void Projection::SetDepth(Float_t d) {
41  // Set current depth on all projection managers.
42  m_projMgr->SetCurrentDepth(d);
43 }
44 
46 TEveElement* Projection::ImportGeoTopic(TEveElement*, TEveElementList*) {
47  return 0;
48 }
49 
51 TEveElement* Projection::ImportElement(TEveElement* el, TEveElementList* list) {
52  TEveElementList* unprojected = &GetGeoTopic("Unprojected");
53  for(Topics::iterator i=m_geoTopics.begin(); i!=m_geoTopics.end(); ++i) {
54  if ( el == unprojected ) {
55  m_projMgr->AddElement(el);
56  return 0;
57  }
58  }
59  TEveElement* e = m_projMgr->ImportElements(el, list);
60  printout(INFO,"Projection","ImportElement %s [%s] into list: %s Projectable:%s [%p]",
61  Utilities::GetName(el),el->IsA()->GetName(),list->GetName(),
62  dynamic_cast<TEveProjectable*>(list) ? "true" : "false", e);
63 
64  unprojected->AddElement(el);
65  if ( list != m_geoScene && list != m_eveScene ) {
66  TEveElement::List_ci ci = std::find(m_geoScene->BeginChildren(),m_geoScene->EndChildren(),list);
67  if ( ci == m_geoScene->EndChildren() ) {
68  m_geoScene->AddElement(list);
69  }
70  }
71  return e;
72 }
73 
75 TEveElement* Projection::ImportGeoElement(TEveElement* element, TEveElementList* list) {
76  return element ? ImportElement(element, list) : 0;
77 }
78 
80 TEveElement* Projection::ImportEventElement(TEveElement* element, TEveElementList* list) {
81  return element ? ImportElement(element, list) : 0;
82 }
83 
86  TEveProjectionAxes* a = new TEveProjectionAxes(m_projMgr);
87  a->SetMainColor(kWhite);
88  a->SetTitle("R-Phi");
89  a->SetTitleSize(0.05);
90  a->SetTitleFont(102);
91  a->SetLabelSize(0.025);
92  a->SetLabelFont(102);
93  m_geoScene->AddElement(a);
94  m_axis = a;
95  return *this;
96 }
97 
100  // RhoPhi Projection manager
101  m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
102  //m_ev.AddToListTree(m_projMgr, kFALSE);
103  AddToGlobalItems(name())->AddElement(m_projMgr);
104  return *this;
105 }
106 
109  // RhoZ Projection manager
110  m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
111  //m_eve->manager().AddToListTree(m_projMgr, kFALSE);
112  AddToGlobalItems(name())->AddElement(m_projMgr);
113  return *this;
114 }
115 
117 View& Projection::Map(TEveWindow* slot) {
118  View::Map(slot);
119  m_view->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
120  return *this;
121 }
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:10
virtual TEveElement * ImportGeoElement(TEveElement *element, TEveElementList *list)
Call an element to a geometry element list.
Definition: Projection.cpp:75
Topics m_geoTopics
Definition: View.h:67
virtual TEveElementList & GetGeoTopic(const std::string &name)
Access/Create an geometry topic by name.
Definition: View.cpp:296
virtual View & Map(TEveWindow *slot)
Map the view view to the slot.
Definition: View.cpp:335
return e
Definition: Volumes.cpp:297
View TEveWindowSlot * slot
Definition: MultiView.cpp:30
virtual Projection & AddAxis()
Add projection axis to the view.
Definition: Projection.cpp:85
TEveScene * m_eveScene
Reference to the event scene.
Definition: View.h:59
TEveProjectionAxes * m_axis
Reference to the projection axis.
Definition: Projection.h:38
virtual TEveElement * ImportElement(TEveElement *el, TEveElementList *list)
Call an element to a event element list.
Definition: Projection.cpp:51
virtual ~Projection()
Default destructor.
Definition: Projection.cpp:37
virtual void SetDepth(Float_t d)
Definition: Projection.cpp:40
TEveViewer * m_view
Reference to the view.
Definition: View.h:55
virtual TEveElementList * AddToGlobalItems(const std::string &nam)
Add the view to the global list of eve objects.
Definition: View.cpp:83
const char * GetName(T *p)
Definition: Utilities.h:45
class View View.h DDEve/View.h
Definition: View.h:46
class Projection Projection.h DDEve/Projection.h
Definition: Projection.h:33
virtual TEveElement * ImportEventElement(TEveElement *element, TEveElementList *list)
Call an element to a event element list.
Definition: Projection.cpp:80
virtual Projection & CreateRhoZProjection()
Create Rho-Z projection.
Definition: Projection.cpp:108
TEveProjectionManager * m_projMgr
Reference to the projection manager.
Definition: Projection.h:36
static T::const_iterator find(const T &c, const string &s)
Definition: View.cpp:34
virtual View & Map(TEveWindow *slot)
Map the projection view to the slot.
Definition: Projection.cpp:117
TEveScene * m_geoScene
Reference to the geometry scene.
Definition: View.h:57
virtual TEveElement * ImportGeoTopic(TEveElement *element, TEveElementList *list)
Call an element to a geometry element list.
Definition: Projection.cpp:46
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Definition: Printout.cpp:111
virtual Projection & CreateRhoPhiProjection()
Create Rho-Phi projection.
Definition: Projection.cpp:99
The main class of the DDEve display.
Definition: Display.h:57
const std::string & name() const
Access to the view name/title.
Definition: View.h:85