CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

FWHLTTriggerTableView Class Reference

#include <Fireworks/Core/interface/FWHLTTriggerTableView.h>

Inheritance diagram for FWHLTTriggerTableView:
FWTriggerTableView FWViewBase FWConfigurableParameterizable FWParameterizable FWConfigurable

List of all members.

Public Member Functions

 FWHLTTriggerTableView (TEveWindowSlot *)
virtual ~FWHLTTriggerTableView ()

Protected Member Functions

virtual void fillTable (fwlite::Event *event)

Private Types

typedef boost::unordered_map
< std::string, double > 
acceptmap_t

Private Member Functions

void fillAverageAcceptFractions ()

Private Attributes

acceptmap_t m_averageAccept
fwlite::Eventm_event

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 29 of file FWHLTTriggerTableView.h.


Member Typedef Documentation

typedef boost::unordered_map<std::string,double> FWHLTTriggerTableView::acceptmap_t [private]

Definition at line 39 of file FWHLTTriggerTableView.h.


Constructor & Destructor Documentation

FWHLTTriggerTableView::FWHLTTriggerTableView ( TEveWindowSlot *  iParent)

Definition at line 27 of file FWHLTTriggerTableView.cc.

References FWTriggerTableView::dataChanged(), and FWTriggerTableView::m_columns.

   : FWTriggerTableView(iParent, FWViewType::kTableHLT),
     m_event(0)
{  

   m_columns[0].title = "Filter Name";
   m_columns.push_back(Column("Accept"));
   m_columns.push_back(Column("Average Accept"));
   dataChanged();
}
virtual FWHLTTriggerTableView::~FWHLTTriggerTableView ( ) [inline, virtual]

Definition at line 33 of file FWHLTTriggerTableView.h.

{}

Member Function Documentation

void FWHLTTriggerTableView::fillAverageAcceptFractions ( ) [private]

Definition at line 65 of file FWHLTTriggerTableView.cc.

References fwlite::Event::atEnd(), ExpressReco_HICollisions_FallBack::denominator, fwLog, fwlite::Handle< T >::getByLabel(), i, edm::EventBase::id(), fwlog::kError, m_averageAccept, m_event, fwlite::Event::size(), edm::TriggerNames::size(), fwlite::Event::to(), fwlite::Event::toBegin(), edm::TriggerNames::triggerName(), and fwlite::Event::triggerNames().

Referenced by fillTable().

{
   edm::EventID currentEvent = m_event->id();
   // better to keep the keys and just set to zero the values
   for (acceptmap_t::iterator it = m_averageAccept.begin(), ed = m_averageAccept.end(); it != ed; ++it) {
      it->second = 0;
   }

   // loop over events
   fwlite::Handle<edm::TriggerResults> hTriggerResults;
   for (m_event->toBegin(); !m_event->atEnd(); ++(*m_event)) {
      hTriggerResults.getByLabel(*m_event,"TriggerResults","","HLT");
      edm::TriggerNames const* triggerNames(0);
      try{
         triggerNames = &m_event->triggerNames(*hTriggerResults);
      } catch (cms::Exception&) {
         fwLog(fwlog::kError) <<" exception caught while trying to get trigger info"<<std::endl;
         break;
      }

      for(unsigned int i=0; i<triggerNames->size(); ++i) {
         if ( hTriggerResults->accept(i) ) { 
            m_averageAccept[triggerNames->triggerName(i)]++;
         }
      }
   }
   m_event->to(currentEvent);

   double denominator = 1.0/m_event->size();
   for (acceptmap_t::iterator it = m_averageAccept.begin(), ed = m_averageAccept.end(); it != ed; ++it) {
      it->second *= denominator;
   }
}
void FWHLTTriggerTableView::fillTable ( fwlite::Event event) [protected, virtual]

Implements FWTriggerTableView.

Definition at line 39 of file FWHLTTriggerTableView.cc.

References FWTriggerTableViewTableManager::dataChanged(), event(), fillAverageAcceptFractions(), align_tpl::filter, fwLog, fwlite::Handle< T >::getByLabel(), i, fwlog::kWarning, m_averageAccept, FWTriggerTableView::m_columns, m_event, FWTriggerTableView::m_process, FWTriggerTableView::m_regex, FWTriggerTableView::m_tableManager, edm::TriggerNames::size(), edm::TriggerNames::triggerName(), edm::TriggerNames::triggerNames(), and FWGenericParameter< T >::value().

{
   if ( event != m_event ) {
      m_event = event;
      fillAverageAcceptFractions();
   }
   fwlite::Handle<edm::TriggerResults> hTriggerResults;
   edm::TriggerNames const* triggerNames(0);
   try{
      hTriggerResults.getByLabel(*event,"TriggerResults","",m_process.value().c_str());
      triggerNames = &event->triggerNames(*hTriggerResults);
   } catch (cms::Exception&) {
      fwLog(fwlog::kWarning) << " no trigger results with process name HLT is available" << std::endl;
      m_tableManager->dataChanged();
      return;
   }
   boost::regex filter(m_regex.value());
   for(unsigned int i=0; i<triggerNames->size(); ++i) {
      if ( !boost::regex_search(triggerNames->triggerName(i),filter) ) continue;
      m_columns.at(0).values.push_back(triggerNames->triggerName(i));
      m_columns.at(1).values.push_back(Form("%d",hTriggerResults->accept(i)));
      m_columns.at(2).values.push_back(Form("%6.1f%%",m_averageAccept[triggerNames->triggerName(i)]*100));
   }
}

Member Data Documentation

Definition at line 42 of file FWHLTTriggerTableView.h.

Referenced by fillAverageAcceptFractions(), and fillTable().

Definition at line 41 of file FWHLTTriggerTableView.h.

Referenced by fillAverageAcceptFractions(), and fillTable().