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 | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
FWGeometryTableManager Class Reference

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

Inheritance diagram for FWGeometryTableManager:
FWTableManagerBase

Classes

class  ColorBoxRenderer
 
struct  Match
 
struct  NodeInfo
 

Public Types

enum  Bits {
  kExpanded = BIT(0), kMatches = BIT(1), kChildMatches = BIT(2), kFilterCached = BIT(3),
  kVisNode = BIT(4), kVisNodeChld = BIT(5)
}
 
enum  ECol {
  kName, kColor, kVisSelf, kVisChild,
  kMaterial, kPosX, kPosY, kPosZ,
  kNumCol
}
 
typedef Entries_v::iterator Entries_i
 
typedef std::vector< NodeInfoEntries_v
 
typedef Volumes_t::iterator Volumes_i
 
typedef boost::unordered_map
< TGeoVolume *, Match
Volumes_t
 

Public Member Functions

void assertNodeFilterCache (NodeInfo &data)
 
virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const
 
 FWGeometryTableManager (FWGeometryTableView *)
 
int getLevelOffset () const
 
void getNodeMatrix (const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
 
void getNodePath (int, std::string &) const
 
virtual std::vector< std::string > getTitles () const
 returns the title names for each column More...
 
bool getVisibility (const NodeInfo &nodeInfo) const
 
bool getVisibilityChld (const NodeInfo &nodeInfo) const
 
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 numberOfColumns () const
 Number of columns in the table. More...
 
virtual int numberOfRows () const
 Number of rows in the table. More...
 
void printChildren (int) const
 
Entries_vrefEntries ()
 
Entries_i refSelected ()
 
virtual bool rowIsSelected (int row) const
 
std::vector< int > rowToIndex ()
 
int selectedColumn () const
 
int selectedRow () const
 
void setBackgroundToWhite (bool)
 
void setDaughtersSelfVisibility (bool)
 
void setSelection (int row, int column, int mask)
 
void setVisibility (NodeInfo &nodeInfo, bool)
 
void setVisibilityChld (NodeInfo &nodeInfo, bool)
 
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 ~FWGeometryTableManager ()
 
- 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 ()
 

Static Public Member Functions

static void getNNodesTotal (TGeoNode *geoNode, int &off)
 

Private Member Functions

void changeSelection (int iRow, int iColumn)
 
void checkChildMatches (TGeoVolume *v, std::vector< TGeoVolume * > &)
 
void checkExpandLevel ()
 
void checkHierarchy ()
 
void firstColumnClicked (int row)
 
 FWGeometryTableManager (const FWGeometryTableManager &)
 
void importChildren (int parent_idx)
 
const FWGeometryTableManageroperator= (const FWGeometryTableManager &)
 
void printMaterials ()
 
void recalculateVisibility ()
 
void recalculateVisibilityNodeRec (int)
 
void recalculateVisibilityVolumeRec (int)
 
void redrawTable ()
 
void topGeoNodeChanged (int)
 
void updateFilter ()
 

Private Attributes

FWGeometryTableViewm_browser
 
ColorBoxRenderer m_colorBoxRenderer
 
Entries_v m_entries
 
bool m_filterOff
 
int m_levelOffset
 
int m_numVolumesMatched
 
FWTextTreeCellRenderer m_renderer
 
std::vector< int > m_row_to_index
 
int m_selectedColumn
 
int m_selectedIdx
 
int m_selectedRow
 
int m_topGeoNodeIdx
 
Volumes_t m_volumes
 

Friends

class FWGeometryTableView
 

Additional Inherited Members

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 40 of file FWGeometryTableManager.h.

Member Typedef Documentation

typedef Entries_v::iterator FWGeometryTableManager::Entries_i

Definition at line 96 of file FWGeometryTableManager.h.

Definition at line 95 of file FWGeometryTableManager.h.

typedef Volumes_t::iterator FWGeometryTableManager::Volumes_i

Definition at line 99 of file FWGeometryTableManager.h.

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

Definition at line 98 of file FWGeometryTableManager.h.

Member Enumeration Documentation

Enumerator
kExpanded 
kMatches 
kChildMatches 
kFilterCached 
kVisNode 
kVisNodeChld 

Definition at line 47 of file FWGeometryTableManager.h.

Constructor & Destructor Documentation

FWGeometryTableManager::FWGeometryTableManager ( FWGeometryTableView browser)

Definition at line 114 of file FWGeometryTableManager.cc.

References FWTextTableCellRenderer::height(), m_colorBoxRenderer, FWGeometryTableManager::ColorBoxRenderer::m_height, m_renderer, and FWGeometryTableManager::ColorBoxRenderer::m_width.

115 : m_selectedRow(-1),
116  m_selectedIdx(0),
117  m_selectedColumn(-1),
118  m_browser(browser),
119  m_filterOff(true),
121  m_levelOffset(0)
122 {
125 }
FWGeometryTableView * m_browser
virtual UInt_t height() const
returns the minimum height of the cell to which the renderer is representing
FWTextTreeCellRenderer m_renderer
ColorBoxRenderer m_colorBoxRenderer
FWGeometryTableManager::~FWGeometryTableManager ( )
virtual

Definition at line 127 of file FWGeometryTableManager.cc.

128 {
129 }
FWGeometryTableManager::FWGeometryTableManager ( const FWGeometryTableManager )
private

Member Function Documentation

void FWGeometryTableManager::assertNodeFilterCache ( NodeInfo data)

Definition at line 367 of file FWGeometryTableManager.cc.

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

Referenced by FWGeoTopNode::Paint(), FWGeoTopNode::paintChildNodesRecurse(), recalculateVisibility(), recalculateVisibilityNodeRec(), and recalculateVisibilityVolumeRec().

368 {
369  if (!data.testBit(kFilterCached))
370  {
371  bool matches = m_volumes[data.m_node->GetVolume()].m_matches;
372  data.setBitVal(kMatches, matches);
373  setVisibility(data, matches);
374 
375  bool childMatches = m_volumes[data.m_node->GetVolume()].m_childMatches;
376  data.setBitVal(kChildMatches, childMatches);
377  data.setBitVal(kExpanded, childMatches);
378  setVisibilityChld(data, childMatches);
379 
380 
381  data.setBit(kFilterCached);
382  // printf("%s matches [%d] childMatches [%d] ................ %d %d \n", data.name(), data.testBit(kMatches), data.testBit(kChildMatches), matches , childMatches);
383  }
384 }
void setVisibility(NodeInfo &nodeInfo, bool)
void setVisibilityChld(NodeInfo &nodeInfo, bool)
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 232 of file FWGeometryTableManager.cc.

References runTheMatrix::data, getNodeMatrix(), getVisibility(), getVisibilityChld(), FWGeometryTableView::getVolumeMode(), FWTextTreeCellRenderer::iconWidth(), kChildMatches, kColor, kExpanded, kMaterial, kName, kPosX, kPosY, kPosZ, kVisChild, kVisSelf, testEve_cfg::level, m_browser, FWGeometryTableManager::NodeInfo::m_color, m_colorBoxRenderer, m_entries, m_filterOff, FWGeometryTableManager::NodeInfo::m_level, m_levelOffset, FWGeometryTableManager::NodeInfo::m_node, m_renderer, m_row_to_index, m_volumes, pos, FWTextTableCellRenderer::setData(), FWGeometryTableManager::ColorBoxRenderer::setData(), FWTextTreeCellRenderer::setIndentation(), FWTextTreeCellRenderer::setIsOpen(), FWTextTreeCellRenderer::setIsParent(), FWGeometryTableManager::NodeInfo::testBit(), and zero.

233 {
234  struct Cache
235  {
236  TGeoHMatrix mtx;
237  double pos[3];
238  int row;
239 
240  };
241 
242  static Cache mxCache;
243  if (static_cast<int>(m_row_to_index.size()) <= iSortedRowNumber)
244  {
245  m_renderer.setData(std::string("FWGeometryTableManager::cellRenderer() Error!"), false);
246  return &m_renderer;
247  }
248 
249  static char sval[12];
250  static std::string zero = "0.000";
251 
252  FWTextTreeCellRenderer* renderer = &m_renderer;
253 
254  int unsortedRow = m_row_to_index[iSortedRowNumber];
255  const NodeInfo& data = m_entries[unsortedRow];
256  TGeoNode& gn = *data.m_node;
257 
258  bool isSelected = (iCol == kMaterial ) && (!m_filterOff && m_volumes[gn.GetVolume()].m_matches);//(m_selectedRow == unsortedRow);
259 
260  if (iCol == kName)
261  {
262  //int nD = getNdaughtersLimited(data.m_node);
263  int nD = data.m_node->GetNdaughters();
264  if (m_browser->getVolumeMode())
265  renderer->setData(Form("%s [%d]", gn.GetVolume()->GetName(), nD), isSelected);
266  else
267  renderer->setData(Form("%s [%d]", gn.GetName(), nD), isSelected);
268 
269  renderer->setIsParent((gn.GetNdaughters() > 0) && (m_filterOff || data.testBit(kChildMatches) ));
270 
271  renderer->setIsOpen( data.testBit(FWGeometryTableManager::kExpanded));
272 
273  int level = data.m_level - m_levelOffset;
274 
275  if (data.m_node->GetNdaughters())
276  renderer->setIndentation(20*level);
277  else
278  renderer->setIndentation(20*level + FWTextTreeCellRenderer::iconWidth());
279 
280  return renderer;
281  }
282  else
283  {
284  // printf("title %s \n",data.m_node->GetTitle() );
285  renderer->setIsParent(false);
286  renderer->setIndentation(0);
287  if (iCol == kColor)
288  {
289  // m_colorBoxRenderer.setData(data.m_node->GetVolume()->GetLineColor(), isSelected);
290  m_colorBoxRenderer.setData(data.m_color, isSelected);
291  return &m_colorBoxRenderer;
292  }
293  else if (iCol == kVisSelf )
294  {
295  renderer->setData(getVisibility(data) ? "On" : "-", isSelected );
296  return renderer;
297  }
298  else if (iCol == kVisChild )
299  {
300  renderer->setData( getVisibilityChld(data) ? "On" : "-", isSelected);
301  return renderer;
302  }
303  else if (iCol == kMaterial )
304  {
305  renderer->setData( gn.GetVolume()->GetMaterial()->GetName(), isSelected);
306  return renderer;
307  }
308 
309  else if (iCol == kPosX || iCol == kPosY || iCol == kPosZ)
310  {
311  if (mxCache.row != iSortedRowNumber) {
312  mxCache.row = iSortedRowNumber;
313  mxCache.pos[0] = 0; mxCache.pos[1] = 0; mxCache.pos[2] = 0;
314  mxCache.mtx.Clear();
315  getNodeMatrix(data, mxCache.mtx);
316  TGeoBBox* bb = static_cast<TGeoBBox*>(data.m_node->GetVolume()->GetShape());
317  const double* origin = bb->GetOrigin();
318  mxCache.mtx.LocalToMaster(origin, mxCache.pos);
319  }
320  float val = mxCache.pos[iCol - kPosX];
321  if (val < 0.001) {
322  renderer->setData(zero, isSelected);
323  }
324  else {
325  snprintf(sval, sizeof(sval), "%.3f", val);
326  renderer->setData(sval, isSelected);
327 
328  }
329 
330  return renderer;
331  }
332  else
333  {
334  TGeoBBox* gs = static_cast<TGeoBBox*>( gn.GetVolume()->GetShape());
335  float val = TMath::Sqrt(gs->GetDX()*gs->GetDX() + gs->GetDY()*gs->GetDY() +gs->GetDZ()*gs->GetDZ() );
336  // renderer->setData( Form("%.3f", TMath::Sqrt(gs->GetDX()*gs->GetDX() + gs->GetDY()*gs->GetDY() +gs->GetDZ()*gs->GetDZ() )), isSelected);
337  if (val < 0.001) {
338  renderer->setData(zero, isSelected);
339  }
340  else {
341  snprintf(sval, sizeof(sval), "%.3f", val);
342  renderer->setData(sval, isSelected);
343  }
344  return renderer;
345  }
346 
347  }
348 }
FWGeometryTableView * m_browser
bool getVisibilityChld(const NodeInfo &nodeInfo) const
FWTextTreeCellRenderer m_renderer
ColorBoxRenderer m_colorBoxRenderer
std::vector< int > m_row_to_index
bool getVisibility(const NodeInfo &nodeInfo) const
virtual void setIndentation(int indentation=0)
void setData(const std::string &, bool isSelected)
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
bool getVolumeMode() const
tuple level
Definition: testEve_cfg.py:34
void FWGeometryTableManager::changeSelection ( int  iRow,
int  iColumn 
)
private

Definition at line 195 of file FWGeometryTableManager.cc.

References m_row_to_index, m_selectedColumn, m_selectedIdx, m_selectedRow, and FWTableManagerBase::visualPropertiesChanged().

Referenced by redrawTable(), and setSelection().

196 {
197  if (iRow < 0) return;
198 
199  m_selectedRow = iRow;
200  m_selectedColumn = iColumn;
201  if (m_row_to_index.size() > 0) m_selectedIdx = m_row_to_index[iRow];
202 
203  // printf("WGeometryTableManager::changeSelecti row %d index %d \n", m_selectedIdx, m_selectedIdx );
205 }
std::vector< int > m_row_to_index
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
void FWGeometryTableManager::checkChildMatches ( TGeoVolume *  v,
std::vector< TGeoVolume * > &  pstack 
)
private

Definition at line 613 of file FWGeometryTableManager.cc.

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

Referenced by updateFilter().

614 {
615  if (m_volumes[vol].m_matches)
616  {
617  for (std::vector<TGeoVolume*>::iterator i = pstack.begin(); i!= pstack.end(); ++i)
618  {
619  Match& pm = m_volumes[*i];
620  pm.m_childMatches = true;
621  }
622  }
623 
624  pstack.push_back(vol);
625 
626  int nD = vol->GetNdaughters();//TMath::Min(m_browser->getMaxDaughters(), vol->GetNdaughters());
627  for (int i = 0; i!=nD; ++i)
628  checkChildMatches(vol->GetNode(i)->GetVolume(), pstack);
629 
630  pstack.pop_back();
631 }
int i
Definition: DBlmapReader.cc:9
Definition: Match.h:7
void checkChildMatches(TGeoVolume *v, std::vector< TGeoVolume * > &)
void FWGeometryTableManager::checkExpandLevel ( )
private

Definition at line 695 of file FWGeometryTableManager.cc.

References FWGeometryTableView::getAutoExpand(), i, kExpanded, m_browser, m_entries, and m_levelOffset.

Referenced by FWGeometryTableView::autoExpandChanged(), FWGeometryTableView::setPath(), and FWGeometryTableView::updateFilter().

696 {
697  // check expand state
698  int ae = m_browser->getAutoExpand() + m_levelOffset;
699  for (Entries_i i = m_entries.begin(); i != m_entries.end(); ++i)
700  {
701  if (i->m_level < ae)
702  i->setBit(kExpanded);
703  else
704  i->resetBit(kExpanded);
705  }
706 }
FWGeometryTableView * m_browser
int i
Definition: DBlmapReader.cc:9
Entries_v::iterator Entries_i
void FWGeometryTableManager::checkHierarchy ( )
private

Definition at line 589 of file FWGeometryTableManager.cc.

References i, m_entries, mergeVDriftHistosByStation::name, convertSQLiteXML::ok, and redTxt.

590 {
591  // Used for debug: in a NodeInfo entry look TGeoNode children from parent index and check
592  // if child is found.
593 
594  for ( size_t i = 0, e = m_entries.size(); i != e; ++i )
595  {
596  if ( m_entries[i].m_level > 0)
597  {
598  TGeoNode* pn = m_entries[m_entries[i].m_parent].m_node;
599  bool ok = false;
600  for (int d = 0; d < pn->GetNdaughters(); ++d )
601  {
602  if (m_entries[i].m_node == pn->GetDaughter(d))
603  {
604  ok = true;
605  break;
606  }
607  }
608  if (!ok) printf("%s!!!!!! node %s has false parent %s \n", redTxt, m_entries[i].name(), pn->GetName());
609  }
610  }
611 }
int i
Definition: DBlmapReader.cc:9
static const char * redTxt
void FWGeometryTableManager::firstColumnClicked ( int  row)
private

Definition at line 351 of file FWGeometryTableManager.cc.

References FWTableManagerBase::dataChanged(), kExpanded, m_entries, recalculateVisibility(), rowToIndex(), and FWTableManagerBase::visualPropertiesChanged().

Referenced by FWGeometryTableView::cellClicked().

352 {
353  if (row == -1)
354  return;
355 
356  int idx = rowToIndex()[row];
357  // printf("click %s \n", m_entries[idx].name());
358 
359  m_entries[idx].switchBit(kExpanded);
360 
362  dataChanged();
364 }
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
std::vector< int > rowToIndex()
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
int FWGeometryTableManager::getLevelOffset ( ) const
inline

Definition at line 154 of file FWGeometryTableManager.h.

References m_levelOffset.

Referenced by FWGeoTopNode::Paint().

void FWGeometryTableManager::getNNodesTotal ( TGeoNode *  geoNode,
int &  off 
)
inlinestatic

Definition at line 228 of file FWGeometryTableManager.h.

References i.

Referenced by importChildren(), loadGeometry(), FWGeoTopNode::paintChildNodesRecurse(), recalculateVisibilityNodeRec(), recalculateVisibilityVolumeRec(), and setDaughtersSelfVisibility().

229 {
230  int nD = geoNode->GetNdaughters();
231  off += nD;
232  for (int i = 0; i < nD; ++i )
233  {
234  getNNodesTotal(geoNode->GetDaughter(i), off);
235  }
236 }
int i
Definition: DBlmapReader.cc:9
static void getNNodesTotal(TGeoNode *geoNode, int &off)
void FWGeometryTableManager::getNodeMatrix ( const NodeInfo nodeInfo,
TGeoHMatrix &  mat 
) const

Definition at line 761 of file FWGeometryTableManager.cc.

References prof2calltree::l, m_entries, FWGeometryTableManager::NodeInfo::m_level, FWGeometryTableManager::NodeInfo::m_node, and FWGeometryTableManager::NodeInfo::m_parent.

Referenced by cellRenderer(), FWGeometryTableView::chosenItem(), and FWGeoTopNode::Paint().

762 {
763  // utility used by browser and FWGeoNode
764 
765  int pIdx = data.m_parent;
766  int endl = data.m_level -1;
767  for (int l = 0 ; l < endl ; ++l)
768  {
769  pIdx = m_entries.at(pIdx).m_parent;
770  mtx.MultiplyLeft(m_entries.at(pIdx).m_node->GetMatrix());
771  }
772 
773  mtx.Multiply(data.m_node->GetMatrix());
774 }
void FWGeometryTableManager::getNodePath ( int  idx,
std::string &  path 
) const

Definition at line 674 of file FWGeometryTableManager.cc.

References i, m_entries, and mergeVDriftHistosByStation::name.

Referenced by FWGeometryTableView::cdNode(), FWGeometryTableView::cdUp(), and printChildren().

675 {
676  std::vector<std::string> relPath;
677  while(idx >= 0)
678  {
679  relPath.push_back( m_entries[idx].name());
680  // printf("push %s \n",m_entries[idx].name() );
681  idx = m_entries[idx].m_parent;
682  }
683 
684  size_t ns = relPath.size();
685  for (size_t i = 1; i < ns; ++i )
686  {
687  path +="/";
688  path += relPath[ns-i -1];
689  // printf("push_back add to path %s\n", path.c_str());
690  }
691 }
int i
Definition: DBlmapReader.cc:9
int path() const
Definition: HLTadd.h:3
std::vector< std::string > FWGeometryTableManager::getTitles ( ) const
virtual

returns the title names for each column

Implements FWTableManagerBase.

Definition at line 148 of file FWGeometryTableManager.cc.

References FWGeometryTableView::getVolumeMode(), m_browser, and numberOfColumns().

149 {
150  std::vector<std::string> returnValue;
151  returnValue.reserve(numberOfColumns());
152 
153  if (m_browser->getVolumeMode() )
154  returnValue.push_back("Volume Name");
155  else
156  returnValue.push_back("Node Name");
157 
158  returnValue.push_back("Color");
159  returnValue.push_back("RnrSelf");
160  returnValue.push_back("RnrChildren");
161  returnValue.push_back("Material");
162  returnValue.push_back("X");
163  returnValue.push_back("Y");
164  returnValue.push_back("Z");
165  // returnValue.push_back("Diagonal");
166 
167  return returnValue;
168 }
FWGeometryTableView * m_browser
bool getVolumeMode() const
virtual int numberOfColumns() const
Number of columns in the table.
bool FWGeometryTableManager::getVisibility ( const NodeInfo nodeInfo) const
bool FWGeometryTableManager::getVisibilityChld ( const NodeInfo nodeInfo) const
virtual void FWGeometryTableManager::implSort ( int  iCol,
bool  iSortOrder 
)
inlinevirtual

Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.

Implements FWTableManagerBase.

Definition at line 142 of file FWGeometryTableManager.h.

142 {}
void FWGeometryTableManager::importChildren ( int  parent_idx)
private

Definition at line 564 of file FWGeometryTableManager.cc.

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

Referenced by loadGeometry().

565 {
566  NodeInfo& parent = m_entries[parent_idx];
567  TGeoNode* parentGeoNode = parent.m_node;
568  int parentLevel = parent.m_level;
569 
570  int nV = parentGeoNode->GetNdaughters();
571  int dOff = 0;
572  for (int n = 0; n != nV; ++n)
573  {
574  NodeInfo& data = m_entries[parent_idx + n + 1 + dOff];
575  data.m_node = parentGeoNode->GetDaughter(n);
576  data.m_level = parentLevel + 1;
577  data.m_parent = parent_idx;
578  data.m_color = data.m_node->GetVolume()->GetLineColor();
579  if (data.m_level <= m_browser->getAutoExpand()) data.setBit(kExpanded);
580 
581 
582  importChildren(parent_idx + n + 1 + dOff);
583  getNNodesTotal(parentGeoNode->GetDaughter(n), dOff);
584  }
585 }
FWGeometryTableView * m_browser
list parent
Definition: dbtoconf.py:74
static void getNNodesTotal(TGeoNode *geoNode, int &off)
void importChildren(int parent_idx)
void FWGeometryTableManager::loadGeometry ( TGeoNode *  iGeoTopNode,
TObjArray *  iVolumes 
)

Definition at line 511 of file FWGeometryTableManager.cc.

References FWGeometryTableView::getAutoExpand(), getNNodesTotal(), importChildren(), kExpanded, m_browser, m_entries, m_filterOff, FWGeometryTableManager::NodeInfo::m_level, m_levelOffset, FWGeometryTableManager::NodeInfo::m_node, FWGeometryTableManager::NodeInfo::m_parent, m_row_to_index, m_volumes, MultipleCompare::Match(), FWGeometryTableManager::NodeInfo::setBit(), updateFilter(), and v.

Referenced by FWGeometryTableView::FWGeometryTableView().

512 {
513 #ifdef PERFTOOL_GEO_TABLE
514  ProfilerStart("loadGeo");
515 #endif
516 
517  // Prepare data for cell render.
518 
519  // clear entries
520  m_entries.clear();
521  m_row_to_index.clear();
522  m_volumes.clear();
523  m_levelOffset = 0;
524 
525  // set volume table for filters
526  boost::unordered_map<TGeoVolume*, Match> pipi(iVolumes->GetSize());
527  m_volumes.swap(pipi);
528  TIter next( iVolumes);
529  TGeoVolume* v;
530  while ((v = (TGeoVolume*) next()) != 0)
531  m_volumes.insert(std::make_pair(v, Match()));
532 
533  if (!m_filterOff)
534  updateFilter();
535 
536  // add top node to init
537 
538  int nTotal = 0;
539  NodeInfo topNodeInfo;
540  topNodeInfo.m_node = iGeoTopNode;
541  topNodeInfo.m_level = 0;
542  topNodeInfo.m_parent = -1;
543  if (m_browser->getAutoExpand())
544  topNodeInfo.setBit(kExpanded);
545 
546  getNNodesTotal(topNodeInfo.m_node , nTotal);
547  m_entries.resize(nTotal+1);
548  m_entries[0] = topNodeInfo;
549 
550  importChildren(0);
551 
552  // checkHierarchy();
553 
554 #ifdef PERFTOOL_GEO_TABLE
555  ProfilerStop();
556 #endif
557 }
FWGeometryTableView * m_browser
std::vector< int > m_row_to_index
static void getNNodesTotal(TGeoNode *geoNode, int &off)
void importChildren(int parent_idx)
mathSSE::Vec4< T > v
bool FWGeometryTableManager::nodeImported ( int  idx) const
int FWGeometryTableManager::numberOfColumns ( ) const
virtual

Number of columns in the table.

Implements FWTableManagerBase.

Definition at line 142 of file FWGeometryTableManager.cc.

References kNumCol.

Referenced by getTitles().

int FWGeometryTableManager::numberOfRows ( ) const
virtual

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 137 of file FWGeometryTableManager.cc.

References m_row_to_index.

138 {
139  return m_row_to_index.size();
140 }
std::vector< int > m_row_to_index
const FWGeometryTableManager& FWGeometryTableManager::operator= ( const FWGeometryTableManager )
private
void FWGeometryTableManager::printChildren ( int  idx) const

Definition at line 721 of file FWGeometryTableManager.cc.

References getNodePath(), m_entries, mergeVDriftHistosByStation::name, and path().

Referenced by FWGeometryTableView::printTable().

722 {
723  // static double pnt[3];
724  std::string path;
725  getNodePath(idx, path);
726  printf("My %s parent %s path %d \n",m_entries[idx].name(),path.c_str(), m_entries[idx].m_parent );
727  /*
728  for (int i =0, k = m_entries.size(); i < k; ++i)
729  {
730  const NodeInfo& ni = m_entries[i];
731  if (ni.m_parent == idx)
732  {
733  std::string indent(ni.m_level*3 , ' ');
734 
735  // printf("%s%s (%.2f, %.2f, %.2f)\n",indent.c_str(), ni.name(), pnt[0], pnt[1], pnt[2]);
736  printf("%s%s \n",indent.c_str(), ni.name());
737 
738  printChildren(i);
739  }
740  }*/
741 }
void getNodePath(int, std::string &) const
int path() const
Definition: HLTadd.h:3
void FWGeometryTableManager::printMaterials ( )
private

Definition at line 832 of file FWGeometryTableManager.cc.

References i, m, m_entries, and m_selectedIdx.

Referenced by FWGeometryTableView::chosenItem().

833 {
834  std::map<TGeoMaterial*, std::string> mlist;
835  Entries_i it = m_entries.begin();
836  std::advance(it, m_selectedIdx );
837  int nLevel = it->m_level;
838  it++;
839  while (it->m_level > nLevel)
840  {
841  TGeoMaterial* m = it->m_node->GetVolume()->GetMaterial();
842  if (mlist.find(m) == mlist.end())
843  {
844  mlist[m] = m->GetName();
845  }
846  it++;
847  }
848 
849  printf("size %d \n", (int)mlist.size());
850  for(std::map<TGeoMaterial*, std::string>::iterator i = mlist.begin(); i != mlist.end(); ++i)
851  {
852  printf("material %s \n", i->second.c_str());
853  }
854 
855 }
int i
Definition: DBlmapReader.cc:9
Entries_v::iterator Entries_i
void FWGeometryTableManager::recalculateVisibility ( )
private

Definition at line 388 of file FWGeometryTableManager.cc.

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

Referenced by firstColumnClicked(), and redrawTable().

389 {
390  m_row_to_index.clear();
391  int i = TMath::Max(0, m_browser->getTopNodeIdx());
392  m_row_to_index.push_back(i);
393 
394  NodeInfo& data = m_entries[i];
395  if (!m_filterOff)
396  assertNodeFilterCache(data);
397 
398  if ((m_filterOff && data.testBit(kExpanded) == false) ||
399  (m_filterOff == false && data.testBit(kChildMatches) == false) )
400  return;
401 
402 
403  if (m_browser->getVolumeMode())
405  else
407 
408  // printf (" child [%d] FWGeometryTableManager::recalculateVisibility table size %d \n", (int)m_row_to_index.size());
409 }
FWGeometryTableView * m_browser
int i
Definition: DBlmapReader.cc:9
std::vector< int > m_row_to_index
void assertNodeFilterCache(NodeInfo &data)
bool getVolumeMode() const
void FWGeometryTableManager::recalculateVisibilityNodeRec ( int  pIdx)
private

Definition at line 412 of file FWGeometryTableManager.cc.

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

Referenced by recalculateVisibility().

413 {
414  TGeoNode* parentNode = m_entries[pIdx].m_node;
415  int nD = parentNode->GetNdaughters();
416  int dOff=0;
417  for (int n = 0; n != nD; ++n)
418  {
419  int idx = pIdx + 1 + n + dOff;
420  NodeInfo& data = m_entries[idx];
421 
422  if (m_filterOff)
423  {
424  m_row_to_index.push_back(idx);
425  if (data.testBit(kExpanded)) recalculateVisibilityNodeRec(idx);
426  }
427  else
428  {
429  assertNodeFilterCache(data);
430  if (data.testBitAny(kMatches | kChildMatches)) m_row_to_index.push_back(idx);
431  if (data.testBit(kChildMatches) && data.testBit(kExpanded) ) recalculateVisibilityNodeRec(idx);
432  }
433 
434  FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
435  }
436 }
std::vector< int > m_row_to_index
void assertNodeFilterCache(NodeInfo &data)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
void FWGeometryTableManager::recalculateVisibilityVolumeRec ( int  pIdx)
private

Definition at line 440 of file FWGeometryTableManager.cc.

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

Referenced by recalculateVisibility().

441 {
442  TGeoNode* parentNode = m_entries[pIdx].m_node;
443  int nD = parentNode->GetNdaughters();
444  int dOff=0;
445 
446  // printf("----------- parent %s\n", parentNode->GetName() );
447 
448  std::vector<int> vi;
449  vi.reserve(nD);
450 
451 
452  for (int n = 0; n != nD; ++n)
453  {
454  int idx = pIdx + 1 + n + dOff;
455  NodeInfo& data = m_entries[idx];
456 
457  bool toAdd = true;
458  for (std::vector<int>::iterator u = vi.begin(); u != vi.end(); ++u )
459  {
460  TGeoVolume* neighbourVolume = parentNode->GetDaughter(*u)->GetVolume();
461  if (neighbourVolume == data.m_node->GetVolume())
462  {
463  toAdd = false;
464  // printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
465  break;
466  }
467  }
468 
469  if (toAdd)
470  {
471  vi.push_back(n);
472  if (m_filterOff)
473  {
474  // std::cout << data.nameIndent() << std::endl;
475  m_row_to_index.push_back(idx);
476  if (data.testBit(kExpanded)) recalculateVisibilityVolumeRec(idx);
477  }
478  else
479  {
480  assertNodeFilterCache(data);
481  if (data.testBitAny(kMatches | kChildMatches)) m_row_to_index.push_back(idx);
482  if (data.testBit(kChildMatches) && data.testBit(kExpanded)) recalculateVisibilityVolumeRec(idx);
483  }
484  }
485  FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
486  }
487 }
std::vector< int > m_row_to_index
void assertNodeFilterCache(NodeInfo &data)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
void FWGeometryTableManager::redrawTable ( )
private

Definition at line 492 of file FWGeometryTableManager.cc.

References changeSelection(), FWTableManagerBase::dataChanged(), m_entries, recalculateVisibility(), and FWTableManagerBase::visualPropertiesChanged().

Referenced by FWGeometryTableView::autoExpandChanged(), FWGeometryTableView::refreshTable3D(), and FWGeometryTableView::setPath().

493 {
494  if (m_entries.empty()) return;
495 
496  changeSelection(0, 0);
497 
499 
500  // if (m_filterOff)
501  // m_statusMessage = Form("level:%d rows %d ", getLevelOffset(), (int)m_row_to_index.size());
502  // else
503  // m_statusMessage = Form("level:%d rows %d volumes %d (%.2f %%) selected ", getLevelOffset(), (int)m_row_to_index.size(), m_numVolumesMatched, 100.0* m_numVolumesMatched/m_volumes.size());
504 
505  dataChanged();
507 }
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
void changeSelection(int iRow, int iColumn)
Entries_v& FWGeometryTableManager::refEntries ( )
inline
FWGeometryTableManager::Entries_i FWGeometryTableManager::refSelected ( )

Definition at line 667 of file FWGeometryTableManager.cc.

References i, m_entries, and m_selectedIdx.

Referenced by FWGeometryTableView::cellClicked(), FWGeometryTableView::chosenItem(), FWGeoMaterialValidator::fillOptions(), and FWGeometryTableView::nodeColorChangeRequested().

668 {
669  Entries_i i = m_entries.begin();
670  std::advance(i,m_selectedIdx );
671  return i; //m_entries[m_selectedIdx];
672 }
int i
Definition: DBlmapReader.cc:9
Entries_v::iterator Entries_i
bool FWGeometryTableManager::rowIsSelected ( int  row) const
virtual

Definition at line 190 of file FWGeometryTableManager.cc.

References m_selectedRow.

191 {
192  return m_selectedRow == row;
193 }
std::vector<int> FWGeometryTableManager::rowToIndex ( )
inline

Definition at line 139 of file FWGeometryTableManager.h.

References m_row_to_index.

Referenced by firstColumnClicked().

139 { return m_row_to_index; }
std::vector< int > m_row_to_index
int FWGeometryTableManager::selectedColumn ( ) const

Definition at line 185 of file FWGeometryTableManager.cc.

References m_selectedColumn.

186 {
187  return m_selectedColumn;
188 }
int FWGeometryTableManager::selectedRow ( ) const

Definition at line 180 of file FWGeometryTableManager.cc.

References m_selectedRow.

181 {
182  return m_selectedRow;
183 }
void FWGeometryTableManager::setBackgroundToWhite ( bool  iToWhite)

Definition at line 207 of file FWGeometryTableManager.cc.

References FWTextTableCellRenderer::getDefaultHighlightGC(), m_renderer, FWTextTreeCellRenderer::setBlackIcon(), FWTextTableCellRenderer::setGraphicsContext(), and FWTextTableCellRenderer::setHighlightContext().

Referenced by FWGeometryTableView::setBackgroundColor().

208 {
209  if(iToWhite) {
210  m_renderer.setGraphicsContext(&TGFrame::GetBlackGC());
212  } else {
213  static const TGGC* s_blackHighLight = 0;
214  if (!s_blackHighLight) {
215  GCValues_t gval;
216  gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle | kGCGraphicsExposures;
217  gval.fForeground = 0xbbbbbb;
218  gval.fBackground = 0x000000;
219  gval.fFillStyle = kFillOpaqueStippled;
220  gval.fStipple = gClient->GetResourcePool()->GetCheckeredBitmap();
221  gval.fGraphicsExposures = kFALSE;
222  s_blackHighLight = gClient->GetGC(&gval, kTRUE);
223  }
224  m_renderer.setHighlightContext(s_blackHighLight);
225  m_renderer.setGraphicsContext(&TGFrame::GetWhiteGC());
226  }
227  m_renderer.setBlackIcon(iToWhite);
228 }
FWTextTreeCellRenderer m_renderer
void setHighlightContext(const TGGC *context)
static const TGGC & getDefaultHighlightGC()
void setGraphicsContext(const TGGC *iContext)
void FWGeometryTableManager::setDaughtersSelfVisibility ( bool  v)

Definition at line 743 of file FWGeometryTableManager.cc.

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

Referenced by FWGeometryTableView::chosenItem().

744 {
745  int dOff = 0;
746  TGeoNode* parentNode = m_entries[m_selectedIdx].m_node;
747  int nD = parentNode->GetNdaughters();
748  for (int n = 0; n != nD; ++n)
749  {
750  int idx = m_selectedIdx + 1 + n + dOff;
751  NodeInfo& data = m_entries[idx];
752 
753  setVisibility(data, v);
754  setVisibilityChld(data, v);
755 
756  FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
757  }
758 }
void setVisibility(NodeInfo &nodeInfo, bool)
void setVisibilityChld(NodeInfo &nodeInfo, bool)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
mathSSE::Vec4< T > v
void FWGeometryTableManager::setSelection ( int  row,
int  column,
int  mask 
)

Definition at line 170 of file FWGeometryTableManager.cc.

References changeSelection().

Referenced by FWGeometryTableView::cellClicked().

171 {
172  changeSelection(row, column);
173 }
void changeSelection(int iRow, int iColumn)
void FWGeometryTableManager::setVisibility ( NodeInfo nodeInfo,
bool  x 
)

Definition at line 777 of file FWGeometryTableManager.cc.

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

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

778 {
779  if (m_browser->getVolumeMode())
780  {
781  if (data.m_node->GetVolume()->IsVisible() != x)
782  {
783  TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur());
784  data.m_node->GetVolume()->SetVisibility(x);
785  }
786  }
787  else
788  {
789  data.setBitVal(kVisNode, x);
790  }
791 }
FWGeometryTableView * m_browser
static TGeoManager * getGeoMangeur()
bool getVolumeMode() const
Definition: DDAxes.h:10
void FWGeometryTableManager::setVisibilityChld ( NodeInfo nodeInfo,
bool  x 
)

Definition at line 793 of file FWGeometryTableManager.cc.

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

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

794 {
795  if (m_browser->getVolumeMode())
796  {
797  if (data.m_node->GetVolume()->IsVisibleDaughters() != x)
798  {
799  TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur());
800  data.m_node->GetVolume()->VisibleDaughters(x);
801  }
802  }
803  else
804  {
805  data.setBitVal(kVisNodeChld, x);
806  }
807 }
FWGeometryTableView * m_browser
static TGeoManager * getGeoMangeur()
bool getVolumeMode() const
Definition: DDAxes.h:10
const std::string FWGeometryTableManager::title ( ) const
virtual
void FWGeometryTableManager::topGeoNodeChanged ( int  idx)
private

Definition at line 711 of file FWGeometryTableManager.cc.

References m_entries, and m_levelOffset.

Referenced by FWGeometryTableView::setPath().

712 {
713  // cached
714  if (idx >= 0)
715  m_levelOffset = m_entries[idx].m_level;
716  else
717  m_levelOffset = 0;
718 
719 }
int FWGeometryTableManager::unsortedRowNumber ( int  iSortedRowNumber) const
virtual

when passed the index to the sorted order of the rows it returns the original row number from the underlying data

Implements FWTableManagerBase.

Definition at line 132 of file FWGeometryTableManager.cc.

133 {
134  return unsorted;
135 }
void FWGeometryTableManager::updateFilter ( )
private

Definition at line 635 of file FWGeometryTableManager.cc.

References checkChildMatches(), FWGeometryTableView::getFilter(), FWGeometryTableView::getTopNodeIdx(), i, kFilterCached, m_browser, m_entries, m_filterOff, m_numVolumesMatched, m_volumes, and siStripFEDMonitor_P5_cff::Max.

Referenced by loadGeometry(), FWGeometryTableView::modeChanged(), FWGeometryTableView::setPath(), and FWGeometryTableView::updateFilter().

636 {
637  std::string filterExp = m_browser->getFilter();
638  m_filterOff = filterExp.empty();
639  // printf("update filter %s OFF %d volumes size %d\n",filterExp.c_str(), m_filterOff , (int)m_volumes.size());
640 
641  if (m_filterOff || m_entries.empty()) return;
642 
643  // update volume-match entries
645  for (Volumes_i i = m_volumes.begin(); i!= m_volumes.end(); ++i)
646  {
647  if (strcasestr(i->first->GetMaterial()->GetName(), filterExp.c_str()) > 0) {
648  i->second.m_matches = true;
650  }
651  else {
652  i->second.m_matches = false;
653  }
654  i->second.m_childMatches = false;
655  }
656 
657  std::vector<TGeoVolume*> pstack;
658  checkChildMatches(m_entries[TMath::Max(0,m_browser->getTopNodeIdx())].m_node->GetVolume(), pstack);
659 
660 
661  for (Entries_i ni = m_entries.begin(); ni != m_entries.end(); ++ni)
662  ni->resetBit(kFilterCached);
663 
664 }
FWGeometryTableView * m_browser
int i
Definition: DBlmapReader.cc:9
std::string getFilter() const
Entries_v::iterator Entries_i
void checkChildMatches(TGeoVolume *v, std::vector< TGeoVolume * > &)
Volumes_t::iterator Volumes_i

Friends And Related Function Documentation

friend class FWGeometryTableView
friend

Definition at line 42 of file FWGeometryTableManager.h.

Member Data Documentation

FWGeometryTableView* FWGeometryTableManager::m_browser
private
ColorBoxRenderer FWGeometryTableManager::m_colorBoxRenderer
mutableprivate

Definition at line 203 of file FWGeometryTableManager.h.

Referenced by cellRenderer(), and FWGeometryTableManager().

Entries_v FWGeometryTableManager::m_entries
private
bool FWGeometryTableManager::m_filterOff
private
int FWGeometryTableManager::m_levelOffset
private
int FWGeometryTableManager::m_numVolumesMatched
private

Definition at line 217 of file FWGeometryTableManager.h.

Referenced by updateFilter().

FWTextTreeCellRenderer FWGeometryTableManager::m_renderer
mutableprivate
std::vector<int> FWGeometryTableManager::m_row_to_index
private
int FWGeometryTableManager::m_selectedColumn
private

Definition at line 208 of file FWGeometryTableManager.h.

Referenced by changeSelection(), and selectedColumn().

int FWGeometryTableManager::m_selectedIdx
private
int FWGeometryTableManager::m_selectedRow
private

Definition at line 206 of file FWGeometryTableManager.h.

Referenced by changeSelection(), rowIsSelected(), and selectedRow().

int FWGeometryTableManager::m_topGeoNodeIdx
private

Definition at line 219 of file FWGeometryTableManager.h.

Volumes_t FWGeometryTableManager::m_volumes
mutableprivate