DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Projection.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #include <DD4hep/Printout.h>
16 #include <DDEve/Projection.h>
17 #include <DDEve/Display.h>
18 #include <DDEve/Utilities.h>
19 
20 // Eve include files
21 #include <TEveManager.h>
22 #include <TEveBrowser.h>
23 #include <TEveWindow.h>
24 #include <TGLViewer.h>
25 
26 using namespace dd4hep;
27 
29 Projection::Projection(Display* eve, const std::string& nam)
30  : View(eve, nam), m_projMgr(0), m_axis(0)
31 {
32 }
33 
36 }
37 
38 void Projection::SetDepth(Float_t d) {
39  // Set current depth on all projection managers.
40  m_projMgr->SetCurrentDepth(d);
41 }
42 
44 TEveElement* Projection::ImportGeoTopic(TEveElement*, TEveElementList*) {
45  return 0;
46 }
47 
49 TEveElement* Projection::ImportElement(TEveElement* el, TEveElementList* list) {
50  TEveElementList* unprojected = &GetGeoTopic("Unprojected");
51  for(Topics::iterator i=m_geoTopics.begin(); i!=m_geoTopics.end(); ++i) {
52  if ( el == unprojected ) {
53  m_projMgr->AddElement(el);
54  return 0;
55  }
56  }
57  TEveElement* e = m_projMgr->ImportElements(el, list);
58  printout(INFO,"Projection","ImportElement %s [%s] into list: %s Projectable:%s [%p]",
59  Utilities::GetName(el),el->IsA()->GetName(), list ? list->GetName() : "???",
60  dynamic_cast<TEveProjectable*>(list) ? "true" : "false", e);
61 
62  unprojected->AddElement(el);
63  if ( list != m_geoScene && list != m_eveScene ) {
64  TEveElement::List_ci ci = std::find(m_geoScene->BeginChildren(),m_geoScene->EndChildren(),list);
65  if ( ci == m_geoScene->EndChildren() ) {
66  m_geoScene->AddElement(list);
67  }
68  }
69  return e;
70 }
71 
73 TEveElement* Projection::ImportGeoElement(TEveElement* element, TEveElementList* list) {
74  return element ? ImportElement(element, list) : 0;
75 }
76 
78 TEveElement* Projection::ImportEventElement(TEveElement* element, TEveElementList* list) {
79  return element ? ImportElement(element, list) : 0;
80 }
81 
84  TEveProjectionAxes* a = new TEveProjectionAxes(m_projMgr);
85  a->SetMainColor(kWhite);
86  a->SetTitle("R-Phi");
87  a->SetTitleSize(0.05);
88  a->SetTitleFont(102);
89  a->SetLabelSize(0.025);
90  a->SetLabelFont(102);
91  m_geoScene->AddElement(a);
92  m_axis = a;
93  return *this;
94 }
95 
98  // RhoPhi Projection manager
99  m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
100  //m_ev.AddToListTree(m_projMgr, kFALSE);
101  AddToGlobalItems(name())->AddElement(m_projMgr);
102  return *this;
103 }
104 
107  // RhoZ Projection manager
108  m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
109  //m_eve->manager().AddToListTree(m_projMgr, kFALSE);
110  AddToGlobalItems(name())->AddElement(m_projMgr);
111  return *this;
112 }
113 
115 View& Projection::Map(TEveWindow* slot) {
116  View::Map(slot);
117  m_view->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
118  return *this;
119 }
dd4hep::Display
The main class of the DDEve display.
Definition: Display.h:56
dd4hep::Projection::ImportGeoTopic
virtual TEveElement * ImportGeoTopic(TEveElement *element, TEveElementList *list) override
Call an element to a geometry element list.
Definition: Projection.cpp:44
dd4hep::Projection::m_axis
TEveProjectionAxes * m_axis
Reference to the projection axis.
Definition: Projection.h:37
dd4hep::View::Map
virtual View & Map(TEveWindow *slot)
Map the view view to the slot.
Definition: View.cpp:334
dd4hep::Projection::ImportEventElement
virtual TEveElement * ImportEventElement(TEveElement *element, TEveElementList *list) override
Call an element to a event element list.
Definition: Projection.cpp:78
dd4hep::Projection::AddAxis
virtual Projection & AddAxis()
Add projection axis to the view.
Definition: Projection.cpp:83
dd4hep::Projection
class Projection Projection.h DDEve/Projection.h
Definition: Projection.h:32
Utilities.h
TEveElementList
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:13
dd4hep::View::GetGeoTopic
virtual TEveElementList & GetGeoTopic(const std::string &name)
Access/Create an geometry topic by name.
Definition: View.cpp:295
dd4hep::View::name
const std::string & name() const
Access to the view name/title.
Definition: View.h:81
dd4hep::Utilities::GetName
const char * GetName(T *p)
Definition: Utilities.h:45
dd4hep::View::AddToGlobalItems
virtual TEveElementList * AddToGlobalItems(const std::string &nam)
Add the view to the global list of eve objects.
Definition: View.cpp:81
dd4hep::View::m_geoTopics
Topics m_geoTopics
Definition: View.h:63
slot
View TEveWindowSlot * slot
Definition: MultiView.cpp:28
Display.h
dd4hep::Projection::ImportGeoElement
virtual TEveElement * ImportGeoElement(TEveElement *element, TEveElementList *list) override
Call an element to a geometry element list.
Definition: Projection.cpp:73
dd4hep::View::m_geoScene
TEveScene * m_geoScene
Reference to the geometry scene.
Definition: View.h:53
dd4hep::Projection::~Projection
virtual ~Projection()
Default destructor.
Definition: Projection.cpp:35
dd4hep::Projection::SetDepth
virtual void SetDepth(Float_t d)
Definition: Projection.cpp:38
dd4hep::Projection::ImportElement
virtual TEveElement * ImportElement(TEveElement *el, TEveElementList *list)
Call an element to a event element list.
Definition: Projection.cpp:49
dd4hep::Projection::Map
virtual View & Map(TEveWindow *slot) override
Map the projection view to the slot.
Definition: Projection.cpp:115
dd4hep::View::m_view
TEveViewer * m_view
Reference to the view.
Definition: View.h:51
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Projection::CreateRhoPhiProjection
virtual Projection & CreateRhoPhiProjection()
Create Rho-Phi projection.
Definition: Projection.cpp:97
dd4hep::View
class View View.h DDEve/View.h
Definition: View.h:45
dd4hep::Projection::m_projMgr
TEveProjectionManager * m_projMgr
Reference to the projection manager.
Definition: Projection.h:35
Projection.h
dd4hep::View::m_eveScene
TEveScene * m_eveScene
Reference to the event scene.
Definition: View.h:55
dd4hep::Projection::Projection
Projection(Display *eve, const std::string &name)
Initializing constructor.
Definition: Projection.cpp:29
Printout.h
dd4hep::Projection::CreateRhoZProjection
virtual Projection & CreateRhoZProjection()
Create Rho-Z projection.
Definition: Projection.cpp:106