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

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)
 
- 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
 
virtual ~FWConfigurableParameterizable ()
 
- 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
virtual ~FWViewBase ()
 

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 &)
 
bool isProcessValid () const
 
const FWTriggerTableViewoperator= (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
 
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 38 of file FWTriggerTableView.h.

Constructor & Destructor Documentation

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

Definition at line 79 of file FWTriggerTableView.cc.

References m_eveWindow, m_tableManager, and m_vert.

80 {
81  // take out composite frame and delete it directly (without the timeout)
82  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
83  frame->RemoveFrame( m_vert );
84  delete m_vert;
85 
86  m_eveWindow->DestroyWindowAndSlot();
87  delete m_tableManager;
88 }
TGCompositeFrame * m_vert
TEveWindowFrame * m_eveWindow
FWTriggerTableViewTableManager * m_tableManager
FWTriggerTableView::FWTriggerTableView ( const FWTriggerTableView )
private

Member Function Documentation

void FWTriggerTableView::addTo ( FWConfiguration iTo) const
virtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 138 of file FWTriggerTableView.cc.

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

139 {
142  iTo.addKeyValue( kSortColumn, sortColumn );
143  FWConfiguration descendingSort( m_tableWidget->descendingSort());
144  iTo.addKeyValue( kDescendingSort, descendingSort );
145 }
FWTableWidget * m_tableWidget
bool descendingSort() const
Definition: FWTableWidget.h:90
static const std::string kDescendingSort
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
static const std::string kSortColumn
int sortedColumn() const
Definition: FWTableWidget.h:89
virtual void addTo(FWConfiguration &) const
Color_t FWTriggerTableView::backgroundColor ( ) const
inline

Definition at line 55 of file FWTriggerTableView.h.

Referenced by FWTriggerTableViewTableManager::cellRenderer().

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

Definition at line 130 of file FWTriggerTableView.cc.

131 {
132 }
void FWTriggerTableView::dataChanged ( void  )

Definition at line 117 of file FWTriggerTableView.cc.

References runEdmFileComparison::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().

118 {
119  for(std::vector<Column>::iterator i = m_columns.begin(); i!= m_columns.end(); ++i)
120  (*i).values.clear();
121 
123  if (fwlite::Event* event = dynamic_cast<fwlite::Event*>(base))
124  fillTable(event);
125 
127 }
std::vector< Column > m_columns
virtual void fillTable(fwlite::Event *event)=0
base
Make Sure CMSSW is Setup ##.
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 223 of file FWTriggerTableView.cc.

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

224 {
225  for (std::vector<std::string>::iterator i = m_processList->begin(); i!= m_processList->end(); ++i)
226  {
227  if (*i == m_process.value())
228  return true;
229  }
230  return false;
231 }
FWStringParameter m_process
std::vector< std::string > * m_processList
const FWTriggerTableView& FWTriggerTableView::operator= ( const FWTriggerTableView )
private
void FWTriggerTableView::populateController ( ViewerParameterGUI gui) const
privatevirtual

Reimplemented from FWViewBase.

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

235 {
236  gui.requestTab("Style").addParam(&m_regex);
237 
238  // resize filter frame
239  TGCompositeFrame* parent = gui.getTabContainer();
240  TGFrameElement* el = (TGFrameElement*) parent->GetList()->Last();
241  el->fLayout->SetLayoutHints(kLHintsNormal);
242  el->fFrame->Resize(180);
243 
244  // add combo for processes
245  if (typeId() == FWViewType::kTableHLT)
246  {
247  TGHorizontalFrame* f = new TGHorizontalFrame(gui.getTabContainer());
248  gui.getTabContainer()->AddFrame(f, new TGLayoutHints(kLHintsNormal, 2, 2,2,2 ));
249 
250  m_combo = new TGComboBox(f);
251  f->AddFrame(m_combo);
252  m_combo->Resize(140, 20);
253  f->AddFrame(new TGLabel(f, "Process"), new TGLayoutHints(kLHintsLeft, 8,2,2,2));
254 
255  resetCombo();
257  m_combo->Connect("Selected(const char*)", "FWTriggerTableView", tt, "processChanged(const char*)");
258  }
259 }
FWStringParameter m_regex
ViewerParameterGUI & requestTab(const char *)
double f[11][100]
ViewerParameterGUI & addParam(const FWParameterBase *)
TGCompositeFrame * getTabContainer()
FWViewType::EType typeId() const
Definition: FWViewBase.h:43
void FWTriggerTableView::processChanged ( const char *  x)

Definition at line 216 of file FWTriggerTableView.cc.

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

217 {
218  m_process.set(x);
219  dataChanged();
220 }
FWStringParameter m_process
void FWTriggerTableView::resetCombo ( ) const

Definition at line 188 of file FWTriggerTableView.cc.

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

Referenced by populateController().

189 {
190  if (m_combo && m_processList)
191  {
192  m_combo->RemoveAll();
193  int cnt = 0;
194  int id = -1;
195  for (std::vector<std::string>::iterator i = m_processList->begin(); i != m_processList->end(); ++i)
196  {
197  if (m_process.value() == *i ) id = cnt;
198 
199  m_combo->AddEntry((*i).c_str(), cnt);
200  cnt++;
201  }
202 
203  if(id < 0)
204  {
205  // fwLog(fwlog::kWarning) << "FWTriggerTableView: no trigger results with process name "<< m_process.value() << " is available" << std::endl;
206  m_combo->AddEntry(m_process.value().c_str(), cnt);
207  id = cnt;
208  }
209 
210  m_combo->SortByName();
211  m_combo->Select(id, false);
212  }
213 }
FWStringParameter m_process
std::vector< std::string > * m_processList
void FWTriggerTableView::saveImageTo ( const std::string &  iName) const
virtual

Implements FWViewBase.

Definition at line 262 of file FWTriggerTableView.cc.

References EnergyCorrector::c, FWTriggerTableViewTableManager::cellRenderer(), gather_cfg::cout, FWTextTableCellRenderer::data(), data, cmsPerfStripChart::format, m_columns, m_tableManager, FWTriggerTableViewTableManager::numberOfColumns(), FWTriggerTableViewTableManager::numberOfRows(), alignCSCRings::r, confdb::splitter(), AlCaHLTBitMon_QueryRunRegistry::string, and fftjetcommon_cfi::title.

263 {
264  TString format;
265  TString data;
266  FWTextTableCellRenderer* textRenderer;
267 
268  // calculate widths
269  std::vector<size_t> widths(m_tableManager->numberOfColumns());
270 
271  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
272  widths[c] = m_columns[c].title.size();
273 
274  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
275  {
276  for (int r = 0; r < m_tableManager->numberOfRows(); r++ )
277  {
278  textRenderer = (FWTextTableCellRenderer*) m_tableManager->cellRenderer(r, c); // setup cell renderer
279  size_t ss = textRenderer->data().size();
280  if (widths[c] < ss) widths[c] = ss;
281  }
282  }
283 
284  int rlen = 0;
285  for (size_t c = 0; c < (size_t)m_tableManager->numberOfColumns(); ++c )
286  rlen += widths[c];
287  rlen += (m_tableManager->numberOfColumns() -1 )*3 ;
288  rlen++;
289 
290 
291  printf("\n");
292  int lastCol = m_tableManager->numberOfColumns() -1;
293 
294  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
295  {
296  format.Form("%%%ds", (int)widths[c]);
297  data.Form(format,m_columns[c].title.c_str());
298  if (c == lastCol)
299  printf("%s", data.Data());
300  else
301  printf("%s | ", data.Data());
302  }
303  printf("\n");
304 
305  std::string splitter(rlen, '-');
306  std::cout << splitter << std::endl;
307 
308  for (int r = 0; r < m_tableManager->numberOfRows(); r++ )
309  {
310  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
311  {
312  format.Form("%%%ds", (int)widths[c]);
313  textRenderer = (FWTextTableCellRenderer*) m_tableManager->cellRenderer(r, c); // setup cell renderer
314  data.Form(format, textRenderer->data().c_str());
315  if (c == lastCol)
316  printf("%s", data.Data());
317  else
318  printf("%s | ", data.Data());
319  }
320  printf("\n");
321  }
322 }
def splitter(iterator, n)
Definition: confdb.py:11
std::vector< Column > m_columns
virtual int numberOfColumns() const
Number of columns in the table.
format
Some error handling for the usage.
const std::string & data()
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const
virtual int numberOfRows() const
Number of rows in the table.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
FWTriggerTableViewTableManager * m_tableManager
void FWTriggerTableView::setBackgroundColor ( Color_t  iColor)

Definition at line 91 of file FWTriggerTableView.cc.

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

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

92 {
93  m_backgroundColor = iColor;
94  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor));
95  m_tableWidget->SetLineSeparatorColor( gVirtualX->GetPixel(iColor == kWhite ? kBlack : kWhite));
96 }
void SetBackgroundColor(Pixel_t)
void SetLineSeparatorColor(Pixel_t)
FWTableWidget * m_tableWidget
void FWTriggerTableView::setFrom ( const FWConfiguration iFrom)
virtual

Reimplemented from FWConfigurableParameterizable.

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

149 {
150  const FWConfiguration *main = &iFrom;
151 
152  // unnecessary nesting for old version
153  if (version() < 2)
154  {
155  if (typeId() == FWViewType::kTableHLT)
156  main = iFrom.valueForKey( "HLTTriggerTableView" );
157  else
158  main = iFrom.valueForKey( "L1TriggerTableView" );
159  }
160 
161  const FWConfiguration *sortColumn = main->valueForKey( kSortColumn );
162  const FWConfiguration *descendingSort = main->valueForKey( kDescendingSort );
163  if( sortColumn != 0 && descendingSort != 0 )
164  {
165  unsigned int sort = sortColumn->version();
166  bool descending = descendingSort->version();
167  if( sort < (( unsigned int ) m_tableManager->numberOfColumns()))
168  m_tableWidget->sort( sort, descending );
169  }
170 
171  if ( typeId() == FWViewType::kTableHLT )
172  {
173  const FWConfiguration* vp = iFrom.valueForKey("Process" );
174  if ( vp && (vp->value() != m_process.value()))
175  m_process.setFrom(iFrom);
176  }
177 
178  {
179  const FWConfiguration* vp = iFrom.valueForKey("Filter" );
180  if (vp && (vp->value() != m_regex.value()))
181  m_regex.setFrom(iFrom);
182  }
183 }
FWStringParameter m_regex
unsigned int version() const
virtual int numberOfColumns() const
Number of columns in the table.
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
virtual void setFrom(const FWConfiguration &iFrom)
FWTriggerTableViewTableManager * m_tableManager
const FWConfiguration * valueForKey(const std::string &iKey) const
FWViewType::EType typeId() const
Definition: FWViewBase.h:43
void FWTriggerTableView::setProcessList ( std::vector< std::string > *  x)
inline

Definition at line 66 of file FWTriggerTableView.h.

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

Friends And Related Function Documentation

friend class FWTriggerTableViewTableManager
friend

Definition at line 40 of file FWTriggerTableView.h.

Member Data Documentation

Color_t FWTriggerTableView::m_backgroundColor
private

Definition at line 95 of file FWTriggerTableView.h.

Referenced by setBackgroundColor().

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

Definition at line 86 of file FWTriggerTableView.h.

Referenced by populateController(), and resetCombo().

TEveWindowFrame* FWTriggerTableView::m_eveWindow
private

Definition at line 89 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 97 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 90 of file FWTriggerTableView.h.

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