CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::TriggerResultsByName Class Reference

#include <TriggerResultsByName.h>

Public Member Functions

bool accept () const
 
bool accept (std::string const &pathName) const
 
bool accept (unsigned i) const
 
HLTPathStatus const & at (std::string const &pathName) const
 
HLTPathStatus const & at (unsigned i) const
 
bool error () const
 
bool error (std::string const &pathName) const
 
bool error (unsigned i) const
 
unsigned index (std::string const &pathName) const
 
unsigned index (unsigned i) const
 
bool isValid () const
 
HLTPathStatus const & operator[] (std::string const &pathName) const
 
HLTPathStatus const & operator[] (unsigned i) const
 
ParameterSetID const & parameterSetID () const
 
std::vector< std::string >::size_type size () const
 
hlt::HLTState state (std::string const &pathName) const
 
hlt::HLTState state (unsigned i) const
 
unsigned triggerIndex (std::string const &pathName) const
 
std::string const & triggerName (unsigned i) const
 
std::vector< std::string > const & triggerNames () const
 
 TriggerResultsByName (TriggerResults const *triggerResults, TriggerNames const *triggerNames)
 
bool wasrun () const
 
bool wasrun (std::string const &pathName) const
 
bool wasrun (unsigned i) const
 

Private Member Functions

unsigned getAndCheckIndex (std::string const &pathName) const
 
void throwTriggerNamesMissing () const
 
void throwTriggerResultsMissing () const
 

Private Attributes

TriggerNames const * triggerNames_
 
TriggerResults const * triggerResults_
 

Detailed Description

Definition at line 48 of file TriggerResultsByName.h.

Constructor & Destructor Documentation

◆ TriggerResultsByName()

TriggerResultsByName::TriggerResultsByName ( TriggerResults const *  triggerResults,
TriggerNames const *  triggerNames 
)

Definition at line 9 of file TriggerResultsByName.cc.

11  // If either of these is true the object is in an invalid state
12  if (triggerResults_ == nullptr || triggerNames_ == nullptr) {
13  return;
14  }
15 
18  << "TriggerResultsByName::TriggerResultsByName, Trigger names vector and TriggerResults\n"
19  "have different ParameterSetID's. This should be impossible when the object is obtained\n"
20  "from the function named triggerResultsByName in the Event class, which is the way\n"
21  "TriggerResultsByName should always be created. If this is the case, please send\n"
22  "information to reproduce this problem to the edm developers. Otherwise, you are\n"
23  "using this class incorrectly and in a way that is not supported.\n";
24  }
25 
26  if (triggerResults_->size() != triggerNames_->size()) {
28  << "TriggerResultsByName::TriggerResultsByName, Trigger names vector\n"
29  "and TriggerResults have different sizes. This should be impossible,\n"
30  "please send information to reproduce this problem to the edm developers.\n";
31  }
32  }

References Exception, edm::TriggerResults::parameterSetID(), edm::TriggerNames::parameterSetID(), edm::HLTGlobalStatus::size(), edm::TriggerNames::size(), triggerNames_, triggerResults_, and edm::errors::Unknown.

Member Function Documentation

◆ accept() [1/3]

bool TriggerResultsByName::accept ( ) const

◆ accept() [2/3]

bool TriggerResultsByName::accept ( std::string const &  pathName) const

◆ accept() [3/3]

bool TriggerResultsByName::accept ( unsigned  i) const

◆ at() [1/2]

HLTPathStatus const & TriggerResultsByName::at ( std::string const &  pathName) const

◆ at() [2/2]

HLTPathStatus const & TriggerResultsByName::at ( unsigned  i) const

Definition at line 71 of file TriggerResultsByName.cc.

71  {
72  if (triggerResults_ == nullptr)
74  return triggerResults_->at(i);
75  }

References edm::HLTGlobalStatus::at(), mps_fire::i, throwTriggerResultsMissing(), and triggerResults_.

◆ error() [1/3]

bool TriggerResultsByName::error ( ) const

◆ error() [2/3]

bool TriggerResultsByName::error ( std::string const &  pathName) const

◆ error() [3/3]

bool TriggerResultsByName::error ( unsigned  i) const

◆ getAndCheckIndex()

unsigned TriggerResultsByName::getAndCheckIndex ( std::string const &  pathName) const
private

Definition at line 185 of file TriggerResultsByName.cc.

185  {
186  if (triggerNames_ == nullptr)
188  unsigned i = triggerNames_->triggerIndex(pathName);
189  if (i == triggerNames_->size()) {
191  << "TriggerResultsByName::getAndCheckIndex\n"
192  << "Requested trigger name \"" << pathName << "\" does not match any known trigger.\n";
193  }
194  return i;
195  }

References Exception, mps_fire::i, edm::errors::LogicError, hltMonBTagIPClient_cfi::pathName, edm::TriggerNames::size(), throwTriggerNamesMissing(), edm::TriggerNames::triggerIndex(), and triggerNames_.

Referenced by accept(), at(), error(), index(), operator[](), state(), and wasrun().

◆ index() [1/2]

unsigned TriggerResultsByName::index ( std::string const &  pathName) const

◆ index() [2/2]

unsigned TriggerResultsByName::index ( unsigned  i) const

Definition at line 149 of file TriggerResultsByName.cc.

149  {
150  if (triggerResults_ == nullptr)
152  return triggerResults_->index(i);
153  }

References mps_fire::i, edm::HLTGlobalStatus::index(), throwTriggerResultsMissing(), and triggerResults_.

Referenced by BeautifulSoup.PageElement::insert().

◆ isValid()

bool TriggerResultsByName::isValid ( void  ) const

Definition at line 34 of file TriggerResultsByName.cc.

34  {
35  if (triggerResults_ == nullptr || triggerNames_ == nullptr)
36  return false;
37  return true;
38  }

References triggerNames_, and triggerResults_.

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

◆ operator[]() [1/2]

HLTPathStatus const & TriggerResultsByName::operator[] ( std::string const &  pathName) const

◆ operator[]() [2/2]

HLTPathStatus const & TriggerResultsByName::operator[] ( unsigned  i) const

Definition at line 84 of file TriggerResultsByName.cc.

84  {
85  if (triggerResults_ == nullptr)
87  return triggerResults_->at(i);
88  }

References edm::HLTGlobalStatus::at(), mps_fire::i, throwTriggerResultsMissing(), and triggerResults_.

◆ parameterSetID()

ParameterSetID const & TriggerResultsByName::parameterSetID ( ) const

◆ size()

std::vector< std::string >::size_type TriggerResultsByName::size ( void  ) const

◆ state() [1/2]

hlt::HLTState TriggerResultsByName::state ( std::string const &  pathName) const

◆ state() [2/2]

hlt::HLTState TriggerResultsByName::state ( unsigned  i) const

Definition at line 136 of file TriggerResultsByName.cc.

136  {
137  if (triggerResults_ == nullptr)
139  return triggerResults_->state(i);
140  }

References mps_fire::i, edm::HLTGlobalStatus::state(), throwTriggerResultsMissing(), and triggerResults_.

◆ throwTriggerNamesMissing()

void TriggerResultsByName::throwTriggerNamesMissing ( ) const
private

Definition at line 206 of file TriggerResultsByName.cc.

206  {
208  << "TriggerResultsByName has a null pointer to TriggerNames.\n"
209  << "This should never happen. It could indicate the ParameterSet\n"
210  << "containing the names is missing from the ParameterSet registry.\n"
211  << "Please report this to the edm developers along with instructions\n"
212  << "to reproduce the problem\n";
213  }

References Exception, and edm::errors::LogicError.

Referenced by getAndCheckIndex(), triggerIndex(), triggerName(), and triggerNames().

◆ throwTriggerResultsMissing()

void TriggerResultsByName::throwTriggerResultsMissing ( ) const
private

Definition at line 197 of file TriggerResultsByName.cc.

197  {
199  << "TriggerResultsByName has a null pointer to TriggerResults.\n"
200  << "This probably means TriggerResults was not found in the Event\n"
201  << "because the product was dropped or never created. It could also\n"
202  << "mean it was requested for a process that does not exist or was\n"
203  << "misspelled\n";
204  }

References Exception, and edm::errors::ProductNotFound.

Referenced by accept(), at(), error(), index(), operator[](), parameterSetID(), size(), state(), triggerIndex(), triggerName(), triggerNames(), and wasrun().

◆ triggerIndex()

unsigned TriggerResultsByName::triggerIndex ( std::string const &  pathName) const

◆ triggerName()

std::string const & TriggerResultsByName::triggerName ( unsigned  i) const

◆ triggerNames()

std::vector< std::string > const & TriggerResultsByName::triggerNames ( ) const

◆ wasrun() [1/3]

bool TriggerResultsByName::wasrun ( ) const

Definition at line 46 of file TriggerResultsByName.cc.

46  {
47  if (triggerResults_ == nullptr)
49  return triggerResults_->wasrun();
50  }

References throwTriggerResultsMissing(), triggerResults_, and edm::HLTGlobalStatus::wasrun().

◆ wasrun() [2/3]

bool TriggerResultsByName::wasrun ( std::string const &  pathName) const

◆ wasrun() [3/3]

bool TriggerResultsByName::wasrun ( unsigned  i) const

Definition at line 97 of file TriggerResultsByName.cc.

97  {
98  if (triggerResults_ == nullptr)
100  return triggerResults_->wasrun(i);
101  }

References mps_fire::i, throwTriggerResultsMissing(), triggerResults_, and edm::HLTGlobalStatus::wasrun().

Member Data Documentation

◆ triggerNames_

TriggerNames const* edm::TriggerResultsByName::triggerNames_
private

◆ triggerResults_

TriggerResults const* edm::TriggerResultsByName::triggerResults_
private
mps_fire.i
i
Definition: mps_fire.py:428
edm::TriggerNames::parameterSetID
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:61
edm::errors::LogicError
Definition: EDMException.h:37
edm::TriggerResultsByName::throwTriggerResultsMissing
void throwTriggerResultsMissing() const
Definition: TriggerResultsByName.cc:197
edm::TriggerResultsByName::throwTriggerNamesMissing
void throwTriggerNamesMissing() const
Definition: TriggerResultsByName.cc:206
edm::HLTGlobalStatus::wasrun
bool wasrun() const
Was at least one path run?
Definition: HLTGlobalStatus.h:47
edm::TriggerResults::parameterSetID
const ParameterSetID & parameterSetID() const
Get stored parameter set id.
Definition: TriggerResults.h:57
edm::errors::Unknown
Definition: EDMException.h:29
edm::HLTGlobalStatus::error
bool error() const
Has any path encountered an error (exception)
Definition: HLTGlobalStatus.h:51
edm::HLTGlobalStatus::state
hlt::HLTState state(const unsigned int i) const
Get status of ith path.
Definition: HLTGlobalStatus.h:68
edm::HLTGlobalStatus::index
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
Definition: HLTGlobalStatus.h:70
edm::TriggerResultsByName::triggerResults_
TriggerResults const * triggerResults_
Definition: TriggerResultsByName.h:109
edm::errors::ProductNotFound
Definition: EDMException.h:33
hltMonBTagIPClient_cfi.pathName
pathName
Definition: hltMonBTagIPClient_cfi.py:5
edm::HLTGlobalStatus::size
unsigned int size() const
Get number of paths stored.
Definition: HLTGlobalStatus.h:35
edm::TriggerNames::triggerNames
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
edm::TriggerResultsByName::triggerNames_
TriggerNames const * triggerNames_
Definition: TriggerResultsByName.h:110
edm::HLTGlobalStatus::at
const HLTPathStatus & at(const unsigned int i) const
Definition: HLTGlobalStatus.h:55
edm::TriggerNames::triggerIndex
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
edm::TriggerNames::triggerName
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:50
edm::TriggerNames::size
std::size_t size() const
Definition: TriggerNames.cc:59
edm::TriggerResultsByName::getAndCheckIndex
unsigned getAndCheckIndex(std::string const &pathName) const
Definition: TriggerResultsByName.cc:185
Exception
Definition: hltDiff.cc:245
edm::triggerResults
static const std::string triggerResults("TriggerResults")
edm::HLTGlobalStatus::accept
bool accept() const
Has at least one path accepted the event?
Definition: HLTGlobalStatus.h:49
edm::TriggerResultsByName::triggerNames
std::vector< std::string > const & triggerNames() const
Definition: TriggerResultsByName.cc:155