#include <FWTriggerTableView.h>
Classes | |
struct | Column |
Public Member Functions | |
virtual void | addTo (FWConfiguration &) const |
Color_t | backgroundColor () const |
void | columnSelected (Int_t iCol, Int_t iButton, Int_t iKeyMod) |
void | dataChanged (void) |
FWTriggerTableView (TEveWindowSlot *, FWViewType::EType) | |
void | processChanged (const char *) |
void | resetCombo () const |
virtual void | saveImageTo (const std::string &iName) const |
void | setBackgroundColor (Color_t) |
virtual void | setFrom (const FWConfiguration &) |
void | setProcessList (std::vector< std::string > *x) |
virtual | ~FWTriggerTableView (void) |
Protected Member Functions | |
virtual void | fillTable (fwlite::Event *event)=0 |
Protected Attributes | |
std::vector< Column > | m_columns |
FWStringParameter | m_process |
FWStringParameter | m_regex |
FWTriggerTableViewTableManager * | m_tableManager |
Private Member Functions | |
FWTriggerTableView (const FWTriggerTableView &) | |
bool | isProcessValid () const |
const FWTriggerTableView & | operator= (const FWTriggerTableView &) |
virtual void | populateController (ViewerParameterGUI &) const |
Private Attributes | |
Color_t | m_backgroundColor |
TGComboBox * | m_combo |
TEveWindowFrame * | m_eveWindow |
std::vector< std::string > * | m_processList |
FWTableWidget * | m_tableWidget |
TGCompositeFrame * | m_vert |
Friends | |
class | FWTriggerTableViewTableManager |
Definition at line 39 of file FWTriggerTableView.h.
FWTriggerTableView::FWTriggerTableView | ( | TEveWindowSlot * | iParent, |
FWViewType::EType | id | ||
) |
Definition at line 43 of file FWTriggerTableView.cc.
References FWGenericParameter< T >::changed_, dataChanged(), m_columns, m_eveWindow, m_regex, m_tableManager, m_tableWidget, m_vert, and FWTableWidget::SetHeaderBackgroundColor().
: FWViewBase(id, 2), m_regex(this,"Filter",std::string()), m_process(this,"Process",std::string((id == FWViewType::FWViewType::kTableHLT) ? "HLT" : "")), m_tableManager(new FWTriggerTableViewTableManager(this)), m_combo(0), m_eveWindow(0), m_vert(0), m_tableWidget(0), m_processList(0) { m_regex.changed_.connect(boost::bind(&FWTriggerTableView::dataChanged,this)); m_eveWindow = iParent->MakeFrame(0); TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame(); m_vert = new TGVerticalFrame(frame); frame->AddFrame(m_vert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); // have to have at least one column when call FWTableWidget constructor m_columns.push_back( Column( "Name" )); m_tableWidget = new FWTableWidget(m_tableManager, frame); m_tableWidget->SetHeaderBackgroundColor( gVirtualX->GetPixel( kWhite )); m_tableWidget->Connect("columnClicked(Int_t,Int_t,Int_t)", "FWTriggerTableView", this, "columnSelected(Int_t,Int_t,Int_t)"); m_vert->AddFrame(m_tableWidget, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); frame->MapSubwindows(); frame->Layout(); frame->MapWindow(); }
FWTriggerTableView::~FWTriggerTableView | ( | void | ) | [virtual] |
Definition at line 78 of file FWTriggerTableView.cc.
References m_eveWindow, m_tableManager, and m_vert.
{ // take out composite frame and delete it directly (without the timeout) TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame(); frame->RemoveFrame( m_vert ); delete m_vert; m_eveWindow->DestroyWindowAndSlot(); delete m_tableManager; }
FWTriggerTableView::FWTriggerTableView | ( | const FWTriggerTableView & | ) | [private] |
void FWTriggerTableView::addTo | ( | FWConfiguration & | iTo | ) | const [virtual] |
Reimplemented from FWConfigurableParameterizable.
Definition at line 137 of file FWTriggerTableView.cc.
References FWConfiguration::addKeyValue(), FWTableWidget::descendingSort(), kDescendingSort, kSortColumn, m_tableWidget, and FWTableWidget::sortedColumn().
{ FWConfigurableParameterizable::addTo(iTo); FWConfiguration sortColumn( m_tableWidget->sortedColumn()); iTo.addKeyValue( kSortColumn, sortColumn ); FWConfiguration descendingSort( m_tableWidget->descendingSort()); iTo.addKeyValue( kDescendingSort, descendingSort ); }
Color_t FWTriggerTableView::backgroundColor | ( | ) | const [inline] |
Definition at line 56 of file FWTriggerTableView.h.
References m_backgroundColor.
Referenced by FWTriggerTableViewTableManager::cellRenderer().
{ return m_backgroundColor; }
void FWTriggerTableView::columnSelected | ( | Int_t | iCol, |
Int_t | iButton, | ||
Int_t | iKeyMod | ||
) |
Definition at line 129 of file FWTriggerTableView.cc.
{ }
void FWTriggerTableView::dataChanged | ( | void | ) |
Definition at line 116 of file FWTriggerTableView.cc.
References FWTriggerTableViewTableManager::dataChanged(), event(), fillTable(), FWGUIManager::getCurrentEvent(), FWGUIManager::getGUIManager(), i, m_columns, and m_tableManager.
Referenced by FWHLTTriggerTableView::FWHLTTriggerTableView(), FWL1TriggerTableView::FWL1TriggerTableView(), FWTriggerTableView(), and processChanged().
{ for(std::vector<Column>::iterator i = m_columns.begin(); i!= m_columns.end(); ++i) (*i).values.clear(); edm::EventBase *base = const_cast<edm::EventBase*>(FWGUIManager::getGUIManager()->getCurrentEvent()); if (fwlite::Event* event = dynamic_cast<fwlite::Event*>(base)) fillTable(event); m_tableManager->dataChanged(); }
virtual void FWTriggerTableView::fillTable | ( | fwlite::Event * | event | ) | [protected, pure virtual] |
Implemented in FWHLTTriggerTableView, and FWL1TriggerTableView.
Referenced by dataChanged().
bool FWTriggerTableView::isProcessValid | ( | ) | const [private] |
Definition at line 222 of file FWTriggerTableView.cc.
References i, m_process, m_processList, and FWGenericParameter< T >::value().
{ for (std::vector<std::string>::iterator i = m_processList->begin(); i!= m_processList->end(); ++i) { if (*i == m_process.value()) return true; } return false; }
const FWTriggerTableView& FWTriggerTableView::operator= | ( | const FWTriggerTableView & | ) | [private] |
void FWTriggerTableView::populateController | ( | ViewerParameterGUI & | gui | ) | const [private, virtual] |
Reimplemented from FWViewBase.
Definition at line 233 of file FWTriggerTableView.cc.
References ViewerParameterGUI::addParam(), f, ViewerParameterGUI::getTabContainer(), FWViewType::kTableHLT, m_combo, m_regex, dbtoconf::parent, ViewerParameterGUI::requestTab(), resetCombo(), groupFilesInBlocks::tt, and FWViewBase::typeId().
{ gui.requestTab("Style").addParam(&m_regex); // resize filter frame TGCompositeFrame* parent = gui.getTabContainer(); TGFrameElement* el = (TGFrameElement*) parent->GetList()->Last(); el->fLayout->SetLayoutHints(kLHintsNormal); el->fFrame->Resize(180); // add combo for processes if (typeId() == FWViewType::kTableHLT) { TGHorizontalFrame* f = new TGHorizontalFrame(gui.getTabContainer()); gui.getTabContainer()->AddFrame(f, new TGLayoutHints(kLHintsNormal, 2, 2,2,2 )); m_combo = new TGComboBox(f); f->AddFrame(m_combo); m_combo->Resize(140, 20); f->AddFrame(new TGLabel(f, "Process"), new TGLayoutHints(kLHintsLeft, 8,2,2,2)); resetCombo(); FWTriggerTableView* tt = (FWTriggerTableView*)this; m_combo->Connect("Selected(const char*)", "FWTriggerTableView", tt, "processChanged(const char*)"); } }
void FWTriggerTableView::processChanged | ( | const char * | x | ) |
Definition at line 215 of file FWTriggerTableView.cc.
References dataChanged(), m_process, and FWGenericParameter< T >::set().
{ m_process.set(x); dataChanged(); }
void FWTriggerTableView::resetCombo | ( | ) | const |
Definition at line 187 of file FWTriggerTableView.cc.
References i, m_combo, m_process, m_processList, and FWGenericParameter< T >::value().
Referenced by populateController().
{ if (m_combo && m_processList) { m_combo->RemoveAll(); int cnt = 0; int id = -1; for (std::vector<std::string>::iterator i = m_processList->begin(); i != m_processList->end(); ++i) { if (m_process.value() == *i ) id = cnt; m_combo->AddEntry((*i).c_str(), cnt); cnt++; } if(id < 0) { // fwLog(fwlog::kWarning) << "FWTriggerTableView: no trigger results with process name "<< m_process.value() << " is available" << std::endl; m_combo->AddEntry(m_process.value().c_str(), cnt); id = cnt; } m_combo->SortByName(); m_combo->Select(id, false); } }
void FWTriggerTableView::saveImageTo | ( | const std::string & | iName | ) | const [virtual] |
Implements FWViewBase.
Definition at line 261 of file FWTriggerTableView.cc.
References trackerHits::c, FWTriggerTableViewTableManager::cellRenderer(), gather_cfg::cout, data, FWTextTableCellRenderer::data(), cmsPerfStripChart::format, m_columns, m_tableManager, FWTriggerTableViewTableManager::numberOfColumns(), FWTriggerTableViewTableManager::numberOfRows(), alignCSCRings::r, confdb::splitter(), and indexGen::title.
{ TString format; TString data; FWTextTableCellRenderer* textRenderer; // calculate widths std::vector<size_t> widths(m_tableManager->numberOfColumns()); for (int c = 0; c < m_tableManager->numberOfColumns(); ++c ) widths[c] = m_columns[c].title.size(); for (int c = 0; c < m_tableManager->numberOfColumns(); ++c ) { for (int r = 0; r < m_tableManager->numberOfRows(); r++ ) { textRenderer = (FWTextTableCellRenderer*) m_tableManager->cellRenderer(r, c); // setup cell renderer size_t ss = textRenderer->data().size(); if (widths[c] < ss) widths[c] = ss; } } int rlen = 0; for (size_t c = 0; c < (size_t)m_tableManager->numberOfColumns(); ++c ) rlen += widths[c]; rlen += (m_tableManager->numberOfColumns() -1 )*3 ; rlen++; printf("\n"); int lastCol = m_tableManager->numberOfColumns() -1; for (int c = 0; c < m_tableManager->numberOfColumns(); ++c ) { format.Form("%%%ds", (int)widths[c]); data.Form(format,m_columns[c].title.c_str()); if (c == lastCol) printf("%s", data.Data()); else printf("%s | ", data.Data()); } printf("\n"); std::string splitter(rlen, '-'); std::cout << splitter << std::endl; for (int r = 0; r < m_tableManager->numberOfRows(); r++ ) { for (int c = 0; c < m_tableManager->numberOfColumns(); ++c ) { format.Form("%%%ds", (int)widths[c]); textRenderer = (FWTextTableCellRenderer*) m_tableManager->cellRenderer(r, c); // setup cell renderer data.Form(format, textRenderer->data().c_str()); if (c == lastCol) printf("%s", data.Data()); else printf("%s | ", data.Data()); } printf("\n"); } }
void FWTriggerTableView::setBackgroundColor | ( | Color_t | iColor | ) |
Definition at line 90 of file FWTriggerTableView.cc.
References m_backgroundColor, m_tableWidget, FWTableWidget::SetBackgroundColor(), and FWTableWidget::SetLineSeparatorColor().
{ m_backgroundColor = iColor; m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor)); m_tableWidget->SetLineSeparatorColor( gVirtualX->GetPixel(iColor == kWhite ? kBlack : kWhite)); }
void FWTriggerTableView::setFrom | ( | const FWConfiguration & | iFrom | ) | [virtual] |
Reimplemented from FWConfigurableParameterizable.
Definition at line 147 of file FWTriggerTableView.cc.
References kDescendingSort, kSortColumn, FWViewType::kTableHLT, m_process, m_regex, m_tableManager, m_tableWidget, main(), FWTriggerTableViewTableManager::numberOfColumns(), FWGenericParameter< T >::setFrom(), python::multivaluedict::sort(), FWTableWidget::sort(), FWViewBase::typeId(), FWGenericParameter< T >::value(), FWConfiguration::value(), FWConfiguration::valueForKey(), FWConfigurableParameterizable::version(), and FWConfiguration::version().
{ const FWConfiguration *main = &iFrom; // unnecessary nesting for old version if (version() < 2) { if (typeId() == FWViewType::kTableHLT) main = iFrom.valueForKey( "HLTTriggerTableView" ); else main = iFrom.valueForKey( "L1TriggerTableView" ); } const FWConfiguration *sortColumn = main->valueForKey( kSortColumn ); const FWConfiguration *descendingSort = main->valueForKey( kDescendingSort ); if( sortColumn != 0 && descendingSort != 0 ) { unsigned int sort = sortColumn->version(); bool descending = descendingSort->version(); if( sort < (( unsigned int ) m_tableManager->numberOfColumns())) m_tableWidget->sort( sort, descending ); } if ( typeId() == FWViewType::kTableHLT ) { const FWConfiguration* vp = iFrom.valueForKey("Process" ); if ( vp && (vp->value() != m_process.value())) m_process.setFrom(iFrom); } { const FWConfiguration* vp = iFrom.valueForKey("Filter" ); if (vp && (vp->value() != m_regex.value())) m_regex.setFrom(iFrom); } }
void FWTriggerTableView::setProcessList | ( | std::vector< std::string > * | x | ) | [inline] |
Definition at line 67 of file FWTriggerTableView.h.
References m_processList, and x.
{ m_processList = x; }
friend class FWTriggerTableViewTableManager [friend] |
Definition at line 41 of file FWTriggerTableView.h.
Color_t FWTriggerTableView::m_backgroundColor [private] |
Definition at line 96 of file FWTriggerTableView.h.
Referenced by backgroundColor(), and setBackgroundColor().
std::vector<Column> FWTriggerTableView::m_columns [protected] |
Definition at line 75 of file FWTriggerTableView.h.
Referenced by FWTriggerTableViewTableManager::cellRenderer(), dataChanged(), FWHLTTriggerTableView::fillTable(), FWL1TriggerTableView::fillTable(), FWHLTTriggerTableView::FWHLTTriggerTableView(), FWL1TriggerTableView::FWL1TriggerTableView(), FWTriggerTableView(), FWTriggerTableViewTableManager::getTitles(), FWTriggerTableViewTableManager::implSort(), FWTriggerTableViewTableManager::numberOfColumns(), FWTriggerTableViewTableManager::numberOfRows(), and saveImageTo().
TGComboBox* FWTriggerTableView::m_combo [mutable, private] |
Definition at line 87 of file FWTriggerTableView.h.
Referenced by populateController(), and resetCombo().
TEveWindowFrame* FWTriggerTableView::m_eveWindow [private] |
Definition at line 90 of file FWTriggerTableView.h.
Referenced by FWTriggerTableView(), and ~FWTriggerTableView().
FWStringParameter FWTriggerTableView::m_process [protected] |
Definition at line 73 of file FWTriggerTableView.h.
Referenced by FWHLTTriggerTableView::fillTable(), isProcessValid(), processChanged(), resetCombo(), and setFrom().
std::vector<std::string>* FWTriggerTableView::m_processList [private] |
Definition at line 98 of file FWTriggerTableView.h.
Referenced by isProcessValid(), resetCombo(), and setProcessList().
FWStringParameter FWTriggerTableView::m_regex [protected] |
Definition at line 72 of file FWTriggerTableView.h.
Referenced by FWHLTTriggerTableView::fillTable(), FWL1TriggerTableView::fillTable(), FWTriggerTableView(), populateController(), and setFrom().
Definition at line 76 of file FWTriggerTableView.h.
Referenced by dataChanged(), FWHLTTriggerTableView::fillTable(), FWTriggerTableView(), saveImageTo(), setFrom(), and ~FWTriggerTableView().
FWTableWidget* FWTriggerTableView::m_tableWidget [private] |
Definition at line 94 of file FWTriggerTableView.h.
Referenced by addTo(), FWTriggerTableView(), FWTriggerTableViewTableManager::FWTriggerTableViewTableManager(), setBackgroundColor(), and setFrom().
TGCompositeFrame* FWTriggerTableView::m_vert [private] |
Definition at line 91 of file FWTriggerTableView.h.
Referenced by FWTriggerTableView(), and ~FWTriggerTableView().