CMS 3D CMS Logo

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

List of all members.

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
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'.
void loadGeometry (TGeoNode *, TObjArray *)
bool nodeImported (int idx) const
virtual int numberOfColumns () const
 Number of columns in the table.
virtual int numberOfRows () const
 Number of rows in the table.
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
virtual ~FWGeometryTableManager ()

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

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.

   {
      kExpanded        =  BIT(0),
      kMatches         =  BIT(1),
      kChildMatches    =  BIT(2),
      kFilterCached    =  BIT(3),

      kVisNode         =  BIT(4),
      kVisNodeChld     =  BIT(5)
      //   kVisVol          =  BIT(6),
      //   kVisVolChld      =  BIT(7),

   };
Enumerator:
kName 
kColor 
kVisSelf 
kVisChild 
kMaterial 
kPosX 
kPosY 
kPosZ 
kNumCol 

Definition at line 45 of file FWGeometryTableManager.h.


Constructor & Destructor Documentation

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

Definition at line 127 of file FWGeometryTableManager.cc.

{
}
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().

{
   if (!data.testBit(kFilterCached))
   {
      bool matches = m_volumes[data.m_node->GetVolume()].m_matches;
      data.setBitVal(kMatches, matches);
      setVisibility(data, matches);

      bool childMatches = m_volumes[data.m_node->GetVolume()].m_childMatches;
      data.setBitVal(kChildMatches, childMatches);
      data.setBitVal(kExpanded, childMatches);
      setVisibilityChld(data, childMatches);


      data.setBit(kFilterCached);
      //  printf("%s matches [%d] childMatches [%d] ................ %d %d \n", data.name(), data.testBit(kMatches), data.testBit(kChildMatches), matches , childMatches);
   }
}
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.

{
   struct Cache
   {
      TGeoHMatrix mtx;
      double pos[3];
      int row;

   };

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

   static char sval[12];
   static std::string zero = "0.000";

   FWTextTreeCellRenderer* renderer = &m_renderer;

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

   bool isSelected = (iCol == kMaterial ) && (!m_filterOff &&  m_volumes[gn.GetVolume()].m_matches);//(m_selectedRow == unsortedRow);

   if (iCol == kName)
   {
      //int nD = getNdaughtersLimited(data.m_node);
      int nD = data.m_node->GetNdaughters();
      if (m_browser->getVolumeMode())
         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) && (m_filterOff || data.testBit(kChildMatches) ));

      renderer->setIsOpen( data.testBit(FWGeometryTableManager::kExpanded));

      int level = data.m_level - m_levelOffset;

      if (data.m_node->GetNdaughters())
         renderer->setIndentation(20*level);
      else
         renderer->setIndentation(20*level + FWTextTreeCellRenderer::iconWidth());

      return renderer;
   }
   else
   {
      // printf("title %s \n",data.m_node->GetTitle() );
      renderer->setIsParent(false);
      renderer->setIndentation(0);
      if (iCol == kColor)
      {
         // m_colorBoxRenderer.setData(data.m_node->GetVolume()->GetLineColor(), isSelected);
         m_colorBoxRenderer.setData(data.m_color, isSelected);
         return  &m_colorBoxRenderer;
      }
      else if (iCol == kVisSelf )
      {
         renderer->setData(getVisibility(data)  ? "On" : "-",  isSelected );
         return renderer;
      }
      else if (iCol == kVisChild )
      {
         renderer->setData( getVisibilityChld(data) ? "On" : "-",  isSelected);
         return renderer;
      }
      else if (iCol == kMaterial )
      { 
         renderer->setData( gn.GetVolume()->GetMaterial()->GetName(),  isSelected);
         return renderer;
      }
      
      else if (iCol == kPosX || iCol == kPosY || iCol == kPosZ)
      { 
         if (mxCache.row != iSortedRowNumber) { 
            mxCache.row = iSortedRowNumber;
            mxCache.pos[0] = 0; mxCache.pos[1] = 0; mxCache.pos[2] = 0;
            mxCache.mtx.Clear();
            getNodeMatrix(data, mxCache.mtx);
            TGeoBBox* bb = static_cast<TGeoBBox*>(data.m_node->GetVolume()->GetShape());
            const double* origin = bb->GetOrigin();
            mxCache.mtx.LocalToMaster(origin, mxCache.pos);
         }
         float val =  mxCache.pos[iCol - kPosX];
         if (val < 0.001)  {
            renderer->setData(zero, isSelected);
         }
         else {
            snprintf(sval, sizeof(sval), "%.3f", val);
            renderer->setData(sval, isSelected);

         }

         return renderer;
      }
      else
      { 
         TGeoBBox* gs = static_cast<TGeoBBox*>( gn.GetVolume()->GetShape());
         float val = TMath::Sqrt(gs->GetDX()*gs->GetDX() + gs->GetDY()*gs->GetDY() +gs->GetDZ()*gs->GetDZ() );
         //            renderer->setData( Form("%.3f", TMath::Sqrt(gs->GetDX()*gs->GetDX() + gs->GetDY()*gs->GetDY() +gs->GetDZ()*gs->GetDZ() )),  isSelected);
         if (val < 0.001)  {
            renderer->setData(zero, isSelected);
         }
         else {
            snprintf(sval, sizeof(sval), "%.3f", val);
            renderer->setData(sval, isSelected);
         }
         return renderer;
      }

   }
}
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().

{     
   if (iRow < 0) return; 

   m_selectedRow = iRow;
   m_selectedColumn = iColumn;
   if (m_row_to_index.size() > 0)   m_selectedIdx = m_row_to_index[iRow];

   // printf("WGeometryTableManager::changeSelecti row %d index %d \n", m_selectedIdx,  m_selectedIdx );
   visualPropertiesChanged();
}    
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().

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

   pstack.push_back(vol);

   int nD =  vol->GetNdaughters();//TMath::Min(m_browser->getMaxDaughters(), vol->GetNdaughters());
   for (int i = 0; i!=nD; ++i)
      checkChildMatches(vol->GetNode(i)->GetVolume(), pstack);
   
   pstack.pop_back();
}
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().

{
   // check expand state
   int ae = m_browser->getAutoExpand() +  m_levelOffset;
   for (Entries_i i = m_entries.begin(); i != m_entries.end(); ++i)
   {
      if (i->m_level  < ae)
         i->setBit(kExpanded);
      else
         i->resetBit(kExpanded);
   } 
}
void FWGeometryTableManager::checkHierarchy ( ) [private]

Definition at line 589 of file FWGeometryTableManager.cc.

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

{
   // 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::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().

{
   if (row == -1)
      return;

   int idx = rowToIndex()[row];
   // printf("click %s \n", m_entries[idx].name());

   m_entries[idx].switchBit(kExpanded);
 
   recalculateVisibility();
   dataChanged();
   visualPropertiesChanged();
}
int FWGeometryTableManager::getLevelOffset ( ) const [inline]

Definition at line 154 of file FWGeometryTableManager.h.

References m_levelOffset.

Referenced by FWGeoTopNode::Paint().

{ return m_levelOffset; }
void FWGeometryTableManager::getNNodesTotal ( TGeoNode *  geoNode,
int &  off 
) [inline, static]

Definition at line 228 of file FWGeometryTableManager.h.

References i.

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

{   
   int nD =  geoNode->GetNdaughters();
   off += nD;
   for (int i = 0; i < nD; ++i )
   {
      getNNodesTotal(geoNode->GetDaughter(i), 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().

{
   // utility used by browser and FWGeoNode

   int pIdx  = data.m_parent;
   int endl =  data.m_level -1;
   for (int l = 0 ; l < endl ; ++l)
   {
      pIdx = m_entries.at(pIdx).m_parent;
      mtx.MultiplyLeft(m_entries.at(pIdx).m_node->GetMatrix());
   }

   mtx.Multiply(data.m_node->GetMatrix());
}
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().

{
   std::vector<std::string> relPath;
   while(idx >= 0)
   { 
      relPath.push_back( m_entries[idx].name());
      // printf("push %s \n",m_entries[idx].name() );
      idx  =  m_entries[idx].m_parent;
   }

   size_t ns = relPath.size();
   for (size_t i = 1; i < ns; ++i )
   {
      path +="/";
      path += relPath[ns-i -1];
      // printf("push_back add to path %s\n", path.c_str());
   }
}
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().

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

   if (m_browser->getVolumeMode() )
      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("X");
   returnValue.push_back("Y");
   returnValue.push_back("Z");
   //   returnValue.push_back("Diagonal");

   return returnValue;
}
bool FWGeometryTableManager::getVisibility ( const NodeInfo nodeInfo) const
bool FWGeometryTableManager::getVisibilityChld ( const NodeInfo nodeInfo) const
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 142 of file FWGeometryTableManager.h.

{}
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().

{
   NodeInfo& parent        = m_entries[parent_idx];
   TGeoNode* parentGeoNode = parent.m_node; 
   int       parentLevel   = parent.m_level; 
   
   int nV = parentGeoNode->GetNdaughters();
   int dOff = 0; 
   for (int n = 0; n != nV; ++n)
   {         
      NodeInfo& data = m_entries[parent_idx + n + 1 + dOff];    
      data.m_node =   parentGeoNode->GetDaughter(n);
      data.m_level =  parentLevel + 1;
      data.m_parent = parent_idx;
      data.m_color =  data.m_node->GetVolume()->GetLineColor();
      if (data.m_level <=  m_browser->getAutoExpand()) data.setBit(kExpanded);
      
 
      importChildren(parent_idx + n + 1 + dOff);         
      getNNodesTotal(parentGeoNode->GetDaughter(n), dOff);            
   }  
}
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().

{
#ifdef PERFTOOL_GEO_TABLE  
   ProfilerStart("loadGeo");
#endif
   
   // Prepare data for cell render.
   
   // clear entries
   m_entries.clear();
   m_row_to_index.clear();
   m_volumes.clear();
   m_levelOffset = 0;

   // set volume table for filters
   boost::unordered_map<TGeoVolume*, Match>  pipi(iVolumes->GetSize());
   m_volumes.swap(pipi);
   TIter next( iVolumes);
   TGeoVolume* v;
   while ((v = (TGeoVolume*) next()) != 0)
      m_volumes.insert(std::make_pair(v, Match()));

   if (!m_filterOff)
      updateFilter();  

   // add top node to init
 
   int nTotal = 0;
   NodeInfo topNodeInfo;
   topNodeInfo.m_node   = iGeoTopNode;
   topNodeInfo.m_level  = 0;
   topNodeInfo.m_parent = -1;
   if (m_browser->getAutoExpand())
      topNodeInfo.setBit(kExpanded);

   getNNodesTotal(topNodeInfo.m_node , nTotal);
   m_entries.resize(nTotal+1);
   m_entries[0] = topNodeInfo;

   importChildren(0);

   // checkHierarchy();
   
#ifdef PERFTOOL_GEO_TABLE  
   ProfilerStop();
#endif
}
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().

{
   return kNumCol;
}
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.

{
   return m_row_to_index.size();
}
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().

{
   //   static double pnt[3];
  std::string path;
  getNodePath(idx, path);
  printf("My %s parent %s path  %d \n",m_entries[idx].name(),path.c_str(), m_entries[idx].m_parent );
  /*
   for (int i =0, k = m_entries.size(); i < k; ++i)
   {
     const  NodeInfo&  ni = m_entries[i];
      if (ni.m_parent == idx)
      {
         std::string indent(ni.m_level*3 , ' ');

         //  printf("%s%s (%.2f, %.2f, %.2f)\n",indent.c_str(), ni.name(), pnt[0], pnt[1], pnt[2]);
         printf("%s%s \n",indent.c_str(), ni.name());

         printChildren(i);
      }
      }*/
}
void FWGeometryTableManager::printMaterials ( ) [private]

Definition at line 832 of file FWGeometryTableManager.cc.

References i, m, m_entries, and m_selectedIdx.

Referenced by FWGeometryTableView::chosenItem().

{
   std::map<TGeoMaterial*, std::string> mlist;
   Entries_i it = m_entries.begin();
   std::advance(it, m_selectedIdx );
   int nLevel = it->m_level;
   it++;
   while (it->m_level > nLevel)
   {
      TGeoMaterial* m = it->m_node->GetVolume()->GetMaterial();
      if (mlist.find(m) == mlist.end())
      {
         mlist[m] = m->GetName();
      } 
      it++;
   }

   printf("size %d \n", (int)mlist.size());
   for(std::map<TGeoMaterial*, std::string>::iterator i = mlist.begin(); i != mlist.end(); ++i)
   {
      printf("material %s \n", i->second.c_str());
   }

}
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().

{
   m_row_to_index.clear();
   int i = TMath::Max(0, m_browser->getTopNodeIdx());
   m_row_to_index.push_back(i);

   NodeInfo& data = m_entries[i];
   if (!m_filterOff)
      assertNodeFilterCache(data);

   if ((m_filterOff && data.testBit(kExpanded) == false) ||
       (m_filterOff == false && data.testBit(kChildMatches) == false) )
      return;

   
   if (m_browser->getVolumeMode())
      recalculateVisibilityVolumeRec(i);
   else
      recalculateVisibilityNodeRec(i);

   //  printf (" child [%d] FWGeometryTableManager::recalculateVisibility table size %d \n", (int)m_row_to_index.size());
}
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().

{
   TGeoNode* parentNode = m_entries[pIdx].m_node;
   int nD = parentNode->GetNdaughters();
   int dOff=0;
   for (int n = 0; n != nD; ++n)
   {
      int idx = pIdx + 1 + n + dOff;
      NodeInfo& data = m_entries[idx];

      if (m_filterOff)
      {
         m_row_to_index.push_back(idx);
         if (data.testBit(kExpanded)) recalculateVisibilityNodeRec(idx);
      }
      else
      {
         assertNodeFilterCache(data);
         if (data.testBitAny(kMatches | kChildMatches)) m_row_to_index.push_back(idx); 
         if (data.testBit(kChildMatches) && data.testBit(kExpanded) ) recalculateVisibilityNodeRec(idx);
      }

      FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
   }
} 
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().

{
   TGeoNode* parentNode = m_entries[pIdx].m_node;
   int nD = parentNode->GetNdaughters();
   int dOff=0;

   // printf("----------- parent %s\n", parentNode->GetName() );

   std::vector<int> vi; 
   vi.reserve(nD);


   for (int n = 0; n != nD; ++n)
   {
      int idx = pIdx + 1 + n + dOff;
      NodeInfo& data = m_entries[idx];

      bool toAdd = true;
      for (std::vector<int>::iterator u = vi.begin(); u != vi.end(); ++u )
      {
         TGeoVolume* neighbourVolume =  parentNode->GetDaughter(*u)->GetVolume();
         if (neighbourVolume == data.m_node->GetVolume())
         {
            toAdd = false;
            // printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
            break;
         }
      }

      if (toAdd)
      {
         vi.push_back(n);
         if (m_filterOff)
         {
            //    std::cout << data.nameIndent() << std::endl;
            m_row_to_index.push_back(idx);
            if (data.testBit(kExpanded)) recalculateVisibilityVolumeRec(idx);
         }
         else
         {
            assertNodeFilterCache(data);
            if (data.testBitAny(kMatches | kChildMatches)) m_row_to_index.push_back(idx); 
            if (data.testBit(kChildMatches) && data.testBit(kExpanded)) recalculateVisibilityVolumeRec(idx);
         }
      }
      FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
   }
}
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().

{
   if (m_entries.empty()) return;

   changeSelection(0, 0);

   recalculateVisibility();

   // if (m_filterOff)  
   //   m_statusMessage = Form("level:%d  rows %d ",   getLevelOffset(), (int)m_row_to_index.size());
   // else
   //   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());

   dataChanged();
   visualPropertiesChanged();
}
Entries_v& FWGeometryTableManager::refEntries ( ) [inline]
FWGeometryTableManager::Entries_i FWGeometryTableManager::refSelected ( )
bool FWGeometryTableManager::rowIsSelected ( int  row) const [virtual]

Definition at line 190 of file FWGeometryTableManager.cc.

References m_selectedRow.

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

Definition at line 139 of file FWGeometryTableManager.h.

References m_row_to_index.

Referenced by firstColumnClicked().

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

Definition at line 185 of file FWGeometryTableManager.cc.

References m_selectedColumn.

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

Definition at line 180 of file FWGeometryTableManager.cc.

References m_selectedRow.

{
   return m_selectedRow;
}
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().

{
   if(iToWhite) {
      m_renderer.setGraphicsContext(&TGFrame::GetBlackGC());
      m_renderer.setHighlightContext(&(FWTextTableCellRenderer::getDefaultHighlightGC()));
   } else {
      static const TGGC* s_blackHighLight = 0;
      if (!s_blackHighLight) {
         GCValues_t gval;
         gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle  | kGCGraphicsExposures;
         gval.fForeground = 0xbbbbbb;
         gval.fBackground = 0x000000;
         gval.fFillStyle  = kFillOpaqueStippled;
         gval.fStipple    = gClient->GetResourcePool()->GetCheckeredBitmap();
         gval.fGraphicsExposures = kFALSE;
         s_blackHighLight = gClient->GetGC(&gval, kTRUE);
      }
      m_renderer.setHighlightContext(s_blackHighLight);
      m_renderer.setGraphicsContext(&TGFrame::GetWhiteGC());
   }
   m_renderer.setBlackIcon(iToWhite);
}
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().

{
   int dOff = 0;
   TGeoNode* parentNode = m_entries[m_selectedIdx].m_node;
   int nD = parentNode->GetNdaughters();
   for (int n = 0; n != nD; ++n)
   {
      int idx = m_selectedIdx + 1 + n + dOff;
      NodeInfo& data = m_entries[idx];

      setVisibility(data, v);
      setVisibilityChld(data, v);

      FWGeometryTableManager::getNNodesTotal(parentNode->GetDaughter(n), dOff);
   }
}
void FWGeometryTableManager::setSelection ( int  row,
int  column,
int  mask 
)

Definition at line 170 of file FWGeometryTableManager.cc.

References changeSelection().

Referenced by FWGeometryTableView::cellClicked().

{
   changeSelection(row, column);
}
void FWGeometryTableManager::setVisibility ( NodeInfo nodeInfo,
bool  x 
)
void FWGeometryTableManager::setVisibilityChld ( NodeInfo nodeInfo,
bool  x 
)
const std::string FWGeometryTableManager::title ( ) const [virtual]

Definition at line 175 of file FWGeometryTableManager.cc.

{
   return "Geometry";
}
void FWGeometryTableManager::topGeoNodeChanged ( int  idx) [private]

Definition at line 711 of file FWGeometryTableManager.cc.

References m_entries, and m_levelOffset.

Referenced by FWGeometryTableView::setPath().

{
   // cached 
   if (idx >= 0)
      m_levelOffset = m_entries[idx].m_level;
   else
      m_levelOffset = 0;

}
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.

{
   return unsorted;
}
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().

{
   std::string filterExp =  m_browser->getFilter();
   m_filterOff =  filterExp.empty();
   //   printf("update filter %s  OFF %d volumes size %d\n",filterExp.c_str(),  m_filterOff , (int)m_volumes.size());

   if (m_filterOff || m_entries.empty()) return;
   
   // update volume-match entries
    m_numVolumesMatched = 0;
   for (Volumes_i i = m_volumes.begin(); i!= m_volumes.end(); ++i) 
   {
      if (strcasestr(i->first->GetMaterial()->GetName(), filterExp.c_str()) > 0) {
         i->second.m_matches = true;
         m_numVolumesMatched++;
      }
      else {
         i->second.m_matches = false;
      }
      i->second.m_childMatches = false;
   }  

   std::vector<TGeoVolume*> pstack;
   checkChildMatches(m_entries[TMath::Max(0,m_browser->getTopNodeIdx())].m_node->GetVolume(), pstack);
 

   for (Entries_i ni = m_entries.begin(); ni != m_entries.end(); ++ni)
      ni->resetBit(kFilterCached);

}

Friends And Related Function Documentation

friend class FWGeometryTableView [friend]

Definition at line 42 of file FWGeometryTableManager.h.


Member Data Documentation

Definition at line 203 of file FWGeometryTableManager.h.

Referenced by cellRenderer(), and FWGeometryTableManager().

Definition at line 217 of file FWGeometryTableManager.h.

Referenced by updateFilter().

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

Definition at line 208 of file FWGeometryTableManager.h.

Referenced by changeSelection(), and selectedColumn().

Definition at line 206 of file FWGeometryTableManager.h.

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

Definition at line 219 of file FWGeometryTableManager.h.