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 42 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 77 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 127 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 220 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 231 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 185 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 101 of file FWTriggerTableView.cc.

References convertXMLtoSQLite_cfg::fileName, i, m_columns, triggers, makeHLTPrescaleTable::values, and vend.

{
   std::string fileName = iName + ".txt";
   std::ofstream triggers( fileName.c_str() );

   triggers << m_columns[2].title << " " << m_columns[0].title << "\n";
   for( unsigned int i = 0, vend = m_columns[0].values.size(); i != vend; ++i )
      if( m_columns[1].values[i] == "1" )
         triggers << m_columns[2].values[i] << "\t" << m_columns[0].values[i] << "\n";
   triggers.close();
}
void FWTriggerTableView::setBackgroundColor ( Color_t  iColor)

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