CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWHLTTriggerTableView.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWHLTTriggerTableView
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author:
10 // Created: Tue Jan 25 16:02:03 CET 2011
11 // $Id: FWHLTTriggerTableView.cc,v 1.3 2011/02/16 18:38:36 amraktad Exp $
12 //
13 #include <boost/regex.hpp>
14 
17 
25 
26 
28  : FWTriggerTableView(iParent, FWViewType::kTableHLT),
29  m_event(0)
30 {
31 
32  m_columns[0].title = "Filter Name";
33  m_columns.push_back(Column("Accept"));
34  m_columns.push_back(Column("Average Accept"));
35  dataChanged();
36 }
37 
38 
40 {
41  if ( event != m_event ) {
42  m_event = event;
44  }
46  edm::TriggerNames const* triggerNames(0);
47  try{
48  hTriggerResults.getByLabel(*event,"TriggerResults","",m_process.value().c_str());
49  triggerNames = &event->triggerNames(*hTriggerResults);
50  } catch (cms::Exception&) {
51  fwLog(fwlog::kWarning) << " no trigger results with process name HLT is available" << std::endl;
53  return;
54  }
55  boost::regex filter(m_regex.value());
56  for(unsigned int i=0; i<triggerNames->size(); ++i) {
57  if ( !boost::regex_search(triggerNames->triggerName(i),filter) ) continue;
58  m_columns.at(0).values.push_back(triggerNames->triggerName(i));
59  m_columns.at(1).values.push_back(Form("%d",hTriggerResults->accept(i)));
60  m_columns.at(2).values.push_back(Form("%6.1f%%",m_averageAccept[triggerNames->triggerName(i)]*100));
61  }
62 }
63 
64 void
66 {
67  edm::EventID currentEvent = m_event->id();
68  // better to keep the keys and just set to zero the values
69  for (acceptmap_t::iterator it = m_averageAccept.begin(), ed = m_averageAccept.end(); it != ed; ++it) {
70  it->second = 0;
71  }
72 
73  // loop over events
75  for (m_event->toBegin(); !m_event->atEnd(); ++(*m_event)) {
76  hTriggerResults.getByLabel(*m_event,"TriggerResults","","HLT");
77  edm::TriggerNames const* triggerNames(0);
78  try{
79  triggerNames = &m_event->triggerNames(*hTriggerResults);
80  } catch (cms::Exception&) {
81  fwLog(fwlog::kError) <<" exception caught while trying to get trigger info"<<std::endl;
82  break;
83  }
84 
85  for(unsigned int i=0; i<triggerNames->size(); ++i) {
86  if ( hTriggerResults->accept(i) ) {
87  m_averageAccept[triggerNames->triggerName(i)]++;
88  }
89  }
90  }
91  m_event->to(currentEvent);
92 
93  double denominator = 1.0/m_event->size();
94  for (acceptmap_t::iterator it = m_averageAccept.begin(), ed = m_averageAccept.end(); it != ed; ++it) {
95  it->second *= denominator;
96  }
97 }
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:393
std::vector< Column > m_columns
FWStringParameter m_regex
bool accept() const
Has at least one path accepted the event?
FWHLTTriggerTableView(TEveWindowSlot *)
Strings::size_type size() const
Definition: TriggerNames.cc:39
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:232
virtual void fillTable(fwlite::Event *event)
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:94
Event const & toBegin()
Go to the very first Event.
Definition: Event.cc:205
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: Event.cc:175
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual bool atEnd() const
Definition: Event.cc:248
#define fwLog(_level_)
Definition: fwLog.h:51
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
FWStringParameter m_process
edm::EventID id() const
Definition: EventBase.h:56
FWTriggerTableViewTableManager * m_tableManager