CMS 3D CMS Logo

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 *, MatchVolumes_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
virtual void applyColorTranspToDaughters (int selectedIdx, bool recurse)
 
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...
 
bool isNodeRendered (int idx, int top_node_idx) const
 
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 31 of file FWGeometryTableManager.h.

Member Typedef Documentation

typedef Volumes_t::iterator FWGeometryTableManager::Volumes_i

Definition at line 54 of file FWGeometryTableManager.h.

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

Definition at line 53 of file FWGeometryTableManager.h.

Member Enumeration Documentation

Enumerator
kMatches 
kChildMatches 
kFilterCached 

Definition at line 36 of file FWGeometryTableManager.h.

Constructor & Destructor Documentation

FWGeometryTableManager::FWGeometryTableManager ( FWGeometryTableView v)

Definition at line 28 of file FWGeometryTableManager.cc.

Referenced by numberOfColumns().

FWGeometryTableManager::~FWGeometryTableManager ( )
virtual

Definition at line 34 of file FWGeometryTableManager.cc.

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

Member Function Documentation

void FWGeometryTableManager::assertNodeFilterCache ( NodeInfo data)

Definition at line 423 of file FWGeometryTableManager.cc.

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

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

424 {
425  if (! data.testBit(kFilterCached))
426  {
427  bool matches = m_volumes[data.m_node->GetVolume()].m_matches;
428  // if (matches) printf("%s matches filter \n", data.name());
429  data.setBitVal(kMatches, matches);
430  setVisibility(data, matches);
431 
432  bool childMatches = m_volumes[data.m_node->GetVolume()].m_childMatches;
433  data.setBitVal(kChildMatches, childMatches);
434  data.setBitVal(kExpanded, childMatches);
435  setVisibilityChld(data, childMatches);
436 
437  data.setBit(kFilterCached);
438  // printf("%s matches [%d] childMatches [%d] ................ %d %d \n", data.name(), data.testBit(kMatches), data.testBit(kChildMatches), matches , childMatches);
439  }
440 }
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 37 of file FWGeometryTableManager.cc.

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

Referenced by cellRenderer(), and numberOfColumns().

38 {
39  if (m_browser->getVolumeMode())
40  return Form("%s [%d]", data.m_node->GetVolume()->GetName(), data.m_node->GetNdaughters());
41  else
42  return Form("%s [%d]", data.m_node->GetName(), data.m_node->GetNdaughters());
43 }
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 47 of file FWGeometryTableManager.cc.

References cellName(), data, getVisibility(), getVisibilityChld(), FWTextTreeCellRenderer::iconWidth(), kColorColumn, FWGeometryTableManagerBase::kExpanded, FWGeometryTableManagerBase::kHighlighted, kMatches, kMaterialColumn, kNameColumn, FWGeometryTableManagerBase::kSelected, kTranspColumn, kVisChildColumn, kVisSelfColumn, hcalDigis_cfi::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().

Referenced by numberOfColumns().

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

Definition at line 185 of file FWGeometryTableManager.cc.

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

Referenced by updateFilter().

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

Definition at line 161 of file FWGeometryTableManager.cc.

References edmIntegrityCheck::d, MillePedeFileConverter_cfg::e, mps_fire::i, FWGeometryTableManagerBase::m_entries, dataset::name, and convertSQLiteXML::ok.

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

Definition at line 523 of file FWGeometryTableManager.cc.

References edmIntegrityCheck::d, delta, reco::dp, FWGeometryTableViewManager::getGeoMangeur(), mps_fire::i, FWGeometryTableView::kBBoxCenter, FWGeometryTableView::kBBoxSurface, FWGeometryTableManagerBase::kVisNodeChld, FWGeometryTableManagerBase::kVisNodeSelf, FWGeometryTableManagerBase::m_entries, alignCSCRings::r, TCMET_cfi::radius, and lumiQTWidget::t.

Referenced by FWGeometryTableView::checkRegionOfInterest(), and numberOfColumns().

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

Reimplemented from FWGeometryTableManagerBase.

Definition at line 498 of file FWGeometryTableManager.cc.

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

Referenced by cellRenderer().

499 {
500  if (m_browser->getVolumeMode())
501  return data.m_node->GetVolume()->IsVisible();
502 
503  return data.testBit(kVisNodeSelf);
504 }
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 506 of file FWGeometryTableManager.cc.

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

Referenced by cellRenderer().

507 {
508  if (m_browser->getVolumeMode())
509  return data.m_node->GetVolume()->IsVisibleDaughters();
510 
511  return data.testBit(kVisNodeChld);
512 }
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 136 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, gen::n, class-composition::parent, and FWGeometryTableManagerBase::NodeInfo::setBit().

Referenced by loadGeometry().

137 {
138  NodeInfo& parent = m_entries[parent_idx];
139  TGeoNode* parentGeoNode = parent.m_node;
140  int parentLevel = parent.m_level;
141 
142  int nV = parentGeoNode->GetNdaughters();
143  int dOff = 0;
144  for (int n = 0; n != nV; ++n)
145  {
146  NodeInfo& data = m_entries[parent_idx + n + 1 + dOff];
147  data.m_node = parentGeoNode->GetDaughter(n);
148  data.m_level = parentLevel + 1;
149  data.m_parent = parent_idx;
150  data.m_color = data.m_node->GetVolume()->GetLineColor();
151  data.m_transparency = data.m_node->GetVolume()->GetTransparency();
152  if (data.m_level <= m_browser->getAutoExpand()) data.setBit(kExpanded);
153 
154  importChildren(parent_idx + n + 1 + dOff);
155  getNNodesTotal(parentGeoNode->GetDaughter(n), dOff);
156  }
157 }
FWGeometryTableView * m_browser
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 260 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 findQualityFiles::v.

Referenced by FWGeometryTableView::FWGeometryTableView().

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

Reimplemented from FWGeometryTableManagerBase.

Definition at line 516 of file FWGeometryTableManager.cc.

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

Referenced by cellRenderer(), and numberOfColumns().

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

Referenced by numberOfColumns().

void FWGeometryTableManager::printMaterials ( )

Definition at line 312 of file FWGeometryTableManager.cc.

References MessageLogger_cfi::cerr.

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

Implements FWGeometryTableManagerBase.

Definition at line 319 of file FWGeometryTableManager.cc.

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

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

Definition at line 395 of file FWGeometryTableManager.cc.

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

Referenced by recalculateVisibility().

396 {
397  TGeoNode* parentNode = m_entries[pIdx].m_node;
398  int nD = parentNode->GetNdaughters();
399  int dOff = 0;
400  for (int n = 0; n != nD; ++n)
401  {
402  int idx = pIdx + 1 + n + dOff;
403  NodeInfo& data = m_entries[idx];
404 
405  if (m_filterOff)
406  {
407  m_row_to_index.push_back(idx);
408  if (data.testBit(kExpanded)) recalculateVisibilityNodeRec(idx);
409  }
410  else
411  {
412  assertNodeFilterCache(data);
413  if (data.testBitAny(kMatches | kChildMatches)) m_row_to_index.push_back(idx);
414  if (data.testBit(kChildMatches) && data.testBit(kExpanded) ) recalculateVisibilityNodeRec(idx);
415  }
416 
417  FWGeometryTableManagerBase::getNNodesTotal(parentNode->GetDaughter(n), dOff);
418  }
419 }
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 345 of file FWGeometryTableManager.cc.

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

Referenced by recalculateVisibility().

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

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

480 {
481  TGeoNode *parentNode = m_entries[selectedIdx].m_node;
482  int nD = parentNode->GetNdaughters();
483  int dOff = 0;
484  for (int n = 0; n != nD; ++n)
485  {
486  int idx = selectedIdx + 1 + n + dOff;
487  NodeInfo& data = m_entries[idx];
488 
489  setVisibility(data, v);
490  setVisibilityChld(data, v);
491 
492  FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
493  }
494 }
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
void FWGeometryTableManager::setVisibility ( NodeInfo nodeInfo,
bool  x 
)
virtual

Reimplemented from FWGeometryTableManagerBase.

Definition at line 444 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().

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

Reimplemented from FWGeometryTableManagerBase.

Definition at line 462 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().

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

Definition at line 210 of file FWGeometryTableManager.cc.

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

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

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