CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
pat::PackedTriggerPrescales Class Reference

#include <PackedTriggerPrescales.h>

Public Member Functions

void addPrescaledTrigger (int index, int prescale)
 
int getPrescaleForIndex (int index) const
 
int getPrescaleForName (const std::string &name, bool prefixOnly=false) const
 
 PackedTriggerPrescales ()
 
 PackedTriggerPrescales (const edm::Handle< edm::TriggerResults > &handle)
 
void setTriggerNames (const edm::TriggerNames &names)
 
const edm::TriggerResultstriggerResults () const
 
 ~PackedTriggerPrescales ()
 

Protected Attributes

std::vector< int > prescaleValues_
 
const edm::TriggerNamestriggerNames_
 
edm::RefCore triggerResults_
 

Detailed Description

Definition at line 10 of file PackedTriggerPrescales.h.

Constructor & Destructor Documentation

pat::PackedTriggerPrescales::PackedTriggerPrescales ( )
inline

Definition at line 12 of file PackedTriggerPrescales.h.

References cmsBatch::handle.

12 : triggerNames_(nullptr) {}
const edm::TriggerNames * triggerNames_
pat::PackedTriggerPrescales::PackedTriggerPrescales ( const edm::Handle< edm::TriggerResults > &  handle)

Definition at line 5 of file PackedTriggerPrescales.cc.

References prescaleValues_, and edm::HLTGlobalStatus::size().

5  :
8  triggerNames_(nullptr)
9 {
10  prescaleValues_.resize(handle->size(),0);
11 }
unsigned int size() const
Get number of paths stored.
const edm::TriggerNames * triggerNames_
pat::PackedTriggerPrescales::~PackedTriggerPrescales ( )
inline

Member Function Documentation

void pat::PackedTriggerPrescales::addPrescaledTrigger ( int  index,
int  prescale 
)

Definition at line 36 of file PackedTriggerPrescales.cc.

References Exception, prescaleValues_, findQualityFiles::size, and triggerResults().

Referenced by setTriggerNames().

36  {
37  if (unsigned(index) >= triggerResults().size()) throw cms::Exception("InvalidReference", "Index out of bounds");
38  prescaleValues_[index] = prescale;
39 }
size
Write out results.
const edm::TriggerResults & triggerResults() const
int pat::PackedTriggerPrescales::getPrescaleForIndex ( int  index) const

Definition at line 13 of file PackedTriggerPrescales.cc.

References Exception, prescaleValues_, findQualityFiles::size, and triggerResults().

Referenced by heppy::TriggerBitChecker::check_unprescaled(), heppy::TriggerBitChecker::getprescale(), getPrescaleForName(), and ~PackedTriggerPrescales().

13  {
14  if (unsigned(index) >= triggerResults().size()) throw cms::Exception("InvalidReference", "Index out of bounds");
15  return prescaleValues_[index];
16 }
size
Write out results.
const edm::TriggerResults & triggerResults() const
int pat::PackedTriggerPrescales::getPrescaleForName ( const std::string &  name,
bool  prefixOnly = false 
) const

Definition at line 18 of file PackedTriggerPrescales.cc.

References Exception, getPrescaleForIndex(), mps_fire::i, gen::n, cscdqm::h::names, edm::TriggerNames::triggerIndex(), edm::TriggerNames::triggerNames(), and triggerNames_.

Referenced by ~PackedTriggerPrescales().

18  {
19  if (triggerNames_ == nullptr) throw cms::Exception("LogicError", "getPrescaleForName called without having called setTriggerNames first");
20  if (prefixOnly) {
21  const std::vector<std::string> &names = triggerNames_->triggerNames();
22  size_t siz = name.length()-1;
23  while (siz > 0 && (name[siz] == '*' || name[siz] == '\0')) siz--;
24  for (unsigned int i = 0, n = names.size(); i < n; ++i) {
25  if (strncmp(name.c_str(), names[i].c_str(), siz) == 0) {
26  return getPrescaleForIndex(i);
27  }
28  }
29  throw cms::Exception("InvalidReference", "Index out of bounds");
30  } else {
32  return getPrescaleForIndex(index);
33  }
34 }
static const HistoName names[]
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
const edm::TriggerNames * triggerNames_
int getPrescaleForIndex(int index) const
void pat::PackedTriggerPrescales::setTriggerNames ( const edm::TriggerNames names)
inline

Definition at line 28 of file PackedTriggerPrescales.h.

References addPrescaledTrigger(), cscdqm::h::names, and triggerNames_.

28 { triggerNames_ = &names; }
static const HistoName names[]
const edm::TriggerNames * triggerNames_
const edm::TriggerResults& pat::PackedTriggerPrescales::triggerResults ( ) const
inline

Definition at line 22 of file PackedTriggerPrescales.h.

References triggerResults_.

Referenced by addPrescaledTrigger(), and getPrescaleForIndex().

22  {
23  return *edm::getProduct<edm::TriggerResults>(triggerResults_);
24  }

Member Data Documentation

std::vector<int> pat::PackedTriggerPrescales::prescaleValues_
protected
const edm::TriggerNames* pat::PackedTriggerPrescales::triggerNames_
protected

Definition at line 36 of file PackedTriggerPrescales.h.

Referenced by getPrescaleForName(), and setTriggerNames().

edm::RefCore pat::PackedTriggerPrescales::triggerResults_
protected

Definition at line 35 of file PackedTriggerPrescales.h.

Referenced by triggerResults().