CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
FWGeometryTableManager Class Reference

#include <Fireworks/Core/interface/FWGeometryTableManager.h>

Inheritance diagram for FWGeometryTableManager:
FWGeometryTableManagerBase FWTableManagerBase

Classes

struct  Match
 

Public Types

enum  ECol {
  kNameColumn, kColorColumn, kTranspColumn, kVisSelfColumn,
  kVisChildColumn, kMaterialColumn, kNumColumn
}
 
enum  GeometryBits { kMatches = BIT(5), kChildMatches = BIT(6), kFilterCached = BIT(7) }
 
typedef Volumes_t::iterator Volumes_i
 
typedef boost::unordered_map
< TGeoVolume *, Match
Volumes_t
 
- Public Types inherited from FWGeometryTableManagerBase
enum  Bits {
  kExpanded = BIT(0), kVisNodeSelf = BIT(1), kVisNodeChld = BIT(2), kHighlighted = BIT(3),
  kSelected = BIT(4)
}
 
typedef Entries_v::iterator Entries_i
 
typedef std::vector< NodeInfoEntries_v
 

Public Member Functions

void assertNodeFilterCache (NodeInfo &data)
 
virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const
 
void checkChildMatches (TGeoVolume *v, std::vector< TGeoVolume * > &)
 
void checkHierarchy ()
 
void checkRegionOfInterest (double *center, double radius, long algo)
 
 FWGeometryTableManager (FWGeometryTableView *)
 
virtual bool getVisibility (const NodeInfo &nodeInfo) const
 
virtual bool getVisibilityChld (const NodeInfo &nodeInfo) const
 
void importChildren (int parent_idx)
 
void loadGeometry (TGeoNode *iGeoTopNode, TObjArray *iVolumes)
 
virtual int numberOfColumns () const
 Number of columns in the table. More...
 
void printMaterials ()
 
virtual void recalculateVisibility ()
 
void recalculateVisibilityNodeRec (int)
 
void recalculateVisibilityVolumeRec (int)
 
void resetRegionOfInterest ()
 
virtual void setDaughtersSelfVisibility (int i, bool v)
 
virtual void setVisibility (NodeInfo &nodeInfo, bool)
 
virtual void setVisibilityChld (NodeInfo &nodeInfo, bool)
 
void updateFilter (int)
 
virtual ~FWGeometryTableManager ()
 
- Public Member Functions inherited from FWGeometryTableManagerBase
void applyTransparencyFromEditor ()
 
void cancelEditor (bool)
 
virtual bool cellDataIsSortable () const
 
bool firstColumnClicked (int row, int xPos)
 
 FWGeometryTableManagerBase ()
 
 FWGeometryTableManagerBase (const FWGeometryTableManagerBase &)
 
int getLevelOffset () const
 
void getNodeMatrix (const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
 
void getNodePath (int, std::string &) const
 
NodeInfogetSelected ()
 
virtual std::vector< std::string > getTitles () const
 returns the title names for each column More...
 
virtual void implSort (int, bool)
 Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'. More...
 
void loadGeometry (TGeoNode *, TObjArray *)
 
bool nodeImported (int idx) const
 
virtual int numberOfRows () const
 Number of rows in the table. More...
 
const FWGeometryTableManagerBaseoperator= (const FWGeometryTableManagerBase &)
 
void redrawTable (bool setExpand=false)
 
Entries_vrefEntries ()
 
NodeInforefEntry (int i)
 
std::vector< int > rowToIndex ()
 
void setBackgroundToWhite (bool)
 
void setCellValueEditor (TGTextEntry *editor)
 
void setDaughtersSelfVisibility (bool)
 
void setLevelOffset (int x)
 
void showEditor (int)
 
virtual const std::string title () const
 
virtual int unsortedRowNumber (int unsorted) const
 when passed the index to the sorted order of the rows it returns the original row number from the underlying data More...
 
virtual ~FWGeometryTableManagerBase ()
 
- Public Member Functions inherited from FWTableManagerBase
virtual void buttonPressedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 Called if mouse button pressed in Row Header, defaults is to do nothing. More...
 
virtual void buttonReleasedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 
virtual unsigned int cellHeight () const
 require all cells to be the same height More...
 
 ClassDef (FWTableManagerBase, 0)
 
void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes. More...
 
 FWTableManagerBase ()
 
virtual bool hasLabelHeaders () const
 
virtual bool hasRowHeaders () const
 Returns 'true' if this table has row headers. Defaults return value is false. More...
 
virtual std::vector< unsigned int > maxWidthForColumns () const
 for each column in the table this returns the present maximum width for that column More...
 
virtual FWTableCellRendererBaserowHeader (int iSortedRowNumber) const
 Returns the renderer for the row header for the sorted row number iSortedRowNumber. More...
 
void sort (int iCol, bool iSortOrder)
 Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder is 'true'. More...
 
int sortColumn (void)
 The current sort column. More...
 
bool sortOrder (void)
 The current sort order for the table. More...
 
void visualPropertiesChanged ()
 Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes. More...
 
virtual ~FWTableManagerBase ()
 

Protected Member Functions

virtual const char * cellName (const NodeInfo &data) const
 
virtual bool nodeIsParent (const NodeInfo &) const
 

Private Member Functions

 FWGeometryTableManager (const FWGeometryTableManager &)
 
const FWGeometryTableManageroperator= (const FWGeometryTableManager &)
 

Private Attributes

FWGeometryTableViewm_browser
 
bool m_filterOff
 
Volumes_t m_volumes
 

Additional Inherited Members

- Static Public Member Functions inherited from FWGeometryTableManagerBase
static void getNNodesTotal (TGeoNode *geoNode, int &off)
 
- Public Attributes inherited from FWGeometryTableManagerBase
ColorBoxRenderer m_colorBoxRenderer
 
TGTextEntry * m_editor
 
int m_editTransparencyIdx
 
Entries_v m_entries
 
TGGC * m_highlightContext
 
int m_highlightIdx
 
int m_levelOffset
 
FWTextTreeCellRenderer m_renderer
 
std::vector< int > m_row_to_index
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 32 of file FWGeometryTableManager.h.

Member Typedef Documentation

typedef Volumes_t::iterator FWGeometryTableManager::Volumes_i

Definition at line 55 of file FWGeometryTableManager.h.

typedef boost::unordered_map<TGeoVolume*, Match> FWGeometryTableManager::Volumes_t

Definition at line 54 of file FWGeometryTableManager.h.

Member Enumeration Documentation

Enumerator
kMatches 
kChildMatches 
kFilterCached 

Definition at line 37 of file FWGeometryTableManager.h.

Constructor & Destructor Documentation

FWGeometryTableManager::FWGeometryTableManager ( FWGeometryTableView v)

Definition at line 29 of file FWGeometryTableManager.cc.

FWGeometryTableManager::~FWGeometryTableManager ( )
virtual

Definition at line 35 of file FWGeometryTableManager.cc.

36 {}
FWGeometryTableManager::FWGeometryTableManager ( const FWGeometryTableManager )
private

Member Function Documentation

void FWGeometryTableManager::assertNodeFilterCache ( NodeInfo data)

Definition at line 424 of file FWGeometryTableManager.cc.

References kChildMatches, FWGeometryTableManagerBase::kExpanded, kFilterCached, kMatches, FWGeometryTableManagerBase::NodeInfo::m_node, m_volumes, FWGeometryTableManagerBase::NodeInfo::setBit(), FWGeometryTableManagerBase::NodeInfo::setBitVal(), setVisibility(), setVisibilityChld(), and FWGeometryTableManagerBase::NodeInfo::testBit().

Referenced by recalculateVisibility(), recalculateVisibilityNodeRec(), recalculateVisibilityVolumeRec(), and updateFilter().

425 {
426  if (! data.testBit(kFilterCached))
427  {
428  bool matches = m_volumes[data.m_node->GetVolume()].m_matches;
429  // if (matches) printf("%s matches filter \n", data.name());
430  data.setBitVal(kMatches, matches);
431  setVisibility(data, matches);
432 
433  bool childMatches = m_volumes[data.m_node->GetVolume()].m_childMatches;
434  data.setBitVal(kChildMatches, childMatches);
435  data.setBitVal(kExpanded, childMatches);
436  setVisibilityChld(data, childMatches);
437 
438  data.setBit(kFilterCached);
439  // printf("%s matches [%d] childMatches [%d] ................ %d %d \n", data.name(), data.testBit(kMatches), data.testBit(kChildMatches), matches , childMatches);
440  }
441 }
virtual void setVisibility(NodeInfo &nodeInfo, bool)
virtual void setVisibilityChld(NodeInfo &nodeInfo, bool)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const char * FWGeometryTableManager::cellName ( const NodeInfo data) const
protectedvirtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 38 of file FWGeometryTableManager.cc.

References FWGeometryTableView::getVolumeMode(), m_browser, and FWGeometryTableManagerBase::NodeInfo::m_node.

Referenced by cellRenderer().

39 {
40  if (m_browser->getVolumeMode())
41  return Form("%s [%d]", data.m_node->GetVolume()->GetName(), data.m_node->GetNdaughters());
42  else
43  return Form("%s [%d]", data.m_node->GetName(), data.m_node->GetNdaughters());
44 }
FWGeometryTableView * m_browser
bool getVolumeMode() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
FWTableCellRendererBase * FWGeometryTableManager::cellRenderer ( int  iSortedRowNumber,
int  iCol 
) const
virtual
Returns the particular renderer used to handle the requested cell.  Arguments:

iSortedRowNumber: the row number from the present sort (i.e. the cell number of the view) iCol: the column number of the cell. The returned value must be used immediately and not held onto since the same Renderer can be used for subsequent calls

Implements FWTableManagerBase.

Definition at line 48 of file FWGeometryTableManager.cc.

References cellName(), data, getVisibility(), getVisibilityChld(), FWTextTreeCellRenderer::iconWidth(), kColorColumn, FWGeometryTableManagerBase::kExpanded, FWGeometryTableManagerBase::kHighlighted, kMatches, kMaterialColumn, kNameColumn, FWGeometryTableManagerBase::kSelected, kTranspColumn, kVisChildColumn, kVisSelfColumn, testEve_cfg::level, FWGeometryTableManagerBase::NodeInfo::m_color, FWGeometryTableManagerBase::m_colorBoxRenderer, FWGeometryTableManagerBase::m_editTransparencyIdx, FWGeometryTableManagerBase::m_entries, FWGeometryTableManagerBase::m_highlightContext, FWGeometryTableManagerBase::NodeInfo::m_level, FWGeometryTableManagerBase::m_levelOffset, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::m_renderer, FWGeometryTableManagerBase::m_row_to_index, FWGeometryTableManagerBase::NodeInfo::m_transparency, nodeIsParent(), FWTextTableCellRenderer::setData(), FWGeometryTableManagerBase::ColorBoxRenderer::setData(), FWTextTreeCellRenderer::setIndentation(), FWTextTreeCellRenderer::setIsOpen(), FWTextTreeCellRenderer::setIsParent(), FWTextTreeCellRenderer::showEditor(), and FWGeometryTableManagerBase::NodeInfo::testBit().

49 {
51  if (m_row_to_index.empty()) return renderer;
52 
53  int unsortedRow = m_row_to_index[iSortedRowNumber];
54  if (unsortedRow < 0) printf("!!!!!!!!!!!!!!!! error %d %d \n",unsortedRow, iSortedRowNumber);
55 
56  // editor state
57  //
58  m_renderer.showEditor(unsortedRow == m_editTransparencyIdx && iCol == kTranspColumn);
59 
60  // selection state
61  //
62  const NodeInfo& data = m_entries[unsortedRow];
63  TGeoNode& gn = *data.m_node;
64  bool isSelected = data.testBit(kHighlighted) || data.testBit(kSelected);
65  // printf("cell render %s \n", data.name());
66  if (data.testBit(kSelected))
67  {
68  m_highlightContext->SetBackground(0xc86464);
69  }
70  else if (data.testBit(kHighlighted) )
71  {
72  m_highlightContext->SetBackground(0x6464c8);
73  }
74  else if (iCol == kMaterialColumn && data.testBit(kMatches) )
75  {
76  m_highlightContext->SetBackground(0xdddddd);
77  }
78 
79  // set column content
80  //
81  if (iCol == kNameColumn)
82  {
83  renderer->setData(cellName(data), isSelected);
84 
85  renderer->setIsParent(nodeIsParent(data));
86 
87  renderer->setIsOpen( data.testBit(FWGeometryTableManagerBase::kExpanded));
88 
89  int level = data.m_level - m_levelOffset;
90  if (nodeIsParent(data))
91  renderer->setIndentation(20*level);
92  else
93  renderer->setIndentation(20*level + FWTextTreeCellRenderer::iconWidth());
94 
95  return renderer;
96  }
97  else
98  {
99  // printf("title %s \n",data.m_node->GetTitle());
100  renderer->setIsParent(false);
101  renderer->setIndentation(0);
102  if (iCol == kColorColumn)
103  {
104  // m_colorBoxRenderer.setData(data.m_node->GetVolume()->GetLineColor(), isSelected);
105  m_colorBoxRenderer.setData(data.m_color, isSelected);
106  return &m_colorBoxRenderer;
107  }
108  else if (iCol == kTranspColumn)
109  {
110  renderer->setData(Form("%d", 100 -data.m_transparency), isSelected);
111  return renderer;
112  }
113  else if (iCol == kVisSelfColumn)
114  {
115  renderer->setData(getVisibility(data) ? "On" : "-", isSelected);
116  return renderer;
117  }
118  else if (iCol == kVisChildColumn)
119  {
120  renderer->setData( getVisibilityChld(data) ? "On" : "-", isSelected);
121  return renderer;
122  }
123  else if (iCol == kMaterialColumn)
124  {
125  renderer->setData( gn.GetVolume()->GetMaterial()->GetName(), isSelected);
126  return renderer;
127  }
128  else
129  { renderer->setData("ERROR", false);
130  return renderer;
131  }
132  }
133 }
virtual bool getVisibilityChld(const NodeInfo &nodeInfo) const
virtual const char * cellName(const NodeInfo &data) const
virtual bool getVisibility(const NodeInfo &nodeInfo) const
virtual void setIndentation(int indentation=0)
void setData(const std::string &, bool isSelected)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual bool nodeIsParent(const NodeInfo &) const
tuple level
Definition: testEve_cfg.py:34
virtual void showEditor(bool value)
void FWGeometryTableManager::checkChildMatches ( TGeoVolume *  v,
std::vector< TGeoVolume * > &  pstack 
)

Definition at line 186 of file FWGeometryTableManager.cc.

References i, FWGeometryTableManager::Match::m_childMatches, and m_volumes.

Referenced by updateFilter().

187 {
188  if (m_volumes[vol].m_matches)
189  {
190  for (std::vector<TGeoVolume*>::iterator i = pstack.begin(); i != pstack.end(); ++i)
191  {
192  Match& pm = m_volumes[*i];
193  pm.m_childMatches = true;
194  }
195  }
196 
197  pstack.push_back(vol);
198 
199  int nD = vol->GetNdaughters(); //TMath::Min(m_browser->getMaxDaughters(), vol->GetNdaughters());
200  for (int i = 0; i < nD; ++i)
201  checkChildMatches(vol->GetNode(i)->GetVolume(), pstack);
202 
203  pstack.pop_back();
204 }
int i
Definition: DBlmapReader.cc:9
void checkChildMatches(TGeoVolume *v, std::vector< TGeoVolume * > &)
void FWGeometryTableManager::checkHierarchy ( )

Definition at line 162 of file FWGeometryTableManager.cc.

References alignCSCRings::e, i, FWGeometryTableManagerBase::m_entries, mergeVDriftHistosByStation::name, and convertSQLiteXML::ok.

163 {
164  // Used for debug: in a NodeInfo entry look TGeoNode children from parent index and check
165  // if child is found.
166 
167  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
168  {
169  if (m_entries[i].m_level > 0)
170  {
171  TGeoNode* pn = m_entries[m_entries[i].m_parent].m_node;
172  bool ok = false;
173  for (int d = 0; d < pn->GetNdaughters(); ++d)
174  {
175  if (m_entries[i].m_node == pn->GetDaughter(d))
176  {
177  ok = true;
178  break;
179  }
180  }
181  if (! ok) printf("!!!!!! node %s has false parent %s \n", m_entries[i].name(), pn->GetName());
182  }
183  }
184 }
int i
Definition: DBlmapReader.cc:9
void FWGeometryTableManager::checkRegionOfInterest ( double *  center,
double  radius,
long  algo 
)

Definition at line 524 of file FWGeometryTableManager.cc.

References delta, FWGeometryTableViewManager::getGeoMangeur(), i, FWGeometryTableView::kBBoxCenter, FWGeometryTableView::kBBoxSurface, FWGeometryTableManagerBase::kVisNodeChld, FWGeometryTableManagerBase::kVisNodeSelf, FWGeometryTableManagerBase::m_entries, alignCSCRings::r, CosmicsPD_Skims::radius, and lumiQTWidget::t.

Referenced by FWGeometryTableView::checkRegionOfInterest().

525 {
526  double sqr_r = radius * radius;
527 
528  for (Entries_i ni = m_entries.begin(); ni != m_entries.end(); ++ni)
529  ni->resetBit(kVisNodeChld);
530 
531  int cnt = 0;
532  TEveGeoManagerHolder mangeur( FWGeometryTableViewManager::getGeoMangeur());
533  printf("FWGeometryTableManagerBase::checkRegionOfInterest BEGIN r=%d center= (%.1f, %.1f, %.1f)\n ", (int)radius, center[0], center[1], center[2]);
534  TGeoIterator git(m_entries[0].m_node->GetVolume());
535  Entries_i eit(m_entries.begin());
536  while (git())
537  {
538  const TGeoMatrix *gm = git.GetCurrentMatrix();
539  const TGeoBBox *bb = static_cast<TGeoBBox*>(eit->m_node->GetVolume()->GetShape());
540  const Double_t *bo = bb->GetOrigin();
541  const Double_t bd[] = { bb->GetDX(), bb->GetDY(), bb->GetDZ() };
542  const Double_t *cc = center;
543 
544  bool visible = false;
545 
546  switch (algo)
547  {
549  {
550  const Double_t *t = gm->GetTranslation();
551  TEveVectorD d(cc[0] - (t[0] + bo[0]), cc[1] - (t[1] + bo[1]), cc[2] - (t[2] + bo[2]));
552  Double_t sqr_d = d.Mag2();;
553  visible = (sqr_d <= sqr_r);
554  break;
555  }
557  {
558  assert (gm->IsScale() == false);
559 
560  const Double_t *t = gm->GetTranslation();
561  const Double_t *r = gm->GetRotationMatrix();
562  TEveVectorD d(cc[0] - (t[0] + bo[0]), cc[1] - (t[1] + bo[1]), cc[2] - (t[2] + bo[2]));
563  Double_t sqr_d = 0;
564  for (Int_t i = 0; i < 3; ++i)
565  {
566  Double_t dp = d[0]*r[i] + d[1]*r[i+3] + d[2]*r[i+6];
567  if (dp < -bd[i])
568  {
569  Double_t delta = dp + bd[i];
570  sqr_d += delta * delta;
571  }
572  else if (dp > bd[i])
573  {
574  Double_t delta = dp - bd[i];
575  sqr_d += delta * delta;
576  }
577  }
578  visible = (sqr_d <= sqr_r);
579  }
580  }
581 
582  if (visible)
583  {
584  eit->setBit(kVisNodeSelf);
585  int pidx = eit->m_parent;
586  while (pidx >= 0)
587  {
588  m_entries[pidx].setBit(kVisNodeChld);
589  pidx = m_entries[pidx].m_parent;
590  ++cnt;
591  }
592  }
593  else
594  {
595  eit->resetBit(kVisNodeSelf);
596  }
597  eit++;
598  }
599 
600  printf("FWGeometryTableManager::checkRegionOfInterest END [%d]\n ", cnt);
601 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
LimitAlgo * algo
Definition: Combine.cc:60
bool FWGeometryTableManager::getVisibility ( const NodeInfo nodeInfo) const
virtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 499 of file FWGeometryTableManager.cc.

References FWGeometryTableView::getVolumeMode(), FWGeometryTableManagerBase::kVisNodeSelf, m_browser, FWGeometryTableManagerBase::NodeInfo::m_node, and FWGeometryTableManagerBase::NodeInfo::testBit().

Referenced by cellRenderer().

500 {
501  if (m_browser->getVolumeMode())
502  return data.m_node->GetVolume()->IsVisible();
503 
504  return data.testBit(kVisNodeSelf);
505 }
FWGeometryTableView * m_browser
bool getVolumeMode() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool FWGeometryTableManager::getVisibilityChld ( const NodeInfo nodeInfo) const
virtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 507 of file FWGeometryTableManager.cc.

References FWGeometryTableView::getVolumeMode(), FWGeometryTableManagerBase::kVisNodeChld, m_browser, FWGeometryTableManagerBase::NodeInfo::m_node, and FWGeometryTableManagerBase::NodeInfo::testBit().

Referenced by cellRenderer().

508 {
509  if (m_browser->getVolumeMode())
510  return data.m_node->GetVolume()->IsVisibleDaughters();
511 
512  return data.testBit(kVisNodeChld);
513 }
FWGeometryTableView * m_browser
bool getVolumeMode() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FWGeometryTableManager::importChildren ( int  parent_idx)

Definition at line 137 of file FWGeometryTableManager.cc.

References data, FWGeometryTableView::getAutoExpand(), FWGeometryTableManagerBase::getNNodesTotal(), FWGeometryTableManagerBase::kExpanded, m_browser, FWGeometryTableManagerBase::NodeInfo::m_color, FWGeometryTableManagerBase::m_entries, FWGeometryTableManagerBase::NodeInfo::m_level, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::NodeInfo::m_parent, FWGeometryTableManagerBase::NodeInfo::m_transparency, n, dbtoconf::parent, and FWGeometryTableManagerBase::NodeInfo::setBit().

Referenced by loadGeometry().

138 {
139  NodeInfo& parent = m_entries[parent_idx];
140  TGeoNode* parentGeoNode = parent.m_node;
141  int parentLevel = parent.m_level;
142 
143  int nV = parentGeoNode->GetNdaughters();
144  int dOff = 0;
145  for (int n = 0; n != nV; ++n)
146  {
147  NodeInfo& data = m_entries[parent_idx + n + 1 + dOff];
148  data.m_node = parentGeoNode->GetDaughter(n);
149  data.m_level = parentLevel + 1;
150  data.m_parent = parent_idx;
151  data.m_color = data.m_node->GetVolume()->GetLineColor();
152  data.m_transparency = data.m_node->GetVolume()->GetTransparency();
153  if (data.m_level <= m_browser->getAutoExpand()) data.setBit(kExpanded);
154 
155  importChildren(parent_idx + n + 1 + dOff);
156  getNNodesTotal(parentGeoNode->GetDaughter(n), dOff);
157  }
158 }
FWGeometryTableView * m_browser
list parent
Definition: dbtoconf.py:74
static void getNNodesTotal(TGeoNode *geoNode, int &off)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void importChildren(int parent_idx)
void FWGeometryTableManager::loadGeometry ( TGeoNode *  iGeoTopNode,
TObjArray *  iVolumes 
)

Definition at line 261 of file FWGeometryTableManager.cc.

References FWGeometryTableView::drawTopNode(), FWGeometryTableView::getAutoExpand(), FWGeometryTableView::getFilterType(), FWGeometryTableManagerBase::getNNodesTotal(), importChildren(), FWGeometryTableManagerBase::kExpanded, FWGeometryTableManagerBase::kVisNodeSelf, m_browser, FWGeometryTableManagerBase::NodeInfo::m_color, FWGeometryTableManagerBase::m_entries, m_filterOff, FWGeometryTableManagerBase::NodeInfo::m_level, FWGeometryTableManagerBase::m_levelOffset, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::NodeInfo::m_parent, FWGeometryTableManagerBase::m_row_to_index, FWGeometryTableManagerBase::NodeInfo::m_transparency, m_volumes, MultipleCompare::Match(), GetRecoTauVFromDQM_MC_cff::next, FWGeometryTableManagerBase::NodeInfo::setBitVal(), updateFilter(), and v.

Referenced by FWGeometryTableView::FWGeometryTableView().

262 {
263 #ifdef PERFTOOL_GEO_TABLE
264  ProfilerStart("loadGeo");
265 #endif
266 
267  // Prepare data for cell render.
268 
269  // clear entries
270  m_entries.clear();
271  m_row_to_index.clear();
272  m_volumes.clear();
273  m_levelOffset = 0;
274 
275  // set volume table for filters
276  boost::unordered_map<TGeoVolume*, Match> pipi(iVolumes->GetSize());
277  m_volumes.swap(pipi);
278  TIter next( iVolumes);
279  TGeoVolume* v;
280  while ((v = (TGeoVolume*) next()) != 0)
281  m_volumes.insert(std::make_pair(v, Match()));
282 
283  if (!m_filterOff)
285 
286  // add top node to init
287 
288  int nTotal = 0;
289  NodeInfo topNodeInfo;
290  topNodeInfo.m_node = iGeoTopNode;
291  topNodeInfo.m_level = 0;
292  topNodeInfo.m_parent = -1;
293  topNodeInfo.m_color = iGeoTopNode->GetVolume()->GetLineColor();
294  topNodeInfo.m_transparency = iGeoTopNode->GetVolume()->GetTransparency();
295  topNodeInfo.setBitVal(kExpanded, m_browser->getAutoExpand());
296  topNodeInfo.setBitVal(kVisNodeSelf, m_browser->drawTopNode());
297 
298  getNNodesTotal(topNodeInfo.m_node , nTotal);
299  m_entries.resize(nTotal+1);
300  m_entries[0] = topNodeInfo;
301 
302  importChildren(0);
303 
304  // checkHierarchy();
305 
306 #ifdef PERFTOOL_GEO_TABLE
307  ProfilerStop();
308 #endif
309 }
FWGeometryTableView * m_browser
static void getNNodesTotal(TGeoNode *geoNode, int &off)
void importChildren(int parent_idx)
mathSSE::Vec4< T > v
bool FWGeometryTableManager::nodeIsParent ( const NodeInfo data) const
protectedvirtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 517 of file FWGeometryTableManager.cc.

References kChildMatches, m_filterOff, FWGeometryTableManagerBase::NodeInfo::m_node, and FWGeometryTableManagerBase::NodeInfo::testBit().

Referenced by cellRenderer().

518 {
519  return (data.m_node->GetNdaughters() != 0) && (m_filterOff || data.testBit(kChildMatches));
520 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual int FWGeometryTableManager::numberOfColumns ( ) const
inlinevirtual

Number of columns in the table.

Implements FWTableManagerBase.

Definition at line 82 of file FWGeometryTableManager.h.

References kNumColumn.

const FWGeometryTableManager& FWGeometryTableManager::operator= ( const FWGeometryTableManager )
private
void FWGeometryTableManager::printMaterials ( )

Definition at line 313 of file FWGeometryTableManager.cc.

References dtNoiseDBValidation_cfg::cerr.

314 {
315  std::cerr << "not implemented \n";
316 }
void FWGeometryTableManager::recalculateVisibility ( )
virtual

Implements FWGeometryTableManagerBase.

Definition at line 320 of file FWGeometryTableManager.cc.

References assertNodeFilterCache(), data, FWGeometryTableViewBase::getTopNodeIdx(), FWGeometryTableView::getVolumeMode(), i, kChildMatches, FWGeometryTableManagerBase::kExpanded, m_browser, FWGeometryTableManagerBase::m_entries, m_filterOff, FWGeometryTableManagerBase::m_row_to_index, siStripFEDMonitor_P5_cff::Max, recalculateVisibilityNodeRec(), recalculateVisibilityVolumeRec(), and FWGeometryTableManagerBase::NodeInfo::testBit().

321 {
322  m_row_to_index.clear();
323 
324  int i = TMath::Max(0, m_browser->getTopNodeIdx());
325  m_row_to_index.push_back(i);
326 
327  NodeInfo& data = m_entries[i];
328 
329  if (!m_filterOff)
330  assertNodeFilterCache(data);
331 
332  if ((m_filterOff && data.testBit(kExpanded) == false) ||
333  (m_filterOff == false && data.testBit(kChildMatches) == false))
334  return;
335 
336  if (m_browser->getVolumeMode())
338  else
340 
341  // printf (" child [%d] FWGeometryTableManagerBase::recalculateVisibility table size %d \n", (int)m_row_to_index.size());
342 }
FWGeometryTableView * m_browser
int i
Definition: DBlmapReader.cc:9
void assertNodeFilterCache(NodeInfo &data)
bool getVolumeMode() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FWGeometryTableManager::recalculateVisibilityNodeRec ( int  pIdx)

Definition at line 396 of file FWGeometryTableManager.cc.

References assertNodeFilterCache(), data, FWGeometryTableManagerBase::getNNodesTotal(), kChildMatches, FWGeometryTableManagerBase::kExpanded, kMatches, FWGeometryTableManagerBase::m_entries, m_filterOff, FWGeometryTableManagerBase::m_row_to_index, n, FWGeometryTableManagerBase::NodeInfo::testBit(), and FWGeometryTableManagerBase::NodeInfo::testBitAny().

Referenced by recalculateVisibility().

397 {
398  TGeoNode* parentNode = m_entries[pIdx].m_node;
399  int nD = parentNode->GetNdaughters();
400  int dOff = 0;
401  for (int n = 0; n != nD; ++n)
402  {
403  int idx = pIdx + 1 + n + dOff;
404  NodeInfo& data = m_entries[idx];
405 
406  if (m_filterOff)
407  {
408  m_row_to_index.push_back(idx);
409  if (data.testBit(kExpanded)) recalculateVisibilityNodeRec(idx);
410  }
411  else
412  {
413  assertNodeFilterCache(data);
414  if (data.testBitAny(kMatches | kChildMatches)) m_row_to_index.push_back(idx);
415  if (data.testBit(kChildMatches) && data.testBit(kExpanded) ) recalculateVisibilityNodeRec(idx);
416  }
417 
418  FWGeometryTableManagerBase::getNNodesTotal(parentNode->GetDaughter(n), dOff);
419  }
420 }
void assertNodeFilterCache(NodeInfo &data)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FWGeometryTableManager::recalculateVisibilityVolumeRec ( int  pIdx)

Definition at line 346 of file FWGeometryTableManager.cc.

References assertNodeFilterCache(), data, FWGeometryTableManagerBase::getNNodesTotal(), kChildMatches, FWGeometryTableManagerBase::kExpanded, kMatches, FWGeometryTableManagerBase::m_entries, m_filterOff, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::m_row_to_index, n, FWGeometryTableManagerBase::NodeInfo::testBit(), FWGeometryTableManagerBase::NodeInfo::testBitAny(), and makeLayoutFileForGui::toAdd.

Referenced by recalculateVisibility().

347 {
348  TGeoNode* parentNode = m_entries[pIdx].m_node;
349  int nD = parentNode->GetNdaughters();
350  int dOff=0;
351 
352  // printf("----------- parent %s\n", parentNode->GetName() );
353 
354  std::vector<int> vi;
355  vi.reserve(nD);
356 
357  for (int n = 0; n != nD; ++n)
358  {
359  int idx = pIdx + 1 + n + dOff;
360  NodeInfo& data = m_entries[idx];
361 
362  bool toAdd = true;
363  for (std::vector<int>::iterator u = vi.begin(); u != vi.end(); ++u )
364  {
365  TGeoVolume* neighbourVolume = parentNode->GetDaughter(*u)->GetVolume();
366  if (neighbourVolume == data.m_node->GetVolume())
367  {
368  toAdd = false;
369  // printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
370  break;
371  }
372  }
373 
374  if (toAdd)
375  {
376  vi.push_back(n);
377  if (m_filterOff)
378  {
379  // std::cout << data.nameIndent() << std::endl;
380  m_row_to_index.push_back(idx);
381  if (data.testBit(kExpanded)) recalculateVisibilityVolumeRec(idx);
382  }
383  else
384  {
385  assertNodeFilterCache(data);
386  if (data.testBitAny(kMatches | kChildMatches)) m_row_to_index.push_back(idx);
387  if (data.testBit(kChildMatches) && data.testBit(kExpanded)) recalculateVisibilityVolumeRec(idx);
388  }
389  }
390  FWGeometryTableManagerBase::getNNodesTotal(parentNode->GetDaughter(n), dOff);
391  }
392 }
void assertNodeFilterCache(NodeInfo &data)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FWGeometryTableManager::resetRegionOfInterest ( )
void FWGeometryTableManager::setDaughtersSelfVisibility ( int  i,
bool  v 
)
virtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 480 of file FWGeometryTableManager.cc.

References data, FWGeometryTableManagerBase::getNNodesTotal(), FWGeometryTableManagerBase::m_entries, n, setVisibility(), and setVisibilityChld().

481 {
482  TGeoNode *parentNode = m_entries[selectedIdx].m_node;
483  int nD = parentNode->GetNdaughters();
484  int dOff = 0;
485  for (int n = 0; n != nD; ++n)
486  {
487  int idx = selectedIdx + 1 + n + dOff;
488  NodeInfo& data = m_entries[idx];
489 
490  setVisibility(data, v);
491  setVisibilityChld(data, v);
492 
493  FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
494  }
495 }
virtual void setVisibility(NodeInfo &nodeInfo, bool)
virtual void setVisibilityChld(NodeInfo &nodeInfo, bool)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
mathSSE::Vec4< T > v
void FWGeometryTableManager::setVisibility ( NodeInfo nodeInfo,
bool  x 
)
virtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 445 of file FWGeometryTableManager.cc.

References FWGeometryTableViewManager::getGeoMangeur(), FWGeometryTableView::getVolumeMode(), FWGeometryTableManagerBase::kVisNodeSelf, m_browser, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::NodeInfo::setBitVal(), and x.

Referenced by assertNodeFilterCache(), setDaughtersSelfVisibility(), and FWGeometryTableView::updateFilter().

446 {
447  if (m_browser->getVolumeMode())
448  {
449  if (data.m_node->GetVolume()->IsVisible() != x)
450  {
452  data.m_node->GetVolume()->SetVisibility(x);
453  }
454  }
455  else
456  {
457  data.setBitVal(kVisNodeSelf, x);
458  }
459 }
FWGeometryTableView * m_browser
bool getVolumeMode() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: DDAxes.h:10
void FWGeometryTableManager::setVisibilityChld ( NodeInfo nodeInfo,
bool  x 
)
virtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 463 of file FWGeometryTableManager.cc.

References FWGeometryTableViewManager::getGeoMangeur(), FWGeometryTableView::getVolumeMode(), FWGeometryTableManagerBase::kVisNodeChld, m_browser, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::NodeInfo::setBitVal(), and x.

Referenced by assertNodeFilterCache(), setDaughtersSelfVisibility(), and FWGeometryTableView::updateFilter().

464 {
465  if (m_browser->getVolumeMode())
466  {
467  if (data.m_node->GetVolume()->IsVisibleDaughters() != x)
468  {
469  TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur());
470  data.m_node->GetVolume()->VisibleDaughters(x);
471  }
472  }
473  else
474  {
475  data.setBitVal(kVisNodeChld, x);
476  }
477 }
FWGeometryTableView * m_browser
bool getVolumeMode() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: DDAxes.h:10
void FWGeometryTableManager::updateFilter ( int  iType)

Definition at line 211 of file FWGeometryTableManager.cc.

References assertNodeFilterCache(), checkChildMatches(), FWGeometryTableView::getFilter(), i, kFilterCached, FWGeometryTableView::kFilterMaterialName, FWGeometryTableView::kFilterMaterialTitle, FWGeometryTableView::kFilterShapeClassName, FWGeometryTableView::kFilterShapeName, m_browser, FWGeometryTableManagerBase::m_entries, m_filterOff, and m_volumes.

Referenced by loadGeometry(), FWGeometryTableView::setFrom(), and FWGeometryTableView::updateFilter().

212 {
213  std::string filterExp = m_browser->getFilter();
214  m_filterOff = filterExp.empty();
215  printf("update filter %s OFF %d volumes size %d\n",filterExp.c_str(), m_filterOff , (int)m_volumes.size());
216 
217  if (m_filterOff || m_entries.empty()) return;
218 
219  // update volume-match entries
220  int numMatched = 0;
221  for (Volumes_i i = m_volumes.begin(); i != m_volumes.end(); ++i)
222  {
223  const char* res = 0;
224 
226  {
227  res = strcasestr( i->first->GetMaterial()->GetName() , filterExp.c_str());
228  }
230  {
231  res = strcasestr( i->first->GetMaterial()->GetTitle() , filterExp.c_str());
232  }
233  else if (iType == FWGeometryTableView::kFilterShapeName)
234  {
235  res = strcasestr( i->first->GetShape()->GetName() , filterExp.c_str());
236  }
238  {
239  res = strcasestr( i->first->GetShape()->ClassName() , filterExp.c_str());
240  }
241 
242  i->second.m_matches = (res != 0);
243  i->second.m_childMatches = false;
244  if (res != 0) numMatched++;
245  }
246 
247  printf("update filter [%d] volumes matched\n", numMatched);
248  std::vector<TGeoVolume*> pstack;
249  checkChildMatches(m_entries[0].m_node->GetVolume(), pstack);
250 
251  for (Entries_i ni = m_entries.begin(); ni != m_entries.end(); ++ni)
252  {
253  ni->resetBit(kFilterCached);
255  }
256 
257 }
FWGeometryTableView * m_browser
int i
Definition: DBlmapReader.cc:9
std::string getFilter() const
void assertNodeFilterCache(NodeInfo &data)
void checkChildMatches(TGeoVolume *v, std::vector< TGeoVolume * > &)
Volumes_t::iterator Volumes_i

Member Data Documentation

FWGeometryTableView* FWGeometryTableManager::m_browser
private
bool FWGeometryTableManager::m_filterOff
private
Volumes_t FWGeometryTableManager::m_volumes
mutableprivate