CMS 3D CMS Logo

FWEveDetectorGeo.cc
Go to the documentation of this file.
7 
8 #include "TGeoMatrix.h"
9 
10 //==============================================================================
11 //==============================================================================
12 //==============================================================================
14  m_browser(v), m_maxLevel(0), m_filterOff(false)
15 {
16 }
17 
19 {
20  return m_browser->getTableManager();
21 }
22 
24 {
25  return m_browser;
26 }
27 //______________________________________________________________________________
28 
29 void FWEveDetectorGeo::Paint(Option_t* opt)
30 {
32 
33  // printf("PAINPAINTPAINTPAINTPAINTPAINTPAINTPAINTPAINTPAINTT %d/%d \n", m_browser->getTopNodeIdx(), (int)m_browser->getTableManager()->refEntries().size());
34  if (m_browser->getTableManager()->refEntries().empty()) return;
35 
36  TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur());
37 
39 
40  m_filterOff = m_browser->getFilter().empty();
41 
42  Int_t topIdx = m_browser->getTopNodeIdx();
44 
45  TGeoHMatrix mtx;
46  if (topIdx >= 0)
47  {
48  std::advance(sit, topIdx);
50  }
51 
52  bool drawsChildren = false;
53 
54  if ( ((FWGeometryTableManager*)tableManager())->getVisibilityChld(*sit))
55  drawsChildren = paintChildNodesRecurse( sit, topIdx, mtx);
56 
57  if (sit->testBit(FWGeometryTableManagerBase::kVisNodeSelf) && ((FWGeometryTableManager*)tableManager())->getVisibility(*sit))
58  paintShape( topIdx,mtx, m_browser->getVolumeMode(), drawsChildren );
59 
60 
61  fflush(stdout);
62 }
63 
64 
65 // ______________________________________________________________________
66 bool FWEveDetectorGeo::paintChildNodesRecurse (FWGeometryTableManagerBase::Entries_i pIt, Int_t cnt, const TGeoHMatrix& parentMtx)
67 {
68  TGeoNode* parentNode = pIt->m_node;
69  int nD = parentNode->GetNdaughters();
70 
71  int dOff=0;
72 
73  pIt++;
74  int pcnt = cnt+1;
75 
76  bool drawsChildNodes = false;
77 
79  for (int n = 0; n != nD; ++n)
80  {
81  it = pIt;
82  std::advance(it,n + dOff);
83  cnt = pcnt + n+dOff;
84 
85  TGeoHMatrix nm = parentMtx;
86  nm.Multiply(it->m_node->GetMatrix());
87 
88  bool drawsChildNodesSecondGen = false;
90  {
91  if ( ((FWGeometryTableManager*)tableManager())->getVisibilityChld(*it) && ( it->m_level < m_maxLevel)) {
92  drawsChildNodesSecondGen = paintChildNodesRecurse(it,cnt , nm);
93  }
94 
95  if ( ((FWGeometryTableManager*)tableManager())->getVisibility(*it))
96  {
97  paintShape(cnt , nm, m_browser->getVolumeMode(), drawsChildNodesSecondGen );
98  drawsChildNodes = true;
99  }
100 
101  }
102  else
103  {
104  if ( ((FWGeometryTableManager*)tableManager())->getVisibilityChld(*it) && ( it->m_level < m_maxLevel || m_browser->getIgnoreVisLevelWhenFilter() ))
105  {
106  drawsChildNodesSecondGen = paintChildNodesRecurse(it,cnt , nm);
107  }
108 
109  ((FWGeometryTableManager*)tableManager())->assertNodeFilterCache(*it);
110  if ( ((FWGeometryTableManager*)tableManager())->getVisibility(*it))
111  {
112  paintShape(cnt , nm, m_browser->getVolumeMode(), drawsChildNodesSecondGen );
113  drawsChildNodes = true;
114  }
115  }
116 
117  drawsChildNodes |= drawsChildNodesSecondGen;
118  FWGeometryTableManagerBase::getNNodesTotal(parentNode->GetDaughter(n), dOff);
119  }
120 
121  return drawsChildNodes;
122 }
123 
124 //______________________________________________________________________________
125 
127 {
128  std::set<TGLPhysicalShape*>::iterator it = fHted.begin();
129  int idx = tableIdx(*it);
130  if (idx > 0)
131  {
133  return data.name();
134  }
135  return "error";
136 }
137 
138 //_____________________________________________________________________________
139 
140 void FWEveDetectorGeo::popupMenu(int x, int y, TGLViewer* v)
141 {
142  FWPopupMenu* nodePopup = FWGeoTopNode::setPopupMenu(x, y, v, false);
143 
144  if (nodePopup) nodePopup->Connect("Activated(Int_t)",
145  "FWGeometryTableView",
146  m_browser,
147  "chosenItem(Int_t)");
148 }
void Paint(Option_t *option="") override
bool paintChildNodesRecurse(FWGeometryTableManagerBase::Entries_i pIt, Int_t idx, const TGeoHMatrix &mtx)
FWEveDetectorGeo(FWGeometryTableView *v)
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
std::string getFilter() const
bool isSelectedByRegion() const
void popupMenu(int x, int y, TGLViewer *) override
FWGeometryTableViewBase * browser() override
TString GetHighlightTooltip() override
bool getIgnoreVisLevelWhenFilter() const
static void getNNodesTotal(TGeoNode *geoNode, int &off)
FWPopupMenu * setPopupMenu(int iX, int iY, TGLViewer *v, bool)
FWGeometryTableManagerBase * tableManager() override
FWGeometryTableManagerBase * getTableManager() override
bool getVolumeMode() const
std::set< TGLPhysicalShape * > fHted
Definition: FWGeoTopNode.h:73
void paintShape(Int_t idx, const TGeoHMatrix &nm, bool volumeColor, bool parentNode)
FWGeometryTableView * m_browser
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void Paint(Option_t *option="") override
static int tableIdx(TGLPhysicalShape *ps)
Definition: FWGeoTopNode.cc:59