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

◆ PackedTriggerPrescales() [1/2]

pat::PackedTriggerPrescales::PackedTriggerPrescales ( )
inline

Definition at line 12 of file PackedTriggerPrescales.h.

12 : triggerNames_(nullptr) {}

◆ PackedTriggerPrescales() [2/2]

pat::PackedTriggerPrescales::PackedTriggerPrescales ( const edm::Handle< edm::TriggerResults > &  handle)

Definition at line 5 of file PackedTriggerPrescales.cc.

7  prescaleValues_.resize(handle->size(), 0);
8 }

References patZpeak::handle, and prescaleValues_.

◆ ~PackedTriggerPrescales()

pat::PackedTriggerPrescales::~PackedTriggerPrescales ( )
inline

Definition at line 14 of file PackedTriggerPrescales.h.

14 {}

Member Function Documentation

◆ addPrescaledTrigger()

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

Definition at line 36 of file PackedTriggerPrescales.cc.

36  {
37  if (unsigned(index) >= triggerResults().size())
38  throw cms::Exception("InvalidReference", "Index out of bounds");
40 }

References Exception, findQualityFiles::size, and triggerResults.

◆ getPrescaleForIndex()

int pat::PackedTriggerPrescales::getPrescaleForIndex ( int  index) const

Definition at line 10 of file PackedTriggerPrescales.cc.

10  {
11  if (unsigned(index) >= triggerResults().size())
12  throw cms::Exception("InvalidReference", "Index out of bounds");
13  return prescaleValues_[index];
14 }

References Exception, findQualityFiles::size, and triggerResults.

◆ getPrescaleForName()

int pat::PackedTriggerPrescales::getPrescaleForName ( const std::string &  name,
bool  prefixOnly = false 
) const

Definition at line 16 of file PackedTriggerPrescales.cc.

16  {
17  if (triggerNames_ == nullptr)
18  throw cms::Exception("LogicError", "getPrescaleForName called without having called setTriggerNames first");
19  if (prefixOnly) {
20  const std::vector<std::string> &names = triggerNames_->triggerNames();
21  size_t siz = name.length() - 1;
22  while (siz > 0 && (name[siz] == '*' || name[siz] == '\0'))
23  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 }

References Exception, mps_fire::i, dqmiodumpmetadata::n, Skims_PA_cff::name, and names.

◆ setTriggerNames()

void pat::PackedTriggerPrescales::setTriggerNames ( const edm::TriggerNames names)
inline

Definition at line 26 of file PackedTriggerPrescales.h.

26 { triggerNames_ = &names; }

References names, and triggerNames_.

◆ triggerResults()

const edm::TriggerResults& pat::PackedTriggerPrescales::triggerResults ( ) const
inline

Definition at line 22 of file PackedTriggerPrescales.h.

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

References triggerResults_.

Member Data Documentation

◆ prescaleValues_

std::vector<int> pat::PackedTriggerPrescales::prescaleValues_
protected

Definition at line 32 of file PackedTriggerPrescales.h.

Referenced by PackedTriggerPrescales().

◆ triggerNames_

const edm::TriggerNames* pat::PackedTriggerPrescales::triggerNames_
protected

Definition at line 34 of file PackedTriggerPrescales.h.

Referenced by setTriggerNames().

◆ triggerResults_

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

Definition at line 33 of file PackedTriggerPrescales.h.

Referenced by triggerResults().

edm::RefProd
Definition: EDProductfwd.h:25
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
patZpeak.handle
handle
Definition: patZpeak.py:23
pat::PackedTriggerPrescales::getPrescaleForIndex
int getPrescaleForIndex(int index) const
Definition: PackedTriggerPrescales.cc:10
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
pat::PackedTriggerPrescales::prescaleValues_
std::vector< int > prescaleValues_
Definition: PackedTriggerPrescales.h:32
edm::TriggerNames::triggerNames
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
pat::PackedTriggerPrescales::triggerResults
const edm::TriggerResults & triggerResults() const
Definition: PackedTriggerPrescales.h:22
pat::PackedTriggerPrescales::triggerResults_
edm::RefCore triggerResults_
Definition: PackedTriggerPrescales.h:33
pat::PackedTriggerPrescales::triggerNames_
const edm::TriggerNames * triggerNames_
Definition: PackedTriggerPrescales.h:34
prescale
Definition: PrescaleEventFilter.cc:32
edm::TriggerNames::triggerIndex
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443