Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:12

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 
0014 // Framework include files
0015 #include <DD4hep/Printout.h>
0016 #include <DDEve/Projection.h>
0017 #include <DDEve/Display.h>
0018 #include <DDEve/Utilities.h>
0019 
0020 // Eve include files
0021 #include <TEveManager.h>
0022 #include <TEveBrowser.h>
0023 #include <TEveWindow.h>
0024 #include <TGLViewer.h>
0025 
0026 using namespace dd4hep;
0027 
0028 /// Initializing constructor
0029 Projection::Projection(Display* eve, const std::string& nam)
0030   : View(eve, nam), m_projMgr(0), m_axis(0)
0031 {
0032 }
0033 
0034 /// Default destructor
0035 Projection::~Projection() {
0036 }
0037 
0038 void Projection::SetDepth(Float_t d)  {
0039   // Set current depth on all projection managers.
0040   m_projMgr->SetCurrentDepth(d);
0041 }
0042 
0043 /// Call an element to a geometry element list
0044 TEveElement* Projection::ImportGeoTopic(TEveElement*, TEveElementList*)   {
0045   return 0;
0046 }
0047 
0048 /// Call an element to a event element list
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 /// Call an element to a geometry element list
0073 TEveElement* Projection::ImportGeoElement(TEveElement* element, TEveElementList* list)  {
0074   return element ? ImportElement(element, list) : 0;
0075 }
0076 
0077 /// Call an element to a event element list
0078 TEveElement* Projection::ImportEventElement(TEveElement* element, TEveElementList* list)  {
0079   return element ? ImportElement(element, list) : 0;
0080 }
0081 
0082 /// Add axis to the projection view
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 /// Create Rho-Phi projection 
0097 Projection& Projection::CreateRhoPhiProjection()  {
0098   // RhoPhi Projection manager
0099   m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
0100   //m_ev.AddToListTree(m_projMgr, kFALSE);
0101   AddToGlobalItems(name())->AddElement(m_projMgr);
0102   return *this;
0103 }
0104 
0105 /// Create Rho-Z projection
0106 Projection& Projection::CreateRhoZProjection()  {
0107   // RhoZ Projection manager
0108   m_projMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
0109   //m_eve->manager().AddToListTree(m_projMgr, kFALSE);
0110   AddToGlobalItems(name())->AddElement(m_projMgr);
0111   return *this;
0112 }
0113 
0114 /// Map the projection view to the slot
0115 View& Projection::Map(TEveWindow* slot)  {
0116   View::Map(slot);
0117   m_view->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
0118   return *this;
0119 }