File indexing completed on 2025-01-18 09:14:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/Printout.h>
0016 #include <DDEve/Projection.h>
0017 #include <DDEve/Display.h>
0018 #include <DDEve/Utilities.h>
0019
0020
0021 #include <TEveManager.h>
0022 #include <TEveBrowser.h>
0023 #include <TEveWindow.h>
0024 #include <TGLViewer.h>
0025
0026 using namespace dd4hep;
0027
0028
0029 Projection::Projection(Display* eve, const std::string& nam)
0030 : View(eve, nam), m_projMgr(0), m_axis(0)
0031 {
0032 }
0033
0034
0035 Projection::~Projection() {
0036 }
0037
0038 void Projection::SetDepth(Float_t d) {
0039
0040 m_projMgr->SetCurrentDepth(d);
0041 }
0042
0043
0044 TEveElement* Projection::ImportGeoTopic(TEveElement*, TEveElementList*) {
0045 return 0;
0046 }
0047
0048
0049 TEveElement* Projection::ImportElement(TEveElement* el, TEveElementList* list) {
0050 TEveElementList* unprojected = &GetGeoTopic("Unprojected");
0051 for(Topics::iterator i=m_geoTopics.begin(); i!=m_geoTopics.end(); ++i) {
0052 if ( el == unprojected ) {
0053 m_projMgr->AddElement(el);
0054 return 0;
0055 }
0056 }
0057 TEveElement* e = m_projMgr->ImportElements(el, list);
0058 printout(INFO,"Projection","ImportElement %s [%s] into list: %s Projectable:%s [%p]",
0059 Utilities::GetName(el),el->IsA()->GetName(), list ? list->GetName() : "???",
0060 dynamic_cast<TEveProjectable*>(list) ? "true" : "false", e);
0061
0062 unprojected->AddElement(el);
0063 if ( list != m_geoScene && list != m_eveScene ) {
0064 TEveElement::List_ci ci = std::find(m_geoScene->BeginChildren(),m_geoScene->EndChildren(),list);
0065 if ( ci == m_geoScene->EndChildren() ) {
0066 m_geoScene->AddElement(list);
0067 }
0068 }
0069 return e;
0070 }
0071
0072
0073 TEveElement* Projection::ImportGeoElement(TEveElement* element, TEveElementList* list) {
0074 return element ? ImportElement(element, list) : 0;
0075 }
0076
0077
0078 TEveElement* Projection::ImportEventElement(TEveElement* element, TEveElementList* list) {
0079 return element ? ImportElement(element, list) : 0;
0080 }
0081
0082
0083 Projection& Projection::AddAxis() {
0084 TEveProjectionAxes* a = new TEveProjectionAxes(m_projMgr);
0085 a->SetMainColor(kWhite);
0086 a->SetTitle("R-Phi");
0087 a->SetTitleSize(0.05);
0088 a->SetTitleFont(102);
0089 a->SetLabelSize(0.025);
0090 a->SetLabelFont(102);
0091 m_geoScene->AddElement(a);
0092 m_axis = a;
0093 return *this;
0094 }
0095
0096
0097 Projection& Projection::CreateRhoPhiProjection() {
0098
0099 m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
0100
0101 AddToGlobalItems(name())->AddElement(m_projMgr);
0102 return *this;
0103 }
0104
0105
0106 Projection& Projection::CreateRhoZProjection() {
0107
0108 m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
0109
0110 AddToGlobalItems(name())->AddElement(m_projMgr);
0111 return *this;
0112 }
0113
0114
0115 View& Projection::Map(TEveWindow* slot) {
0116 View::Map(slot);
0117 m_view->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
0118 return *this;
0119 }