CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes

FWGeometryTableManager Class Reference

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

Inheritance diagram for FWGeometryTableManager:
FWTableManagerBase

List of all members.

Classes

class  ColorBoxRenderer
struct  Match
struct  NodeInfo

Public Member Functions

virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const
void firstColumnClicked (int row)
 FWGeometryTableManager (FWGeometryBrowser *)
virtual std::vector< std::string > getTitles () const
 returns the title names for each column
virtual void implSort (int, bool)
 Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.
void loadGeometry (TGeoManager *geoManager)
virtual int numberOfColumns () const
 Number of columns in the table.
virtual int numberOfRows () const
 Number of rows in the table.
virtual bool rowIsSelected (int row) const
std::vector< int > rowToIndex ()
int selectedColumn () const
int selectedRow () const
void setSelection (int row, int column, int mask)
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
virtual ~FWGeometryTableManager ()

Private Types

enum  ECol {
  kName, kColor, kVisSelf, kVisChild,
  kMaterial, kPosition, kBBoxSize, 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

Private Member Functions

void changeSelection (int iRow, int iColumn)
void checkChildMatches (TGeoVolume *v, std::vector< TGeoVolume * > &)
void checkHierarchy ()
void checkUniqueVolume (TGeoVolume *v)
bool filterOff () const
 FWGeometryTableManager (const FWGeometryTableManager &)
int getNdaughtersLimited (TGeoNode *) const
void getNNodesTotal (TGeoNode *geoNode, int level, int &off, bool debug) const
void importChildren (int parent_idx, bool recurse)
const FWGeometryTableManageroperator= (const FWGeometryTableManager &)
void recalculateVisibility ()
void redrawTable ()
void setTableContent ()
void updateAutoExpand ()
void updateFilter ()
void updateMode ()

Private Attributes

sigc::signal< void, int, int > indexSelected_
int m_autoExpand
FWGeometryBrowserm_browser
ColorBoxRenderer m_colorBoxRenderer
Entries_v m_entries
TGeoManager * m_geoManager
int m_maxDaughters
bool m_modeVolume
FWTextTreeCellRenderer m_renderer
std::vector< int > m_row_to_index
int m_selectedColumn
int m_selectedRow
Volumes_t m_volumes

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 39 of file FWGeometryTableManager.h.


Member Typedef Documentation

typedef Entries_v::iterator FWGeometryTableManager::Entries_i [private]

Definition at line 146 of file FWGeometryTableManager.h.

typedef std::vector<NodeInfo> FWGeometryTableManager::Entries_v [private]

Definition at line 145 of file FWGeometryTableManager.h.

typedef Volumes_t::iterator FWGeometryTableManager::Volumes_i [private]

Definition at line 149 of file FWGeometryTableManager.h.

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

Definition at line 148 of file FWGeometryTableManager.h.


Member Enumeration Documentation

Enumerator:
kName 
kColor 
kVisSelf 
kVisChild 
kMaterial 
kPosition 
kBBoxSize 
kNumCol 

Definition at line 118 of file FWGeometryTableManager.h.


Constructor & Destructor Documentation

FWGeometryTableManager::FWGeometryTableManager ( FWGeometryBrowser browser)
FWGeometryTableManager::~FWGeometryTableManager ( ) [virtual]

Definition at line 125 of file FWGeometryTableManager.cc.

{
}
FWGeometryTableManager::FWGeometryTableManager ( const FWGeometryTableManager ) [private]

Member Function Documentation

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 210 of file FWGeometryTableManager.cc.

References runTheMatrix::data, filterOff(), getNdaughtersLimited(), FWTextTableCellRenderer::graphicsContext(), FWTextTreeCellRenderer::iconWidth(), kColor, kMaterial, kName, kPosition, kVisChild, kVisSelf, m_colorBoxRenderer, m_entries, FWGeometryTableManager::NodeInfo::m_expanded, FWGeometryTableManager::NodeInfo::m_level, m_modeVolume, FWGeometryTableManager::NodeInfo::m_node, m_renderer, m_row_to_index, m_volumes, L1TEmulatorMonitor_cff::p, FWTextTableCellRenderer::setData(), FWGeometryTableManager::ColorBoxRenderer::setData(), FWTextTreeCellRenderer::setIndentation(), FWTextTreeCellRenderer::setIsOpen(), and FWTextTreeCellRenderer::setIsParent().

{
   if (static_cast<int>(m_row_to_index.size()) <= iSortedRowNumber)
   {
      m_renderer.setData(std::string("FWGeometryTableManager::cellRenderer() Error!"), false);
      return &m_renderer;
   }       

   FWTextTreeCellRenderer* renderer = &m_renderer;
  


   int unsortedRow =  m_row_to_index[iSortedRowNumber];
   const NodeInfo& data = m_entries[unsortedRow];
   TGeoNode& gn = *data.m_node;

   bool isSelected =  (!filterOff() &&  m_volumes[gn.GetVolume()].m_matches);//(m_selectedRow == unsortedRow);
   if (0) 
   {
      TGGC* gc = ( TGGC*)m_renderer.graphicsContext();
  
      if (!filterOff() &&  m_volumes[gn.GetVolume()].m_matches)
         gc->SetForeground(gVirtualX->GetPixel(kRed));
      else
         gc->SetForeground(gVirtualX->GetPixel(kBlack));
   }

   if (iCol == kName)
   {
      //   printf("redere\n");
      int nD = getNdaughtersLimited(data.m_node);
      if (m_modeVolume)
         renderer->setData(Form("%s [%d]", gn.GetVolume()->GetName(), nD), isSelected);
      else    
         renderer->setData(Form("%s [%d]", gn.GetName(), nD ), isSelected); 

      renderer->setIsParent((gn.GetNdaughters() > 0) && (filterOff() || m_volumes[gn.GetVolume()].accepted()));
      // printf("%s isParent %d\n", gn.GetVolume()->GetName(), isParent);

      renderer->setIsOpen(data.m_expanded);
      if (data.m_node->GetNdaughters())
         renderer->setIndentation(10*data.m_level);
      else
         renderer->setIndentation(10*data.m_level + FWTextTreeCellRenderer::iconWidth());

      return renderer;
   }
   else
   {
      // printf("title %s \n",data.m_node->GetTitle() );
      renderer->setIsParent(false);
      renderer->setIndentation(0);
      if (iCol == kColor)
      {
         //renderer->setData(Form("level .. %d", data.m_level),  isSelected);
         m_colorBoxRenderer.setData(gn.GetVolume()->GetLineColor(), isSelected);
         return  &m_colorBoxRenderer;
      }
      else if (iCol == kVisSelf )
      {
         renderer->setData( gn.IsVisible() ? "on" : "off",  isSelected);
         return renderer;
      }
      else if (iCol == kVisChild )
      {
         renderer->setData( gn.IsVisDaughters() ? "on" : "off",  isSelected);
         return renderer;
      }
      else if (iCol == kMaterial )
      { 
         renderer->setData( gn.GetVolume()->GetMaterial()->GetName(),  isSelected);
         return renderer;
      }
      else if (iCol == kPosition )
      { 
         const Double_t* p = gn.GetMatrix()->GetTranslation();
         renderer->setData(Form("[%.3f, %.3f, %.3f]", p[0], p[1], p[2]),  isSelected);
         return renderer;
      }
      else// if (iCol == kPosition  )
      { 
         TGeoBBox* gs = static_cast<TGeoBBox*>( gn.GetVolume()->GetShape());
         renderer->setData( Form("%f", TMath::Sqrt(gs->GetDX()*gs->GetDX() + gs->GetDY()*gs->GetDY() +gs->GetDZ()*gs->GetDZ() )),  isSelected);
         return renderer;
      }
   }
}
void FWGeometryTableManager::changeSelection ( int  iRow,
int  iColumn 
) [private]

Definition at line 192 of file FWGeometryTableManager.cc.

References indexSelected_, m_selectedColumn, m_selectedRow, and FWTableManagerBase::visualPropertiesChanged().

Referenced by redrawTable(), and setSelection().

{     
   if (iRow < 0) return; 
   if (iRow == m_selectedRow )
   {
      m_selectedRow = -1;
      m_selectedColumn = -1;
   }  
   else
   {
      m_selectedRow = iRow;
      m_selectedColumn = iColumn;
   }
   indexSelected_(iRow, iColumn);
   visualPropertiesChanged();
}    
void FWGeometryTableManager::checkChildMatches ( TGeoVolume *  v,
std::vector< TGeoVolume * > &  pstack 
) [private]

Definition at line 632 of file FWGeometryTableManager.cc.

References i, FWGeometryTableManager::Match::m_childMatches, m_maxDaughters, m_volumes, and siStripFEDMonitor_P5_cff::Min.

Referenced by updateFilter().

{
   if (m_volumes[vol].m_matches)
   {
      for (std::vector<TGeoVolume*>::iterator i = pstack.begin(); i!= pstack.end(); ++i)
      {
         Match& pm =  m_volumes[*i];
         //  if (0 && pm.m_childMatches)
         //   break;

         pm.m_childMatches = true;         
      }
   }

   pstack.push_back(vol);

   int nD = TMath::Min(m_maxDaughters, vol->GetNdaughters());
   for (int i = 0; i!=nD; ++i)
      checkChildMatches(vol->GetNode(i)->GetVolume(), pstack);
   
   pstack.pop_back();
}
void FWGeometryTableManager::checkHierarchy ( ) [private]

Definition at line 608 of file FWGeometryTableManager.cc.

References ExpressReco_HICollisions_FallBack::e, i, m_entries, AlCaRecoCosmics_cfg::name, convertSQLiteXML::ok, and redTxt.

Referenced by setTableContent().

{
   // Used for debug: in a NodeInfo entry look TGeoNode children from parent index and check
   // if child is found.
   
   for ( size_t i = 0,  e = m_entries.size(); i != e; ++i )
   {
      if ( m_entries[i].m_level > 0)
      {
         TGeoNode* pn = m_entries[m_entries[i].m_parent].m_node;
         bool ok = false;
         for (int d = 0; d < pn->GetNdaughters(); ++d )
         {
            if (m_entries[i].m_node ==  pn->GetDaughter(d))
            {
               ok = true;
               break;
            }
         }
         if (!ok) printf("%s!!!!!! node %s has false parent %s \n", redTxt, m_entries[i].name(), pn->GetName());
      }   
   }
}
void FWGeometryTableManager::checkUniqueVolume ( TGeoVolume *  v) [private]

Definition at line 359 of file FWGeometryTableManager.cc.

References i, and m_volumes.

Referenced by loadGeometry().

{
   Volumes_i it  = m_volumes.find(v);
   if (it == m_volumes.end())
   {
      m_volumes.insert(std::make_pair(v, Match()));
   }
   for (int i =0, nD = v->GetNdaughters(); i != nD; ++i) {
      checkUniqueVolume(v->GetNode(i)->GetVolume());
   }
}
bool FWGeometryTableManager::filterOff ( ) const [private]

Definition at line 695 of file FWGeometryTableManager.cc.

References m_browser, FWGeometryBrowser::m_filter, and FWGenericParameter< T >::value().

Referenced by cellRenderer(), importChildren(), loadGeometry(), and setTableContent().

{
  return  m_browser->m_filter.value().empty();
  //   printf("%d empty off \n", m_browser->m_filter.value().empty());
}
void FWGeometryTableManager::firstColumnClicked ( int  row)

Definition at line 298 of file FWGeometryTableManager.cc.

References runTheMatrix::data, FWTableManagerBase::dataChanged(), importChildren(), m_entries, FWGeometryTableManager::NodeInfo::m_expanded, FWGeometryTableManager::NodeInfo::m_imported, recalculateVisibility(), rowToIndex(), and FWTableManagerBase::visualPropertiesChanged().

Referenced by FWGeometryBrowser::cellClicked().

{
   if (row == -1)
      return;

     
   int idx = rowToIndex()[row];
   // printf("click %s \n", m_entries[idx].name());
   Entries_i it = m_entries.begin();
   std::advance(it, idx);
   NodeInfo& data = *it;
   data.m_expanded = !data.m_expanded;
   if (data.m_expanded  &&  data.m_imported == false)
   {
      importChildren(idx, false);
   }

   recalculateVisibility();
   dataChanged();
   visualPropertiesChanged();
}
int FWGeometryTableManager::getNdaughtersLimited ( TGeoNode *  geoNode) const [inline, private]

Definition at line 177 of file FWGeometryTableManager.h.

References m_maxDaughters, and siStripFEDMonitor_P5_cff::Min.

Referenced by cellRenderer(), getNNodesTotal(), and importChildren().

{
   // used for debugging of table
   return TMath::Min(geoNode->GetNdaughters(), m_maxDaughters);
   //return  geoNode->GetNdaughters();
}
void FWGeometryTableManager::getNNodesTotal ( TGeoNode *  geoNode,
int  level,
int &  off,
bool  debug 
) const [private]

Definition at line 459 of file FWGeometryTableManager.cc.

References cyanTxt, getNdaughtersLimited(), i, testEve_cfg::level, m_autoExpand, m_modeVolume, m_volumes, and n.

Referenced by importChildren().

{   
   // Get number of nested children recursively.
   
   if (debug) printf("getNNodesTotal %s %s (c:%d)\033[22;0m \n", cyanTxt, geoNode->GetName(), level);
   
   int nD =  getNdaughtersLimited(geoNode);
   std::vector<int> vi; vi.reserve(nD);
   vi.reserve(nD);
   for (int n = 0; n != nD; ++n)
   {
      TGeoVolume* vTmp = geoNode->GetDaughter(n)->GetVolume();
      if (m_volumes[vTmp].accepted())
      {
         bool toAdd = true;
         if (m_modeVolume)
         {
            for (std::vector<int>::iterator u = vi.begin(); u != vi.end(); ++u )
            {
               TGeoVolume* neighbourVolume = geoNode->GetDaughter(*u)->GetVolume();
               if (neighbourVolume == vTmp)
               {
                  toAdd = false;
                  break;
               }
            }
         } // end volume mode
         if (toAdd) vi.push_back(n);
      }
   }
   
   int nV = vi.size();
   if (level <  m_autoExpand)
   {
      off += nV;
      for (int i = 0; i < nV; ++i )
      {
         getNNodesTotal(geoNode->GetDaughter(vi[i]), level+1, off, false);
      }
      if (debug) printf("%d \n", off);
   }
}
std::vector< std::string > FWGeometryTableManager::getTitles ( ) const [virtual]

returns the title names for each column

Implements FWTableManagerBase.

Definition at line 146 of file FWGeometryTableManager.cc.

References m_modeVolume, and numberOfColumns().

{
   std::vector<std::string> returnValue;
   returnValue.reserve(numberOfColumns());

   if (m_modeVolume )
      returnValue.push_back("Volume Name");
   else
      returnValue.push_back("Node Name");

   returnValue.push_back("Color");
   returnValue.push_back("RnrSelf");
   returnValue.push_back("RnrChildren");
   returnValue.push_back("Material");
   returnValue.push_back("Position");
   returnValue.push_back("Diagonal");

   return returnValue;
}
virtual void FWGeometryTableManager::implSort ( int  iCol,
bool  iSortOrder 
) [inline, virtual]

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

Implements FWTableManagerBase.

Definition at line 113 of file FWGeometryTableManager.h.

{}
void FWGeometryTableManager::importChildren ( int  parent_idx,
bool  recurse 
) [private]

Definition at line 502 of file FWGeometryTableManager.cc.

References debug, filterOff(), getNdaughtersLimited(), getNNodesTotal(), greenTxt, i, m_autoExpand, m_entries, FWGeometryTableManager::NodeInfo::m_expanded, FWGeometryTableManager::NodeInfo::m_level, m_modeVolume, FWGeometryTableManager::NodeInfo::m_node, FWGeometryTableManager::NodeInfo::m_parent, m_volumes, n, FWGeometryTableManager::NodeInfo::name(), AlCaRecoCosmics_cfg::name, dbtoconf::parent, and redTxt.

Referenced by firstColumnClicked(), and setTableContent().

{
   bool debug = false;
   
   int nEntries = (int)m_entries.size();
   assert( parent_idx < nEntries);
 
   // parnt index not valid in recursive import:  save parent info here
   NodeInfo& parent        = m_entries[parent_idx];
   TGeoNode* parentGeoNode = parent.m_node; 
   int       parentLevel   = parent.m_level;   
   if (debug) printf("%s START level[%d] >  %s[%d]   \033[0m\n" ,greenTxt,  parentLevel+1, parentGeoNode->GetName(), parent_idx);

   parent.m_expanded = true;
   
   // get indices of accepted nodes
   int nD = getNdaughtersLimited(parentGeoNode);
   std::vector<int> vi; 
   vi.reserve(nD);
   TGeoVolume* vTmp;

   for (int n = 0; n != nD; ++n)
   {
      vTmp = parentGeoNode->GetDaughter(n)->GetVolume();
      
      if (filterOff() || m_volumes[vTmp].accepted())
      {
         bool toAdd = true;
         if (m_modeVolume)
         {
            // check duplicates in added
            for (std::vector<int>::iterator u = vi.begin(); u != vi.end(); ++u )
            {
               TGeoVolume* neighbourVolume =  parentGeoNode->GetDaughter(*u)->GetVolume();
               if (neighbourVolume == vTmp)
               {
                  toAdd = false;
                  break;
               }
            }
         } // end volume mode
         if (toAdd) vi.push_back(n);         
      } // end checke filters
      
      
   } // end daughter loop
   int nV =  vi.size();
   
   // add  accepted nodes
   Entries_i it = m_entries.begin();
   std::advance(it, parent_idx+1);
   m_entries.insert(it, nV, NodeInfo());
   nEntries += nV; 
   if (debug)  printf(" accpted %d of %d entries size %d \n", nV, nD, (int)m_entries.size());
   
   // child nodes setup
   for (int n = 0; n != nV; ++n)
   {
      int childIdx = vi[n];
      NodeInfo &nodeInfo = m_entries[parent_idx + 1 + n ];
      nodeInfo.m_node =   parentGeoNode->GetDaughter(childIdx);
      nodeInfo.m_level =  parent.m_level + 1;
      nodeInfo.m_parent = parent_idx;
      if (debug)  printf(" add %s\n", nodeInfo.name());
   }
   
   if (recurse)
   {
      // change of autoExpand parameter
      int dOff = 0;
      if ((parent.m_level+1) < m_autoExpand)
      {
         for (int n = 0; n != nV; ++n)
         {
            importChildren(parent_idx + n + 1 + dOff, recurse);       
            if (parentGeoNode->GetNdaughters() > 0)
            {
               getNNodesTotal(parentGeoNode->GetDaughter(vi[n]), parentLevel+1, dOff, debug);
            }
            
         }
      }
   }
   else
   {  
      // expand on double-click, possibly shift parents
      if (debug)  printf("\ncheck shhift for level  evel %d  import %s ", parent.m_level +1,parentGeoNode->GetName() ); 
      
      for (int i = (parent_idx + nV + 1); i < nEntries; ++i)
      {
         if (m_entries[i].m_parent > m_entries[parent_idx].m_parent)
         {
            if (debug)  printf("%s %s", redTxt,  m_entries[i].name());       
            m_entries[i].m_parent +=  nV;
            
         }
      }      
      if (debug) printf(" \033[0m\n");
   }
   
   
   fflush(stdout);
}// end importChildren
void FWGeometryTableManager::loadGeometry ( TGeoManager *  geoManager)

Definition at line 371 of file FWGeometryTableManager.cc.

References checkUniqueVolume(), filterOff(), m_browser, m_geoManager, m_volumes, setTableContent(), updateFilter(), and FWGeometryBrowser::updateStatusBar().

Referenced by FWGeometryBrowser::readFile().

{
   m_geoManager = geoManager;
   
   m_volumes.clear();
   checkUniqueVolume(geoManager->GetTopVolume());
   if (!filterOff())
      updateFilter();
   
   m_browser->updateStatusBar(Form("FWGeometryTableManager::loadGeometry() %d unique volumes", (int)m_volumes.size()));
   
   setTableContent();
}
int FWGeometryTableManager::numberOfColumns ( ) const [virtual]

Number of columns in the table.

Implements FWTableManagerBase.

Definition at line 140 of file FWGeometryTableManager.cc.

References kNumCol.

Referenced by getTitles().

{
   return kNumCol;
}
int FWGeometryTableManager::numberOfRows ( ) const [virtual]

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 135 of file FWGeometryTableManager.cc.

References m_row_to_index.

{
   return m_row_to_index.size();
}
const FWGeometryTableManager& FWGeometryTableManager::operator= ( const FWGeometryTableManager ) [private]
void FWGeometryTableManager::recalculateVisibility ( ) [private]

Definition at line 320 of file FWGeometryTableManager.cc.

References runTheMatrix::data, ExpressReco_HICollisions_FallBack::e, i, m_entries, FWGeometryTableManager::NodeInfo::m_parent, m_row_to_index, and FWGeometryTableManager::NodeInfo::m_visible.

Referenced by firstColumnClicked(), and redrawTable().

{
   m_row_to_index.clear();

   for ( size_t i = 0,  e = m_entries.size(); i != e; ++i )
   {   
      NodeInfo &data = m_entries[i];
      // printf("visiblity for %s \n", data.m_node->GetName() );
      if (data.m_parent == -1)
      {
         data.m_visible = true;
      }
      else 
      {
         data.m_visible = m_entries[data.m_parent].m_expanded && m_entries[data.m_parent].m_visible;
      }
   }

   // Put in the index only the entries which are visible.
   for (size_t i = 0, e = m_entries.size(); i != e; ++i)
      if (m_entries[i].m_visible)
         m_row_to_index.push_back(i);

   // printf("entries %d \n", m_entries.size());
} 
void FWGeometryTableManager::redrawTable ( ) [private]
bool FWGeometryTableManager::rowIsSelected ( int  row) const [virtual]

Definition at line 187 of file FWGeometryTableManager.cc.

References m_selectedRow.

{
   return m_selectedRow == row;
}
std::vector<int> FWGeometryTableManager::rowToIndex ( ) [inline]

Definition at line 110 of file FWGeometryTableManager.h.

References m_row_to_index.

Referenced by firstColumnClicked().

{ return m_row_to_index; }
int FWGeometryTableManager::selectedColumn ( ) const

Definition at line 182 of file FWGeometryTableManager.cc.

References m_selectedColumn.

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

Definition at line 177 of file FWGeometryTableManager.cc.

References m_selectedRow.

{
   return m_selectedRow;
}
void FWGeometryTableManager::setSelection ( int  row,
int  column,
int  mask 
)

Definition at line 166 of file FWGeometryTableManager.cc.

References changeSelection().

{
  
   changeSelection(row, column);
}
void FWGeometryTableManager::setTableContent ( ) [private]

Definition at line 387 of file FWGeometryTableManager.cc.

References checkHierarchy(), debug, filterOff(), i, importChildren(), FWGeometryBrowser::kVolume, m_autoExpand, FWGeometryBrowser::m_autoExpand, m_browser, m_entries, FWGeometryBrowser::m_filter, m_geoManager, FWGeometryTableManager::NodeInfo::m_level, FWGeometryBrowser::m_maxDaughters, m_maxDaughters, FWGeometryBrowser::m_mode, m_modeVolume, FWGeometryTableManager::NodeInfo::m_node, FWGeometryTableManager::NodeInfo::m_parent, m_row_to_index, m_volumes, n, redrawTable(), FWGeometryBrowser::updateStatusBar(), and FWGenericParameter< T >::value().

Referenced by loadGeometry(), updateAutoExpand(), updateFilter(), and updateMode().

{
   // Prepare data for cell render.
  
   m_browser->updateStatusBar("Set table content ...");

#ifdef PERFTOOL  
   if (filterOff())
      ProfilerStart(Form("SetTableContent.expand_%d.modeV_%d", m_browser->m_autoExpand.value(), ( m_browser->m_mode.value() == FWGeometryBrowser::kVolume)));
   else  
      ProfilerStart(Form("SetTableContent.expand_%d.modeV_%d.filter_%s", m_browser->m_autoExpand.value(), ( m_browser->m_mode.value() == FWGeometryBrowser::kVolume),  m_browser->m_filter.value().c_str()));

#endif
   bool debug = 1;
   
   // clear entries
   m_entries.clear();
   m_row_to_index.clear();
   
   // cache browser values   
   m_autoExpand   = m_browser->m_autoExpand.value();
   m_maxDaughters =  m_browser->m_maxDaughters.value();
   m_modeVolume   =  m_browser->m_mode.value() == FWGeometryBrowser::kVolume;

   // add top node to init
   NodeInfo topNodeInfo;
   topNodeInfo.m_node   = m_geoManager->GetTopNode();
   topNodeInfo.m_level  = 0;
   topNodeInfo.m_parent = -1;
   m_entries.push_back(topNodeInfo);

   importChildren(0, true);
   
   if (debug)
      checkHierarchy();
 
   redrawTable();
   
#ifdef PERFTOOL  
   ProfilerStop();
#endif

   if (filterOff())
   {
      m_browser->updateStatusBar(Form("%d entries imported ", (int)m_entries.size()));
   }
   else
   {
      {
         // get status
         int na = 0;
         int n = 0;
         for (Volumes_i i = m_volumes.begin(); i!= m_volumes.end(); ++i) 
         {
            n++;
            if ( i->second.m_matches)
            {
               na++;
               // printf("[%d] %s matches material %s \n", na, i->first->GetName(), i->first->GetMaterial()->GetName());
            }
         }

         m_browser->updateStatusBar(Form("%d entries imported, filter: %d volumes (%.2f %%) selected ", (int)m_entries.size(), na, na*1.f/n));
      }
   }
}
const std::string FWGeometryTableManager::title ( ) const [virtual]

Definition at line 172 of file FWGeometryTableManager.cc.

{
   return "Geometry";
}
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 130 of file FWGeometryTableManager.cc.

{
   return unsorted;
}
void FWGeometryTableManager::updateAutoExpand ( ) [private]

Definition at line 681 of file FWGeometryTableManager.cc.

References m_geoManager, and setTableContent().

Referenced by FWGeometryTableManager().

{
   if (!m_geoManager) return;
   
   setTableContent();
}
void FWGeometryTableManager::updateFilter ( ) [private]

Definition at line 657 of file FWGeometryTableManager.cc.

References checkChildMatches(), i, m_browser, FWGeometryBrowser::m_filter, m_geoManager, m_volumes, setTableContent(), and FWGenericParameter< T >::value().

Referenced by FWGeometryTableManager(), and loadGeometry().

{
   if (!m_geoManager) return;
   
#ifdef PERFTOOL
   ProfilerStart(m_browser->m_filter.value().c_str());
#endif

   for (Volumes_i i = m_volumes.begin(); i!= m_volumes.end(); ++i) 
   {
      i->second.m_matches = m_browser->m_filter.value().empty() || strstr(i->first->GetMaterial()->GetName(), m_browser->m_filter.value().c_str());
      i->second.m_childMatches = false;
   }  
  
   std::vector<TGeoVolume*> pstack;
   checkChildMatches(m_geoManager->GetTopVolume(), pstack);
 
   //   printf("filterChanged \n");
#ifdef PERFTOOL
   ProfilerStop();
#endif
   setTableContent();
}
void FWGeometryTableManager::updateMode ( ) [private]

Definition at line 688 of file FWGeometryTableManager.cc.

References m_geoManager, and setTableContent().

Referenced by FWGeometryTableManager().

{
   if (!m_geoManager) return;
   
   setTableContent();
}

Member Data Documentation

sigc::signal<void,int,int> FWGeometryTableManager::indexSelected_ [private]

Definition at line 172 of file FWGeometryTableManager.h.

Referenced by changeSelection().

Definition at line 153 of file FWGeometryTableManager.h.

Referenced by cellRenderer(), and FWGeometryTableManager().

TGeoManager* FWGeometryTableManager::m_geoManager [private]

Definition at line 152 of file FWGeometryTableManager.h.

Referenced by cellRenderer(), and FWGeometryTableManager().

std::vector<int> FWGeometryTableManager::m_row_to_index [private]

Definition at line 157 of file FWGeometryTableManager.h.

Referenced by changeSelection(), and selectedColumn().

Definition at line 156 of file FWGeometryTableManager.h.

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