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)
 
 FWTriggerTableView (const FWTriggerTableView &)=delete
 
const FWTriggerTableViewoperator= (const FWTriggerTableView &)=delete
 
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)
 
 FWViewBase (const FWViewBase &)=delete
 
const FWViewBaseoperator= (const FWViewBase &)=delete
 
void promptForSaveImageTo (TGFrame *) const
 
FWViewType::EType typeId () const
 
const std::string & typeName () const
 
- Public Member Functions inherited from FWConfigurableParameterizable
 FWConfigurableParameterizable (unsigned int iVersion=1)
 
 FWConfigurableParameterizable (const FWConfigurableParameterizable &)=delete
 
const FWConfigurableParameterizableoperator= (const FWConfigurableParameterizable &)=delete
 
unsigned int version () const
 
 ~FWConfigurableParameterizable () override
 
- Public Member Functions inherited from FWParameterizable
void add (FWParameterBase *)
 
const_iterator begin () const
 
const_iterator end () const
 
 FWParameterizable ()
 
 FWParameterizable (const FWParameterizable &)=delete
 
const FWParameterizableoperator= (const FWParameterizable &)=delete
 
virtual ~FWParameterizable ()
 
- Public Member Functions inherited from FWConfigurable
 FWConfigurable ()
 
 FWConfigurable (const FWConfigurable &)=delete
 
const FWConfigurableoperator= (const FWConfigurable &)=delete
 
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

bool isProcessValid () const
 
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 31 of file FWTriggerTableView.h.

Constructor & Destructor Documentation

◆ FWTriggerTableView() [1/2]

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

Definition at line 44 of file FWTriggerTableView.cc.

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

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

◆ ~FWTriggerTableView()

FWTriggerTableView::~FWTriggerTableView ( void  )
override

Definition at line 77 of file FWTriggerTableView.cc.

References m_eveWindow, m_tableManager, and m_vert.

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

◆ FWTriggerTableView() [2/2]

FWTriggerTableView::FWTriggerTableView ( const FWTriggerTableView )
delete

Member Function Documentation

◆ addTo()

void FWTriggerTableView::addTo ( FWConfiguration iTo) const
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 126 of file FWTriggerTableView.cc.

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

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

◆ backgroundColor()

Color_t FWTriggerTableView::backgroundColor ( ) const
inline

Definition at line 47 of file FWTriggerTableView.h.

References m_backgroundColor.

Referenced by FWTriggerTableViewTableManager::cellRenderer().

47 { return m_backgroundColor; }

◆ columnSelected()

void FWTriggerTableView::columnSelected ( Int_t  iCol,
Int_t  iButton,
Int_t  iKeyMod 
)

Definition at line 122 of file FWTriggerTableView.cc.

122 {}

◆ dataChanged()

void FWTriggerTableView::dataChanged ( void  )

Definition at line 111 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().

111  {
112  for (std::vector<Column>::iterator i = m_columns.begin(); i != m_columns.end(); ++i)
113  (*i).values.clear();
114 
116  if (fwlite::Event* event = dynamic_cast<fwlite::Event*>(base))
117  fillTable(event);
118 
120 }
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

◆ fillTable()

virtual void FWTriggerTableView::fillTable ( fwlite::Event event)
protectedpure virtual

Implemented in FWHLTTriggerTableView, and FWL1TriggerTableView.

Referenced by dataChanged().

◆ isProcessValid()

bool FWTriggerTableView::isProcessValid ( ) const
private

Definition at line 198 of file FWTriggerTableView.cc.

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

198  {
199  for (std::vector<std::string>::iterator i = m_processList->begin(); i != m_processList->end(); ++i) {
200  if (*i == m_process.value())
201  return true;
202  }
203  return false;
204 }
FWStringParameter m_process
std::vector< std::string > * m_processList

◆ operator=()

const FWTriggerTableView& FWTriggerTableView::operator= ( const FWTriggerTableView )
delete

◆ populateController()

void FWTriggerTableView::populateController ( ViewerParameterGUI gui) const
overrideprivatevirtual

Reimplemented from FWViewBase.

Definition at line 206 of file FWTriggerTableView.cc.

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

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

◆ processChanged()

void FWTriggerTableView::processChanged ( const char *  x)

Definition at line 193 of file FWTriggerTableView.cc.

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

193  {
194  m_process.set(x);
195  dataChanged();
196 }
FWStringParameter m_process

◆ resetCombo()

void FWTriggerTableView::resetCombo ( ) const

Definition at line 169 of file FWTriggerTableView.cc.

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

Referenced by populateController().

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

◆ saveImageTo()

void FWTriggerTableView::saveImageTo ( const std::string &  iName) const
overridevirtual

Implements FWViewBase.

Definition at line 231 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 runGCPTkAlMap::title.

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

◆ setBackgroundColor()

void FWTriggerTableView::setBackgroundColor ( Color_t  iColor)

Definition at line 87 of file FWTriggerTableView.cc.

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

87  {
88  m_backgroundColor = iColor;
89  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor));
90  m_tableWidget->SetLineSeparatorColor(gVirtualX->GetPixel(iColor == kWhite ? kBlack : kWhite));
91 }
void SetLineSeparatorColor(Pixel_t)
FWTableWidget * m_tableWidget
void SetBackgroundColor(Pixel_t) override

◆ setFrom()

void FWTriggerTableView::setFrom ( const FWConfiguration iFrom)
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 134 of file FWTriggerTableView.cc.

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

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

◆ setProcessList()

void FWTriggerTableView::setProcessList ( std::vector< std::string > *  x)
inline

Definition at line 58 of file FWTriggerTableView.h.

References m_processList, and x.

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

Friends And Related Function Documentation

◆ FWTriggerTableViewTableManager

friend class FWTriggerTableViewTableManager
friend

Definition at line 32 of file FWTriggerTableView.h.

Member Data Documentation

◆ m_backgroundColor

Color_t FWTriggerTableView::m_backgroundColor
private

Definition at line 88 of file FWTriggerTableView.h.

Referenced by backgroundColor(), and setBackgroundColor().

◆ m_columns

std::vector<Column> FWTriggerTableView::m_columns
protected

◆ m_combo

TGComboBox* FWTriggerTableView::m_combo
mutableprivate

Definition at line 80 of file FWTriggerTableView.h.

Referenced by populateController(), and resetCombo().

◆ m_eveWindow

TEveWindowFrame* FWTriggerTableView::m_eveWindow
private

Definition at line 83 of file FWTriggerTableView.h.

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

◆ m_process

FWStringParameter FWTriggerTableView::m_process
protected

◆ m_processList

std::vector<std::string>* FWTriggerTableView::m_processList
private

Definition at line 90 of file FWTriggerTableView.h.

Referenced by isProcessValid(), resetCombo(), and setProcessList().

◆ m_regex

FWStringParameter FWTriggerTableView::m_regex
protected

◆ m_tableManager

FWTriggerTableViewTableManager* FWTriggerTableView::m_tableManager
protected

◆ m_tableWidget

FWTableWidget* FWTriggerTableView::m_tableWidget
private

◆ m_vert

TGCompositeFrame* FWTriggerTableView::m_vert
private

Definition at line 84 of file FWTriggerTableView.h.

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