#include <Fireworks/Core/interface/FWOverlapTableManager.h>
Public Types | |
enum | OverlapBits { kVisMarker = BIT(5), kOverlap = BIT(6), kOverlapChild = BIT(7) } |
Public Member Functions | |
FWTableCellRendererBase * | cellRenderer (int iSortedRowNumber, int iCol) const |
FWOverlapTableManager (FWOverlapTableView *) | |
void | getOverlapTitles (int, TString &) const |
virtual std::vector< std::string > | getTitles () const |
returns the title names for each column | |
void | importOverlaps (std::string path, double precision) |
virtual int | numberOfColumns () const |
Number of columns in the table. | |
void | printOverlaps (int) const |
virtual void | recalculateVisibility () |
virtual void | recalculateVisibilityNodeRec (int) |
void | setDaughtersSelfVisibility (int i, bool v) |
virtual | ~FWOverlapTableManager () |
Protected Member Functions | |
virtual bool | nodeIsParent (const NodeInfo &) const |
Private Member Functions | |
void | addOverlapEntry (TGeoOverlap *, int, int, TGeoHMatrix *) |
FWOverlapTableManager (const FWOverlapTableManager &) | |
const FWOverlapTableManager & | operator= (const FWOverlapTableManager &) |
Private Attributes | |
FWOverlapTableView * | m_browser |
std::multimap< int, int > | m_mapNodeOverlaps |
Description: [one line class summary]
Usage: <usage>
Definition at line 33 of file FWOverlapTableManager.h.
Definition at line 36 of file FWOverlapTableManager.h.
{ kVisMarker = BIT(5), kOverlap = BIT(6), kOverlapChild = BIT(7) };
FWOverlapTableManager::FWOverlapTableManager | ( | FWOverlapTableView * | v | ) |
Definition at line 40 of file FWOverlapTableManager.cc.
: FWGeometryTableManagerBase(), m_browser(v) { }
FWOverlapTableManager::~FWOverlapTableManager | ( | ) | [virtual] |
Definition at line 46 of file FWOverlapTableManager.cc.
{ }
FWOverlapTableManager::FWOverlapTableManager | ( | const FWOverlapTableManager & | ) | [private] |
void FWOverlapTableManager::addOverlapEntry | ( | TGeoOverlap * | , |
int | , | ||
int | , | ||
TGeoHMatrix * | |||
) | [private] |
Definition at line 206 of file FWOverlapTableManager.cc.
References FWGeometryTableManagerBase::getNNodesTotal(), FWGeometryTableViewBase::getTopNodeIdx(), i, j, kOverlap, kOverlapChild, FWGeometryTableManagerBase::kVisNodeChld, FWGeometryTableManagerBase::kVisNodeSelf, m_browser, FWGeometryTableManagerBase::m_entries, m_mapNodeOverlaps, FWOverlapTableView::m_markerIndices, FWOverlapTableView::m_markerVertices, and n.
Referenced by importOverlaps().
{ // printf("add %s \n", ovl->GetTitle()); // get doughter indices of overlaps /* TPMERegexp re(" ", "o"); re.Split(TString(ovl->GetTitle())); printf("add title %s \n", ovl->GetTitle()); */ int pcnt = parentIdx+1; int dOff =0; TGeoNode* mothern = m_entries[parentIdx].m_node; for (int i = 0; i < mothern->GetNdaughters(); ++i) { TGeoNode* n = mothern->GetDaughter(i); int cnt = pcnt + i+dOff; if (ovl->IsOverlap()) { if (n->GetVolume() == ovl->GetFirstVolume() && (*(ovl->GetFirstMatrix()) == *(n->GetMatrix()))) { // std::string x = re[0].Data(); //if (x.find(n->GetName()) == std::string::npos) printf("ERROT \n"); m_entries[cnt].setBit(kOverlap); m_entries[cnt].setBit(kVisNodeSelf); m_mapNodeOverlaps.insert(std::pair<int, int>(cnt, ovlIdx)); int nno; n->GetOverlaps(nno); nno |= BIT(1); n->SetOverlaps(0, nno); } } if (n->GetVolume() == ovl->GetSecondVolume() && (*(ovl->GetSecondMatrix()) == *(n->GetMatrix()))) { //printf("-----------------------------------------------\n"); // std::string x = re[2].Data(); // if (x.find(n->GetName()) == std::string::npos) printf("ERROT \n"); m_entries[cnt].setBit(kOverlap); m_entries[cnt].setBit(kVisNodeSelf); m_mapNodeOverlaps.insert(std::pair<int, int>(cnt, ovlIdx)); int nno; n->GetOverlaps(nno); nno |= (ovl->IsOverlap() ? BIT(1) : BIT(2)); n->SetOverlaps(0, nno); } FWGeometryTableManagerBase::getNNodesTotal(n, dOff); } TPolyMarker3D* pm = ovl->GetPolyMarker(); for (int j=0; j<pm->GetN(); ++j ) { double pl[3]; double pg[3]; pm->GetPoint(j, pl[0], pl[1], pl[2]); motherm->LocalToMaster(pl, pg); m_browser->m_markerIndices.push_back(ovl->IsExtrusion() ? -parentIdx : parentIdx); m_browser->m_markerVertices.push_back( pg[0]); m_browser->m_markerVertices.push_back( pg[1]); m_browser->m_markerVertices.push_back( pg[2]); } int aIdx = parentIdx; int aLev = m_entries[aIdx].m_level; int topNodeIdx = m_browser->getTopNodeIdx(); while(aIdx > topNodeIdx) { aIdx--; if (m_entries[aIdx].m_level < aLev) { m_entries[aIdx].setBit(kOverlapChild); m_entries[aIdx].setBit(kVisNodeChld); // printf("stamp %s \n", m_entries[aIdx].name()); aLev--; } } }
FWTableCellRendererBase * FWOverlapTableManager::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 390 of file FWOverlapTableManager.cc.
References AlCaHLTBitMon_QueryRunRegistry::data, FWGeometryTableViewManager::getGeoMangeur(), FWGeometryTableViewBase::getTopNodeIdx(), i, FWTextTreeCellRenderer::iconWidth(), FWGeometryTableManagerBase::kExpanded, FWGeometryTableManagerBase::kHighlighted, kOverlap, kOverlapChild, FWGeometryTableManagerBase::kSelected, kVisMarker, FWGeometryTableManagerBase::kVisNodeChld, FWGeometryTableManagerBase::kVisNodeSelf, testEve_cfg::level, FWOverlapTableView::listAllNodes(), m_browser, FWGeometryTableManagerBase::NodeInfo::m_color, FWGeometryTableManagerBase::m_colorBoxRenderer, FWGeometryTableManagerBase::m_entries, FWGeometryTableManagerBase::m_highlightContext, FWGeometryTableManagerBase::NodeInfo::m_level, FWGeometryTableManagerBase::m_levelOffset, m_mapNodeOverlaps, FWOverlapTableView::m_markerIndices, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::m_renderer, FWGeometryTableManagerBase::m_row_to_index, FWGeometryTableManagerBase::NodeInfo::name(), python::Vispa::Plugins::EdmBrowser::EdmDataAccessor::ne(), nodeIsParent(), FWTextTableCellRenderer::setData(), FWGeometryTableManagerBase::ColorBoxRenderer::setData(), FWTextTreeCellRenderer::setIndentation(), FWTextTreeCellRenderer::setIsOpen(), FWTextTreeCellRenderer::setIsParent(), FWGeometryTableManagerBase::NodeInfo::testBit(), and x.
{ if (m_row_to_index.empty()) return &m_renderer; int unsortedRow = m_row_to_index[iSortedRowNumber]; if (unsortedRow < 0) printf("!!!!!!!!!!!!!!!! error %d %d \n",unsortedRow, iSortedRowNumber); const NodeInfo& data = m_entries[unsortedRow]; bool isSelected = data.testBit(kHighlighted) || data.testBit(kSelected); if (m_browser->listAllNodes()) isSelected = isSelected || data.testBit(kOverlap); if (data.testBit(kSelected)) { m_highlightContext->SetBackground(0xc86464); } else if (data.testBit(kHighlighted) ) { m_highlightContext->SetBackground(0x6464c8); } else if (m_browser->listAllNodes() && data.testBit(kOverlap) ) { m_highlightContext->SetBackground(0xdddddd); } if (iCol == 0) { if (unsortedRow == m_browser->getTopNodeIdx()) { int no = 0, ne =0; TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur()); TIter next_ovl(gGeoManager->GetListOfOverlaps()); const TGeoOverlap* ovl; while((ovl = (TGeoOverlap*)next_ovl())) ovl->IsOverlap() ? no++ : ne++; m_renderer.setData(Form("%s Ovl[%d] Ext[%d]", data.m_node->GetName(), no, ne), isSelected); } else { m_renderer.setData(data.name(), isSelected); } m_renderer.setIsParent(nodeIsParent(data)); m_renderer.setIsOpen( data.testBit(FWGeometryTableManagerBase::kExpanded)); int level = data.m_level - m_levelOffset; if (nodeIsParent(data)) m_renderer.setIndentation(20*level); else m_renderer.setIndentation(20*level + FWTextTreeCellRenderer::iconWidth()); } else { m_renderer.setIsParent(false); m_renderer.setIndentation(0); if (iCol == 4) { if (data.testBit(kOverlap) ) { std::string x; std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp; ppp = m_mapNodeOverlaps.equal_range(unsortedRow); TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur()); for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) { const TGeoOverlap* ovl = (const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second); if (ovl) x += Form("%s: %g ", ovl->IsOverlap() ? "Ovl" : "Extr", ovl->GetOverlap()); else x += "err"; } m_renderer.setData(x, isSelected); } else { m_renderer.setData("", isSelected); } } if (iCol == 1) { m_colorBoxRenderer.setData(data.m_color, isSelected); return &m_colorBoxRenderer; } else if (iCol == 2 ) { m_renderer.setData(data.testBit(kVisNodeSelf) ? "On" : "-", isSelected ); } else if (iCol == 3 ) { m_renderer.setData(data.testBit(kVisNodeChld) ? "On" : "-", isSelected); } else if (iCol == 5) { bool motherV = false; if (data.testBit(kOverlapChild)) { for (std::vector<int>::iterator i = m_browser->m_markerIndices.begin(); i!= m_browser->m_markerIndices.end(); i++) { if (TMath::Abs(*i) == unsortedRow) { motherV = true; break; } } } m_renderer.setData(motherV ? (data.testBit(kVisMarker) ? "On" : "-") : "", isSelected); } } return &m_renderer; }
void FWOverlapTableManager::getOverlapTitles | ( | int | idx, |
TString & | txt | ||
) | const |
Definition at line 348 of file FWOverlapTableManager.cc.
References FWGeometryTableViewManager::getGeoMangeur(), and m_mapNodeOverlaps.
{ TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur()); std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp; ppp = m_mapNodeOverlaps.equal_range(idx); for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) { const TGeoOverlap* ovl = (const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second); { txt += "\n"; if (ovl) { txt += Form("%s: %g, ", ovl->IsOverlap() ? "Ovl" : "Extr", ovl->GetOverlap()); txt += ovl->GetTitle(); } } } }
std::vector< std::string > FWOverlapTableManager::getTitles | ( | ) | const [virtual] |
returns the title names for each column
Reimplemented from FWGeometryTableManagerBase.
Definition at line 52 of file FWOverlapTableManager.cc.
References numberOfColumns().
{ std::vector<std::string> returnValue; returnValue.reserve(numberOfColumns()); returnValue.push_back("Name"); returnValue.push_back("Color"); returnValue.push_back("RnrSelf"); returnValue.push_back("RnrChildren"); returnValue.push_back("Overlap"); returnValue.push_back("RnrMarker"); return returnValue; }
void FWOverlapTableManager::importOverlaps | ( | std::string | path, |
double | precision | ||
) |
Definition at line 70 of file FWOverlapTableManager.cc.
References addOverlapEntry(), relativeConstraints::geom, FWGeometryTableViewManager::getGeoMangeur(), FWGeometryTableViewBase::getTopNodeIdx(), i, kOverlap, kOverlapChild, kVisMarker, FWGeometryTableManagerBase::kVisNodeChld, FWGeometryTableManagerBase::kVisNodeSelf, m_browser, FWGeometryTableManagerBase::m_entries, FWGeometryTableManagerBase::NodeInfo::m_level, m_mapNodeOverlaps, FWOverlapTableView::m_markerIndices, FWOverlapTableView::m_markerVertices, FWGeometryTableManagerBase::NodeInfo::m_node, FWGeometryTableManagerBase::NodeInfo::m_parent, python::Node::node, VarParsing::obj, and analyzePatCleaning_cfg::overlaps.
Referenced by FWOverlapTableView::recalculate().
{ m_entries.clear(); m_mapNodeOverlaps.clear(); m_browser->m_markerVertices.clear(); m_browser->m_markerIndices.clear(); TEveGeoManagerHolder mangeur( FWGeometryTableViewManager::getGeoMangeur()); // gGeoManager->cd(); NodeInfo topNodeInfo; topNodeInfo.m_node = gGeoManager->GetTopNode(); topNodeInfo.m_level = 0; topNodeInfo.m_parent = -1; m_entries.resize(gGeoManager->GetNNodes()); m_entries[0] = topNodeInfo; m_entries.resize( gGeoManager->GetNNodes()); TGeoVolume* topVol = topNodeInfo.m_node->GetVolume(); Int_t icheck = 0; Int_t ncheck = 0; TStopwatch *timer; Int_t i; bool checkingOverlaps = false; TGeoManager *geom = topVol->GetGeoManager(); ncheck = topNodeInfo.m_node->CountDaughters(kFALSE); timer = new TStopwatch(); geom->ClearOverlaps(); geom->SetCheckingOverlaps(kTRUE); int oldS = 0; timer->Start(); geom->GetGeomPainter()->OpProgress(topVol->GetName(),icheck,ncheck,timer,kFALSE); // topVol->CheckOverlaps(iPrecision); icheck++; TGeoIterator git(topVol); Entries_i eit = m_entries.begin(); /* if (gGeoManager->GetListOfOverlaps()->GetEntriesFast()) { int newCnt = gGeoManager->GetListOfOverlaps()->GetEntriesFast(); for (int i=0; i<newCnt; ++i) { addOverlapEntry((TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At(i), new TGeoHMatrix(*geom->GetCurrentMatrix()), topNode, next); } oldS= newCnt; }*/ eit++; TGeoNode *node; icheck = 1; int topNodeIdx = m_browser->getTopNodeIdx(); while ((node=git())) { if (!eit->testBit(kOverlap)) eit->resetBit(kVisNodeSelf); eit->m_node = node; eit->m_color = node->GetVolume()->GetLineColor(); eit->m_level = git.GetLevel(); eit->m_parent = icheck; if ((topNodeIdx )== icheck || !topNodeIdx ) { // printf("start to check overlaps on topNodeIdx %s \n", eit->name()); checkingOverlaps=true; } else if (checkingOverlaps && ( eit->m_level <= m_entries[m_browser->getTopNodeIdx()].m_level)) { checkingOverlaps=false; } // parent index Entries_i pit = eit; do { --pit; --(eit->m_parent); if (pit->m_level < eit->m_level) break; } while (pit != m_entries.begin()); // overlap bits if ( checkingOverlaps) { if (!node->GetVolume()->IsSelected()) { geom->GetGeomPainter()->OpProgress(node->GetVolume()->GetName(),icheck+1,ncheck,timer,kFALSE); node->GetVolume()->SelectVolume(kFALSE); node->GetVolume()->CheckOverlaps(iPrecision); if (oldS != gGeoManager->GetListOfOverlaps()->GetEntriesFast()) { // printf("mother %s overlaps \n", node->GetName()); eit->setBit(kOverlapChild); eit->setBit(kVisNodeChld); eit->setBit(kVisMarker); TGeoHMatrix* motherm = new TGeoHMatrix(*geom->GetCurrentMatrix()); { TGeoNode* ni = topNodeInfo.m_node; for (Int_t i=1; i<=git.GetLevel(); i++) { ni = ni->GetDaughter(git.GetIndex(i)); motherm->Multiply(ni->GetMatrix()); } } int newCnt = gGeoManager->GetListOfOverlaps()->GetEntriesFast(); for (int i=oldS; i<newCnt; ++i) { // printf("add %p %p \n", (void*)node->GetVolume(), (void*)m_entries[icheck].m_node->GetVolume()); addOverlapEntry((TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At(i), i, icheck, motherm); } oldS = newCnt; } } } eit++; icheck ++; } topVol->SelectVolume(kTRUE); geom->SetCheckingOverlaps(kFALSE); // geom->SortOverlaps(); TObjArray *overlaps = geom->GetListOfOverlaps(); Int_t novlps = overlaps->GetEntriesFast(); TNamed *obj; for (i=0; i<novlps; i++) { obj = (TNamed*)overlaps->At(i); obj->SetName(Form("ov%05d",i)); } geom->GetGeomPainter()->OpProgress("Check overlaps:",icheck,ncheck,timer,kTRUE); Info("CheckOverlaps", "Number of illegal overlaps/extrusions : %d\n", novlps); delete timer; }
bool FWOverlapTableManager::nodeIsParent | ( | const NodeInfo & | data | ) | const [protected, virtual] |
Reimplemented from FWGeometryTableManagerBase.
Definition at line 331 of file FWOverlapTableManager.cc.
References kOverlapChild, FWOverlapTableView::listAllNodes(), m_browser, FWGeometryTableManagerBase::NodeInfo::m_node, and FWGeometryTableManagerBase::NodeInfo::testBit().
Referenced by cellRenderer().
{ return m_browser->listAllNodes() ? data.m_node->GetNdaughters() : data.testBit(kOverlapChild) ; }
virtual int FWOverlapTableManager::numberOfColumns | ( | ) | const [inline, virtual] |
Number of columns in the table.
Implements FWTableManagerBase.
Definition at line 48 of file FWOverlapTableManager.h.
Referenced by getTitles().
{return 6;}
const FWOverlapTableManager& FWOverlapTableManager::operator= | ( | const FWOverlapTableManager & | ) | [private] |
void FWOverlapTableManager::printOverlaps | ( | int | idx | ) | const |
Definition at line 336 of file FWOverlapTableManager.cc.
References FWGeometryTableViewManager::getGeoMangeur(), and m_mapNodeOverlaps.
Referenced by FWOverlapTableView::chosenItem().
{ TEveGeoManagerHolder gmgr( FWGeometryTableViewManager::getGeoMangeur()); std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp; ppp = m_mapNodeOverlaps.equal_range(idx); for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) { const TGeoOverlap* ovl = (const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second); if (ovl) ovl->Print(); } }
void FWOverlapTableManager::recalculateVisibility | ( | ) | [virtual] |
Implements FWGeometryTableManagerBase.
Definition at line 296 of file FWOverlapTableManager.cc.
References FWGeometryTableViewBase::getTopNodeIdx(), i, FWGeometryTableManagerBase::kExpanded, m_browser, FWGeometryTableManagerBase::m_entries, FWGeometryTableManagerBase::m_row_to_index, and recalculateVisibilityNodeRec().
{ // printf("overlap recalcuate vis \n"); m_row_to_index.clear(); int i = m_browser->getTopNodeIdx(); m_row_to_index.push_back(i); if (m_entries[i].testBit(kExpanded) ) recalculateVisibilityNodeRec(i); }
void FWOverlapTableManager::recalculateVisibilityNodeRec | ( | int | pIdx | ) | [virtual] |
Definition at line 307 of file FWOverlapTableManager.cc.
References AlCaHLTBitMon_QueryRunRegistry::data, FWGeometryTableManagerBase::getNNodesTotal(), UserOptions_cff::idx, FWGeometryTableManagerBase::kExpanded, kOverlap, kOverlapChild, FWOverlapTableView::listAllNodes(), m_browser, FWGeometryTableManagerBase::m_entries, FWGeometryTableManagerBase::m_row_to_index, n, FWGeometryTableManagerBase::NodeInfo::testBit(), and FWGeometryTableManagerBase::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_browser->listAllNodes() || data.testBitAny(kOverlap | kOverlapChild)) m_row_to_index.push_back(idx); if ((m_browser->listAllNodes() || data.testBit(kOverlapChild)) && data.testBit(kExpanded) ) recalculateVisibilityNodeRec(idx); FWGeometryTableManagerBase::getNNodesTotal(parentNode->GetDaughter(n), dOff); } }
void FWOverlapTableManager::setDaughtersSelfVisibility | ( | int | i, |
bool | v | ||
) |
Definition at line 512 of file FWOverlapTableManager.cc.
References AlCaHLTBitMon_QueryRunRegistry::data, FWGeometryTableManagerBase::getNNodesTotal(), UserOptions_cff::idx, FWGeometryTableManagerBase::kVisNodeChld, FWGeometryTableManagerBase::kVisNodeSelf, FWGeometryTableManagerBase::m_entries, n, and FWGeometryTableManagerBase::NodeInfo::setBitVal().
Referenced by FWOverlapTableView::chosenItem().
{ int dOff = 0; TGeoNode* parentNode = m_entries[selectedIdx].m_node; int nD = parentNode->GetNdaughters(); for (int n = 0; n != nD; ++n) { int idx = selectedIdx + 1 + n + dOff; NodeInfo& data = m_entries[idx]; data.setBitVal(FWGeometryTableManagerBase::kVisNodeChld, v); data.setBitVal(FWGeometryTableManagerBase::kVisNodeSelf, v); FWGeometryTableManagerBase::getNNodesTotal(parentNode->GetDaughter(n), dOff); } }
Definition at line 67 of file FWOverlapTableManager.h.
Referenced by addOverlapEntry(), cellRenderer(), importOverlaps(), nodeIsParent(), recalculateVisibility(), and recalculateVisibilityNodeRec().
std::multimap<int, int> FWOverlapTableManager::m_mapNodeOverlaps [private] |
Definition at line 69 of file FWOverlapTableManager.h.
Referenced by addOverlapEntry(), cellRenderer(), getOverlapTitles(), importOverlaps(), and printOverlaps().