CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
FWTriggerTableView Class Referenceabstract

#include <FWTriggerTableView.h>

Inheritance diagram for FWTriggerTableView:
FWViewBase FWConfigurableParameterizable FWParameterizable FWConfigurable FWHLTTriggerTableView FWL1TriggerTableView

Classes

struct  Column
 

Public Member Functions

void addTo (FWConfiguration &) const override
 
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
 
void saveImageTo (const std::string &iName) const override
 
void setBackgroundColor (Color_t)
 
void setFrom (const FWConfiguration &) override
 
void setProcessList (std::vector< std::string > *x)
 
 ~FWTriggerTableView (void) override
 
- Public Member Functions inherited from FWViewBase
virtual FWViewContextMenuHandlerBasecontextMenuHandler () const
 
void destroy ()
 
 FWViewBase (FWViewType::EType, unsigned int iVersion=1)
 
void promptForSaveImageTo (TGFrame *) const
 
FWViewType::EType typeId () const
 
const std::string & typeName () const
 
- Public Member Functions inherited from FWConfigurableParameterizable
 FWConfigurableParameterizable (unsigned int iVersion=1)
 
unsigned int version () const
 
 ~FWConfigurableParameterizable () override
 
- Public Member Functions inherited from FWParameterizable
void add (FWParameterBase *)
 
const_iterator begin () const
 
const_iterator end () const
 
 FWParameterizable ()
 
virtual ~FWParameterizable ()
 
- Public Member Functions inherited from FWConfigurable
 FWConfigurable ()
 
virtual ~FWConfigurable ()
 

Protected Member Functions

virtual void fillTable (fwlite::Event *event)=0
 
- Protected Member Functions inherited from FWViewBase
 ~FWViewBase () override
 

Protected Attributes

std::vector< Columnm_columns
 
FWStringParameter m_process
 
FWStringParameter m_regex
 
FWTriggerTableViewTableManagerm_tableManager
 
- Protected Attributes inherited from FWViewBase
FWViewType m_type
 

Private Member Functions

 FWTriggerTableView (const FWTriggerTableView &)=delete
 
bool isProcessValid () const
 
const FWTriggerTableViewoperator= (const FWTriggerTableView &)=delete
 
void populateController (ViewerParameterGUI &) const override
 

Private Attributes

Color_t m_backgroundColor
 
TGComboBox * m_combo
 
TEveWindowFrame * m_eveWindow
 
std::vector< std::string > * m_processList
 
FWTableWidgetm_tableWidget
 
TGCompositeFrame * m_vert
 

Friends

class FWTriggerTableViewTableManager
 

Additional Inherited Members

- Public Types inherited from FWParameterizable
typedef std::vector< FWParameterBase * >::const_iterator const_iterator
 
- Public Attributes inherited from FWViewBase
sigc::signal< void, const FWViewBase * > beingDestroyed_
 
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
 

Detailed Description

Definition at line 33 of file FWTriggerTableView.h.

Constructor & Destructor Documentation

FWTriggerTableView::FWTriggerTableView ( TEveWindowSlot *  iParent,
FWViewType::EType  id 
)

Definition at line 43 of file FWTriggerTableView.cc.

References FWGenericParameter< T >::changed_, dataChanged(), amptDefault_cfi::frame, m_columns, m_eveWindow, m_regex, m_tableManager, m_tableWidget, m_vert, and FWTableWidget::SetHeaderBackgroundColor().

44  : FWViewBase(id, 2),
45  m_regex(this, "Filter", std::string()),
46  m_process(this, "Process", std::string((id == FWViewType::FWViewType::kTableHLT) ? "HLT" : "")),
48  m_combo(nullptr),
49  m_eveWindow(nullptr),
50  m_vert(nullptr),
51  m_tableWidget(nullptr),
52  m_processList(nullptr) {
53  m_regex.changed_.connect(boost::bind(&FWTriggerTableView::dataChanged, this));
54 
55  m_eveWindow = iParent->MakeFrame(nullptr);
56  TGCompositeFrame* frame = m_eveWindow->GetGUICompositeFrame();
57 
58  m_vert = new TGVerticalFrame(frame);
59  frame->AddFrame(m_vert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
60 
61  // have to have at least one column when call FWTableWidget constructor
62  m_columns.push_back(Column("Name"));
63 
65  m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(kWhite));
66 
67  m_tableWidget->Connect(
68  "columnClicked(Int_t,Int_t,Int_t)", "FWTriggerTableView", this, "columnSelected(Int_t,Int_t,Int_t)");
69  m_vert->AddFrame(m_tableWidget, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
70 
71  frame->MapSubwindows();
72  frame->Layout();
73  frame->MapWindow();
74 }
std::vector< Column > m_columns
FWStringParameter m_regex
void SetHeaderBackgroundColor(Pixel_t)
TGCompositeFrame * m_vert
FWTableWidget * m_tableWidget
TEveWindowFrame * m_eveWindow
FWStringParameter m_process
friend class FWTriggerTableViewTableManager
sigc::signal< void, T > changed_
std::vector< std::string > * m_processList
FWTriggerTableViewTableManager * m_tableManager
FWViewBase(FWViewType::EType, unsigned int iVersion=1)
Definition: FWViewBase.cc:32
FWTriggerTableView::~FWTriggerTableView ( void  )
override

Definition at line 76 of file FWTriggerTableView.cc.

References amptDefault_cfi::frame, m_eveWindow, m_tableManager, and m_vert.

76  {
77  // take out composite frame and delete it directly (without the timeout)
78  TGCompositeFrame* frame = m_eveWindow->GetGUICompositeFrame();
79  frame->RemoveFrame(m_vert);
80  delete m_vert;
81 
82  m_eveWindow->DestroyWindowAndSlot();
83  delete m_tableManager;
84 }
TGCompositeFrame * m_vert
TEveWindowFrame * m_eveWindow
FWTriggerTableViewTableManager * m_tableManager
FWTriggerTableView::FWTriggerTableView ( const FWTriggerTableView )
privatedelete

Member Function Documentation

void FWTriggerTableView::addTo ( FWConfiguration iTo) const
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 125 of file FWTriggerTableView.cc.

References FWConfiguration::addKeyValue(), FWConfigurableParameterizable::addTo(), FWTableWidget::descendingSort(), kDescendingSort, kSortColumn, m_tableWidget, and FWTableWidget::sortedColumn().

125  {
128  iTo.addKeyValue(kSortColumn, sortColumn);
129  FWConfiguration descendingSort(m_tableWidget->descendingSort());
130  iTo.addKeyValue(kDescendingSort, descendingSort);
131 }
void addTo(FWConfiguration &) const override
FWTableWidget * m_tableWidget
bool descendingSort() const
Definition: FWTableWidget.h:88
static const std::string kDescendingSort
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
static const std::string kSortColumn
int sortedColumn() const
Definition: FWTableWidget.h:87
Color_t FWTriggerTableView::backgroundColor ( ) const
inline

Definition at line 49 of file FWTriggerTableView.h.

Referenced by FWTriggerTableViewTableManager::cellRenderer().

49 { return m_backgroundColor; }
void FWTriggerTableView::columnSelected ( Int_t  iCol,
Int_t  iButton,
Int_t  iKeyMod 
)

Definition at line 121 of file FWTriggerTableView.cc.

121 {}
void FWTriggerTableView::dataChanged ( void  )

Definition at line 110 of file FWTriggerTableView.cc.

References newFWLiteAna::base, FWTriggerTableViewTableManager::dataChanged(), fillTable(), FWGUIManager::getCurrentEvent(), FWGUIManager::getGUIManager(), mps_fire::i, m_columns, and m_tableManager.

Referenced by FWHLTTriggerTableView::FWHLTTriggerTableView(), FWL1TriggerTableView::FWL1TriggerTableView(), FWTriggerTableView(), and processChanged().

110  {
111  for (std::vector<Column>::iterator i = m_columns.begin(); i != m_columns.end(); ++i)
112  (*i).values.clear();
113 
115  if (fwlite::Event* event = dynamic_cast<fwlite::Event*>(base))
116  fillTable(event);
117 
119 }
std::vector< Column > m_columns
virtual void fillTable(fwlite::Event *event)=0
base
Main Program
Definition: newFWLiteAna.py:92
const edm::EventBase * getCurrentEvent() const
static FWGUIManager * getGUIManager()
FWTriggerTableViewTableManager * m_tableManager
Definition: event.py:1
virtual void FWTriggerTableView::fillTable ( fwlite::Event event)
protectedpure virtual

Implemented in FWHLTTriggerTableView, and FWL1TriggerTableView.

Referenced by dataChanged().

bool FWTriggerTableView::isProcessValid ( ) const
private

Definition at line 197 of file FWTriggerTableView.cc.

References mps_fire::i, m_process, m_processList, and FWGenericParameter< T >::value().

197  {
198  for (std::vector<std::string>::iterator i = m_processList->begin(); i != m_processList->end(); ++i) {
199  if (*i == m_process.value())
200  return true;
201  }
202  return false;
203 }
FWStringParameter m_process
std::vector< std::string > * m_processList
const FWTriggerTableView& FWTriggerTableView::operator= ( const FWTriggerTableView )
privatedelete
void FWTriggerTableView::populateController ( ViewerParameterGUI gui) const
overrideprivatevirtual

Reimplemented from FWViewBase.

Definition at line 205 of file FWTriggerTableView.cc.

References ViewerParameterGUI::addParam(), f, ViewerParameterGUI::getTabContainer(), FWViewType::kTableHLT, m_combo, m_regex, class-composition::parent, ViewerParameterGUI::requestTab(), resetCombo(), groupFilesInBlocks::tt, and FWViewBase::typeId().

205  {
206  gui.requestTab("Style").addParam(&m_regex);
207 
208  // resize filter frame
209  TGCompositeFrame* parent = gui.getTabContainer();
210  TGFrameElement* el = (TGFrameElement*)parent->GetList()->Last();
211  el->fLayout->SetLayoutHints(kLHintsNormal);
212  el->fFrame->Resize(180);
213 
214  // add combo for processes
215  if (typeId() == FWViewType::kTableHLT) {
216  TGHorizontalFrame* f = new TGHorizontalFrame(gui.getTabContainer());
217  gui.getTabContainer()->AddFrame(f, new TGLayoutHints(kLHintsNormal, 2, 2, 2, 2));
218 
219  m_combo = new TGComboBox(f);
220  f->AddFrame(m_combo);
221  m_combo->Resize(140, 20);
222  f->AddFrame(new TGLabel(f, "Process"), new TGLayoutHints(kLHintsLeft, 8, 2, 2, 2));
223 
224  resetCombo();
226  m_combo->Connect("Selected(const char*)", "FWTriggerTableView", tt, "processChanged(const char*)");
227  }
228 }
FWStringParameter m_regex
ViewerParameterGUI & requestTab(const char *)
double f[11][100]
ViewerParameterGUI & addParam(const FWParameterBase *)
TGCompositeFrame * getTabContainer()
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
void FWTriggerTableView::processChanged ( const char *  x)

Definition at line 192 of file FWTriggerTableView.cc.

References dataChanged(), m_process, and FWGenericParameter< T >::set().

192  {
193  m_process.set(x);
194  dataChanged();
195 }
FWStringParameter m_process
void FWTriggerTableView::resetCombo ( ) const

Definition at line 168 of file FWTriggerTableView.cc.

References mps_fire::i, m_combo, m_process, m_processList, and FWGenericParameter< T >::value().

Referenced by populateController().

168  {
169  if (m_combo && m_processList) {
170  m_combo->RemoveAll();
171  int cnt = 0;
172  int id = -1;
173  for (std::vector<std::string>::iterator i = m_processList->begin(); i != m_processList->end(); ++i) {
174  if (m_process.value() == *i)
175  id = cnt;
176 
177  m_combo->AddEntry((*i).c_str(), cnt);
178  cnt++;
179  }
180 
181  if (id < 0) {
182  // fwLog(fwlog::kWarning) << "FWTriggerTableView: no trigger results with process name "<< m_process.value() << " is available" << std::endl;
183  m_combo->AddEntry(m_process.value().c_str(), cnt);
184  id = cnt;
185  }
186 
187  m_combo->SortByName();
188  m_combo->Select(id, false);
189  }
190 }
FWStringParameter m_process
std::vector< std::string > * m_processList
void FWTriggerTableView::saveImageTo ( const std::string &  iName) const
overridevirtual

Implements FWViewBase.

Definition at line 230 of file FWTriggerTableView.cc.

References HltBtagPostValidation_cff::c, FWTriggerTableViewTableManager::cellRenderer(), gather_cfg::cout, FWTextTableCellRenderer::data(), data, dqm-mbProfile::format, m_columns, m_tableManager, FWTriggerTableViewTableManager::numberOfColumns(), FWTriggerTableViewTableManager::numberOfRows(), alignCSCRings::r, confdb::splitter(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and overlapproblemtsosanalyzer_cfi::title.

230  {
231  TString format;
232  TString data;
233  FWTextTableCellRenderer* textRenderer;
234 
235  // calculate widths
236  std::vector<size_t> widths(m_tableManager->numberOfColumns());
237 
238  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c)
239  widths[c] = m_columns[c].title.size();
240 
241  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
242  for (int r = 0; r < m_tableManager->numberOfRows(); r++) {
243  textRenderer = (FWTextTableCellRenderer*)m_tableManager->cellRenderer(r, c); // setup cell renderer
244  size_t ss = textRenderer->data().size();
245  if (widths[c] < ss)
246  widths[c] = ss;
247  }
248  }
249 
250  int rlen = 0;
251  for (size_t c = 0; c < (size_t)m_tableManager->numberOfColumns(); ++c)
252  rlen += widths[c];
253  rlen += (m_tableManager->numberOfColumns() - 1) * 3;
254  rlen++;
255 
256  printf("\n");
257  int lastCol = m_tableManager->numberOfColumns() - 1;
258 
259  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
260  format.Form("%%%ds", (int)widths[c]);
261  data.Form(format, m_columns[c].title.c_str());
262  if (c == lastCol)
263  printf("%s", data.Data());
264  else
265  printf("%s | ", data.Data());
266  }
267  printf("\n");
268 
269  std::string splitter(rlen, '-');
270  std::cout << splitter << std::endl;
271 
272  for (int r = 0; r < m_tableManager->numberOfRows(); r++) {
273  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
274  format.Form("%%%ds", (int)widths[c]);
275  textRenderer = (FWTextTableCellRenderer*)m_tableManager->cellRenderer(r, c); // setup cell renderer
276  data.Form(format, textRenderer->data().c_str());
277  if (c == lastCol)
278  printf("%s", data.Data());
279  else
280  printf("%s | ", data.Data());
281  }
282  printf("\n");
283  }
284 }
int numberOfRows() const override
Number of rows in the table.
def splitter(iterator, n)
Definition: confdb.py:13
std::vector< Column > m_columns
int numberOfColumns() const override
Number of columns in the table.
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
const std::string & data()
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FWTriggerTableViewTableManager * m_tableManager
void FWTriggerTableView::setBackgroundColor ( Color_t  iColor)

Definition at line 86 of file FWTriggerTableView.cc.

References m_backgroundColor, m_tableWidget, FWTableWidget::SetBackgroundColor(), and FWTableWidget::SetLineSeparatorColor().

Referenced by Vispa.Plugins.EdmBrowser.EventContentView.LabelItem::__init__().

86  {
87  m_backgroundColor = iColor;
88  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor));
89  m_tableWidget->SetLineSeparatorColor(gVirtualX->GetPixel(iColor == kWhite ? kBlack : kWhite));
90 }
void SetLineSeparatorColor(Pixel_t)
FWTableWidget * m_tableWidget
void SetBackgroundColor(Pixel_t) override
void FWTriggerTableView::setFrom ( const FWConfiguration iFrom)
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 133 of file FWTriggerTableView.cc.

References kDescendingSort, kSortColumn, FWViewType::kTableHLT, m_process, m_regex, m_tableManager, m_tableWidget, FWTriggerTableViewTableManager::numberOfColumns(), FWGenericParameter< T >::setFrom(), FWTableWidget::sort(), FWViewBase::typeId(), FWConfiguration::value(), FWGenericParameter< T >::value(), FWConfiguration::valueForKey(), FWConfigurableParameterizable::version(), and FWConfiguration::version().

133  {
134  const FWConfiguration* main = &iFrom;
135 
136  // unnecessary nesting for old version
137  if (version() < 2) {
138  if (typeId() == FWViewType::kTableHLT)
139  main = iFrom.valueForKey("HLTTriggerTableView");
140  else
141  main = iFrom.valueForKey("L1TriggerTableView");
142  }
143 
144  const FWConfiguration* sortColumn = main->valueForKey(kSortColumn);
145  const FWConfiguration* descendingSort = main->valueForKey(kDescendingSort);
146  if (sortColumn != nullptr && descendingSort != nullptr) {
147  unsigned int sort = sortColumn->version();
148  bool descending = descendingSort->version();
149  if (sort < ((unsigned int)m_tableManager->numberOfColumns()))
150  m_tableWidget->sort(sort, descending);
151  }
152 
153  if (typeId() == FWViewType::kTableHLT) {
154  const FWConfiguration* vp = iFrom.valueForKey("Process");
155  if (vp && (vp->value() != m_process.value()))
156  m_process.setFrom(iFrom);
157  }
158 
159  {
160  const FWConfiguration* vp = iFrom.valueForKey("Filter");
161  if (vp && (vp->value() != m_regex.value()))
162  m_regex.setFrom(iFrom);
163  }
164 }
int numberOfColumns() const override
Number of columns in the table.
FWStringParameter m_regex
void setFrom(const FWConfiguration &iFrom) override
unsigned int version() const
FWTableWidget * m_tableWidget
void sort(UInt_t iColumn, bool iDescendingSort)
static const std::string kDescendingSort
const std::string & value(unsigned int iIndex=0) const
static const std::string kSortColumn
FWStringParameter m_process
Definition: main.py:1
FWTriggerTableViewTableManager * m_tableManager
const FWConfiguration * valueForKey(const std::string &iKey) const
FWViewType::EType typeId() const
Definition: FWViewBase.h:42
void FWTriggerTableView::setProcessList ( std::vector< std::string > *  x)
inline

Definition at line 60 of file FWTriggerTableView.h.

60 { m_processList = x; }
std::vector< std::string > * m_processList

Friends And Related Function Documentation

friend class FWTriggerTableViewTableManager
friend

Definition at line 34 of file FWTriggerTableView.h.

Member Data Documentation

Color_t FWTriggerTableView::m_backgroundColor
private

Definition at line 89 of file FWTriggerTableView.h.

Referenced by setBackgroundColor().

std::vector<Column> FWTriggerTableView::m_columns
protected
TGComboBox* FWTriggerTableView::m_combo
mutableprivate

Definition at line 81 of file FWTriggerTableView.h.

Referenced by populateController(), and resetCombo().

TEveWindowFrame* FWTriggerTableView::m_eveWindow
private

Definition at line 84 of file FWTriggerTableView.h.

Referenced by FWTriggerTableView(), and ~FWTriggerTableView().

FWStringParameter FWTriggerTableView::m_process
protected
std::vector<std::string>* FWTriggerTableView::m_processList
private

Definition at line 91 of file FWTriggerTableView.h.

Referenced by isProcessValid(), and resetCombo().

FWStringParameter FWTriggerTableView::m_regex
protected
FWTriggerTableViewTableManager* FWTriggerTableView::m_tableManager
protected
FWTableWidget* FWTriggerTableView::m_tableWidget
private
TGCompositeFrame* FWTriggerTableView::m_vert
private

Definition at line 85 of file FWTriggerTableView.h.

Referenced by FWTriggerTableView(), and ~FWTriggerTableView().