CMS 3D CMS Logo

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends

FWTriggerTableView Class Reference

#include <FWTriggerTableView.h>

Inheritance diagram for FWTriggerTableView:
FWViewBase FWConfigurableParameterizable FWParameterizable FWConfigurable FWHLTTriggerTableView FWL1TriggerTableView

List of all members.

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< Columnm_columns
FWStringParameter m_process
FWStringParameter m_regex
FWTriggerTableViewTableManagerm_tableManager

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

Detailed Description

Definition at line 39 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(), 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]

Member Function Documentation

void FWTriggerTableView::addTo ( FWConfiguration iTo) const [virtual]
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  )
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)
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.


Friends And Related Function Documentation

friend class FWTriggerTableViewTableManager [friend]

Definition at line 41 of file FWTriggerTableView.h.


Member Data Documentation

Definition at line 96 of file FWTriggerTableView.h.

Referenced by backgroundColor(), and setBackgroundColor().

std::vector<Column> FWTriggerTableView::m_columns [protected]
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().

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

Definition at line 98 of file FWTriggerTableView.h.

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

TGCompositeFrame* FWTriggerTableView::m_vert [private]

Definition at line 91 of file FWTriggerTableView.h.

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