CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
L1GlobalTriggerObjectMaps Class Reference

#include <L1GlobalTriggerObjectMaps.h>

Classes

class  AlgorithmResult
 
class  CombinationsInCondition
 
class  ConditionResult
 
class  ConditionsInAlgorithm
 

Public Member Functions

bool algorithmExists (int algorithmBitNumber) const
 Returns true if there is an entry for this algorithm bit number. More...
 
bool algorithmResult (int algorithmBitNumber) const
 Returns whether an algorithm trigger passed or failed. More...
 
void consistencyCheck () const
 
void getAlgorithmBitNumbers (std::vector< int > &algorithmBitNumbers) const
 Fills the vector with all the algorithm bit numbers. More...
 
CombinationsInCondition getCombinationsInCondition (int algorithmBitNumber, unsigned conditionNumber) const
 
ConditionsInAlgorithm getConditionsInAlgorithm (int algorithmBitNumber) const
 
unsigned getNumberOfConditions (int algorithmBitNumber) const
 Number of conditions associated with an algorithm. More...
 
 L1GlobalTriggerObjectMaps ()
 
edm::ParameterSetID const & namesParameterSetID () const
 
void pushBackAlgorithm (unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult)
 
void pushBackCondition (unsigned startIndexOfCombinations, unsigned short nObjectsPerCombination, bool conditionResult)
 
void pushBackObjectIndex (unsigned char objectIndex)
 
void reserveForAlgorithms (unsigned n)
 
void reserveForConditions (unsigned n)
 
void reserveForObjectIndexes (unsigned n)
 
void setNamesParameterSetID (edm::ParameterSetID const &psetID)
 
void swap (L1GlobalTriggerObjectMaps &rh)
 
void updateOperandTokenVector (int algorithmBitNumber, std::vector< L1GtLogicParser::OperandToken > &operandTokenVector) const
 Update the condition result in the operandTokenVector. More...
 
 ~L1GlobalTriggerObjectMaps ()
 

Private Member Functions

void getStartEndIndex (int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const
 

Private Attributes

std::vector< AlgorithmResultm_algorithmResults
 
std::vector< unsigned char > m_combinations
 
std::vector< ConditionResultm_conditionResults
 
edm::ParameterSetID m_namesParameterSetID
 

Detailed Description

Description: map trigger objects to algorithms and conditions.
Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna
: W. David Dagenhart

Definition at line 24 of file L1GlobalTriggerObjectMaps.h.

Constructor & Destructor Documentation

◆ L1GlobalTriggerObjectMaps()

L1GlobalTriggerObjectMaps::L1GlobalTriggerObjectMaps ( )
inline

Definition at line 26 of file L1GlobalTriggerObjectMaps.h.

26 {}

◆ ~L1GlobalTriggerObjectMaps()

L1GlobalTriggerObjectMaps::~L1GlobalTriggerObjectMaps ( )
inline

Definition at line 28 of file L1GlobalTriggerObjectMaps.h.

28 {}

Member Function Documentation

◆ algorithmExists()

bool L1GlobalTriggerObjectMaps::algorithmExists ( int  algorithmBitNumber) const

Returns true if there is an entry for this algorithm bit number.

Definition at line 30 of file L1GlobalTriggerObjectMaps.cc.

References mps_fire::i, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and m_algorithmResults.

Referenced by pat::PATTriggerProducer::produce().

30  {
31  std::vector<AlgorithmResult>::const_iterator i = std::lower_bound(
32  m_algorithmResults.begin(), m_algorithmResults.end(), AlgorithmResult(0, algorithmBitNumber, false));
33  if (i == m_algorithmResults.end() || i->algorithmBitNumber() != algorithmBitNumber) {
34  return false;
35  }
36  return true;
37 }
std::vector< AlgorithmResult > m_algorithmResults

◆ algorithmResult()

bool L1GlobalTriggerObjectMaps::algorithmResult ( int  algorithmBitNumber) const

Returns whether an algorithm trigger passed or failed.

Definition at line 39 of file L1GlobalTriggerObjectMaps.cc.

References cms::Exception::addContext(), mps_fire::i, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and m_algorithmResults.

Referenced by CompareToObjectMapRecord::analyze(), pat::PATTriggerProducer::produce(), and pushBackAlgorithm().

39  {
40  std::vector<AlgorithmResult>::const_iterator i = std::lower_bound(
41  m_algorithmResults.begin(), m_algorithmResults.end(), AlgorithmResult(0, algorithmBitNumber, false));
42  if (i == m_algorithmResults.end() || i->algorithmBitNumber() != algorithmBitNumber) {
43  cms::Exception ex("L1GlobalTrigger");
44  ex << "algorithmBitNumber not found";
45  ex.addContext("Calling L1GlobalTriggerObjectMaps::algorithmResult");
46  throw ex;
47  }
48  return i->algorithmResult();
49 }
std::vector< AlgorithmResult > m_algorithmResults

◆ consistencyCheck()

void L1GlobalTriggerObjectMaps::consistencyCheck ( ) const

Definition at line 138 of file L1GlobalTriggerObjectMaps.cc.

References cms::Exception::addContext(), mps_fire::i, dqmiolumiharvest::j, m_algorithmResults, m_combinations, m_conditionResults, and mitigatedMETSequence_cff::U.

Referenced by pat::PATTriggerProducer::produce().

138  {
139  // None of these checks should ever fail unless there
140  // is a bug in the code filling this object
141  for (std::vector<AlgorithmResult>::const_iterator i = m_algorithmResults.begin(), iEnd = m_algorithmResults.end();
142  i != iEnd;
143  ++i) {
144  std::vector<AlgorithmResult>::const_iterator j = i;
145  ++j;
146  if (j != iEnd && !(*i < *j)) {
147  cms::Exception ex("L1GlobalTrigger");
148  ex << "AlgorithmResults should be sorted in increasing order of bit number with no duplicates. It is not.";
149  ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck");
150  throw ex;
151  }
152  unsigned endIndex = (j != iEnd) ? j->startIndexOfConditions() : m_conditionResults.size();
153 
154  if (endIndex < i->startIndexOfConditions()) {
155  cms::Exception ex("L1GlobalTrigger");
156  ex << "startIndexOfConditions decreases or exceeds the size of m_conditionResults";
157  ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck");
158  throw ex;
159  }
160  }
161  for (std::vector<ConditionResult>::const_iterator i = m_conditionResults.begin(), iEnd = m_conditionResults.end();
162  i != iEnd;
163  ++i) {
164  std::vector<ConditionResult>::const_iterator j = i;
165  ++j;
166  unsigned endIndex = (j != iEnd) ? j->startIndexOfCombinations() : m_combinations.size();
167 
168  if (endIndex < i->startIndexOfCombinations()) {
169  cms::Exception ex("L1GlobalTrigger");
170  ex << "startIndexOfCombinations decreases or exceeds the size of m_conditionResults";
171  ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck");
172  throw ex;
173  }
174  unsigned length = endIndex - i->startIndexOfCombinations();
175  if (length == 0U) {
176  if (i->nObjectsPerCombination() != 0U) {
177  cms::Exception ex("L1GlobalTrigger");
178  ex << "Length is zero and nObjectsInCombination is not zero";
179  ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck");
180  throw ex;
181  }
182  } else {
183  if (i->nObjectsPerCombination() == 0 || length % i->nObjectsPerCombination() != 0) {
184  cms::Exception ex("L1GlobalTrigger");
185  ex << "Size indicated by startIndexOfCombinations is not a multiple of nObjectsInCombination";
186  ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck");
187  throw ex;
188  }
189  }
190  }
191 }
std::vector< AlgorithmResult > m_algorithmResults
std::vector< unsigned char > m_combinations
std::vector< ConditionResult > m_conditionResults

◆ getAlgorithmBitNumbers()

void L1GlobalTriggerObjectMaps::getAlgorithmBitNumbers ( std::vector< int > &  algorithmBitNumbers) const

Fills the vector with all the algorithm bit numbers.

Definition at line 70 of file L1GlobalTriggerObjectMaps.cc.

References mps_fire::i, and m_algorithmResults.

Referenced by CompareToObjectMapRecord::analyze().

70  {
71  algorithmBitNumbers.clear();
72  for (std::vector<AlgorithmResult>::const_iterator i = m_algorithmResults.begin(), iEnd = m_algorithmResults.end();
73  i != iEnd;
74  ++i) {
75  algorithmBitNumbers.push_back(i->algorithmBitNumber());
76  }
77 }
std::vector< AlgorithmResult > m_algorithmResults

◆ getCombinationsInCondition()

L1GlobalTriggerObjectMaps::CombinationsInCondition L1GlobalTriggerObjectMaps::getCombinationsInCondition ( int  algorithmBitNumber,
unsigned  conditionNumber 
) const

Each condition can be satisfied by multiple combinations of L1 objects. The number, order, and type of objects associated with each condition is defined in the L1 Trigger Menu. The following function returns an object which has a function that returns the index into the L1 Object Collections of each object in each combination.

Definition at line 94 of file L1GlobalTriggerObjectMaps.cc.

References cms::Exception::addContext(), getStartEndIndex(), m_combinations, m_conditionResults, and mitigatedMETSequence_cff::U.

Referenced by CompareToObjectMapRecord::analyze(), and pat::PATTriggerProducer::produce().

95  {
96  unsigned startIndex = 0;
97  unsigned endIndex = 0;
98  getStartEndIndex(algorithmBitNumber, startIndex, endIndex);
99 
100  if (endIndex <= startIndex + conditionNumber) {
101  cms::Exception ex("L1GlobalTrigger");
102  ex << "Condition number is out of range";
103  ex.addContext("Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
104  throw ex;
105  }
106 
107  unsigned endObjectIndex = m_combinations.size();
108  unsigned nextConditionIndex = startIndex + conditionNumber + 1U;
109  if (nextConditionIndex < m_conditionResults.size()) {
110  endObjectIndex = m_conditionResults[nextConditionIndex].startIndexOfCombinations();
111  }
112  unsigned beginObjectIndex = m_conditionResults[startIndex + conditionNumber].startIndexOfCombinations();
113  unsigned short nObjectsPerCombination = m_conditionResults[startIndex + conditionNumber].nObjectsPerCombination();
114 
115  if (endObjectIndex == beginObjectIndex) {
116  return CombinationsInCondition(nullptr, 0, 0);
117  }
118  if (endObjectIndex < beginObjectIndex || m_combinations.size() < endObjectIndex || nObjectsPerCombination == 0 ||
119  (endObjectIndex - beginObjectIndex) % nObjectsPerCombination != 0) {
120  cms::Exception ex("L1GlobalTrigger");
121  ex << "Indexes to combinations are invalid";
122  ex.addContext("Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
123  throw ex;
124  }
125  return CombinationsInCondition(&m_combinations[beginObjectIndex],
126  (endObjectIndex - beginObjectIndex) / nObjectsPerCombination,
127  nObjectsPerCombination);
128 }
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const
std::vector< unsigned char > m_combinations
std::vector< ConditionResult > m_conditionResults

◆ getConditionsInAlgorithm()

L1GlobalTriggerObjectMaps::ConditionsInAlgorithm L1GlobalTriggerObjectMaps::getConditionsInAlgorithm ( int  algorithmBitNumber) const

Return an object which has a function that returns the results of the conditions associated with an algorithm.

Definition at line 86 of file L1GlobalTriggerObjectMaps.cc.

References getStartEndIndex(), and m_conditionResults.

Referenced by CompareToObjectMapRecord::analyze(), and pat::PATTriggerProducer::produce().

87  {
88  unsigned startIndex = 0;
89  unsigned endIndex = 0;
90  getStartEndIndex(algorithmBitNumber, startIndex, endIndex);
91  return ConditionsInAlgorithm(&m_conditionResults[startIndex], endIndex - startIndex);
92 }
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const
std::vector< ConditionResult > m_conditionResults

◆ getNumberOfConditions()

unsigned L1GlobalTriggerObjectMaps::getNumberOfConditions ( int  algorithmBitNumber) const

Number of conditions associated with an algorithm.

Definition at line 79 of file L1GlobalTriggerObjectMaps.cc.

References getStartEndIndex().

Referenced by CompareToObjectMapRecord::analyze().

79  {
80  unsigned startIndex = 0;
81  unsigned endIndex = 0;
82  getStartEndIndex(algorithmBitNumber, startIndex, endIndex);
83  return endIndex - startIndex;
84 }
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const

◆ getStartEndIndex()

void L1GlobalTriggerObjectMaps::getStartEndIndex ( int  algorithmBitNumber,
unsigned &  startIndex,
unsigned &  endIndex 
) const
private

Definition at line 279 of file L1GlobalTriggerObjectMaps.cc.

References cms::Exception::addContext(), pfDeepBoostedJetPreprocessParams_cfi::lower_bound, m_algorithmResults, and m_conditionResults.

Referenced by getCombinationsInCondition(), getConditionsInAlgorithm(), getNumberOfConditions(), and updateOperandTokenVector().

281  {
282  std::vector<AlgorithmResult>::const_iterator iAlgo = std::lower_bound(
283  m_algorithmResults.begin(), m_algorithmResults.end(), AlgorithmResult(0, algorithmBitNumber, false));
284 
285  if (iAlgo == m_algorithmResults.end() || iAlgo->algorithmBitNumber() != algorithmBitNumber) {
286  cms::Exception ex("L1GlobalTrigger");
287  ex << "algorithmBitNumber not found";
288  ex.addContext("Calling L1GlobalTriggerObjectMaps::getStartEndIndex");
289  throw ex;
290  }
291 
292  startIndex = iAlgo->startIndexOfConditions();
293  ++iAlgo;
294  endIndex = (iAlgo != m_algorithmResults.end()) ? iAlgo->startIndexOfConditions() : m_conditionResults.size();
295 
296  if (endIndex < startIndex || m_conditionResults.size() < endIndex) {
297  cms::Exception ex("L1GlobalTrigger");
298  ex << "index out of order or out of range";
299  ex.addContext("Calling L1GlobalTriggerObjectMaps::getStartEndIndex");
300  throw ex;
301  }
302 }
std::vector< AlgorithmResult > m_algorithmResults
std::vector< ConditionResult > m_conditionResults

◆ namesParameterSetID()

edm::ParameterSetID const& L1GlobalTriggerObjectMaps::namesParameterSetID ( ) const
inline

Returns the ID of the ParameterSet containing the algorithm names and condition names.

Definition at line 64 of file L1GlobalTriggerObjectMaps.h.

References m_namesParameterSetID.

Referenced by CompareToObjectMapRecord::analyze(), and pat::PATTriggerProducer::produce().

64 { return m_namesParameterSetID; }
edm::ParameterSetID m_namesParameterSetID

◆ pushBackAlgorithm()

void L1GlobalTriggerObjectMaps::pushBackAlgorithm ( unsigned  startIndexOfConditions,
int  algorithmBitNumber,
bool  algorithmResult 
)

Definition at line 132 of file L1GlobalTriggerObjectMaps.cc.

References algorithmResult(), and m_algorithmResults.

134  {
135  m_algorithmResults.push_back(AlgorithmResult(startIndexOfConditions, algorithmBitNumber, algorithmResult));
136 }
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
std::vector< AlgorithmResult > m_algorithmResults

◆ pushBackCondition()

void L1GlobalTriggerObjectMaps::pushBackCondition ( unsigned  startIndexOfCombinations,
unsigned short  nObjectsPerCombination,
bool  conditionResult 
)

Definition at line 195 of file L1GlobalTriggerObjectMaps.cc.

References m_conditionResults.

197  {
198  m_conditionResults.push_back(ConditionResult(startIndexOfCombinations, nObjectsPerCombination, conditionResult));
199 }
std::vector< ConditionResult > m_conditionResults

◆ pushBackObjectIndex()

void L1GlobalTriggerObjectMaps::pushBackObjectIndex ( unsigned char  objectIndex)

Definition at line 203 of file L1GlobalTriggerObjectMaps.cc.

References m_combinations.

203  {
204  m_combinations.push_back(objectIndex);
205 }
std::vector< unsigned char > m_combinations

◆ reserveForAlgorithms()

void L1GlobalTriggerObjectMaps::reserveForAlgorithms ( unsigned  n)

Definition at line 130 of file L1GlobalTriggerObjectMaps.cc.

References m_algorithmResults, and dqmiodumpmetadata::n.

130 { m_algorithmResults.reserve(n); }
std::vector< AlgorithmResult > m_algorithmResults

◆ reserveForConditions()

void L1GlobalTriggerObjectMaps::reserveForConditions ( unsigned  n)

Definition at line 193 of file L1GlobalTriggerObjectMaps.cc.

References m_conditionResults, and dqmiodumpmetadata::n.

193 { m_conditionResults.reserve(n); }
std::vector< ConditionResult > m_conditionResults

◆ reserveForObjectIndexes()

void L1GlobalTriggerObjectMaps::reserveForObjectIndexes ( unsigned  n)

Definition at line 201 of file L1GlobalTriggerObjectMaps.cc.

References m_combinations, and dqmiodumpmetadata::n.

201 { m_combinations.reserve(n); }
std::vector< unsigned char > m_combinations

◆ setNamesParameterSetID()

void L1GlobalTriggerObjectMaps::setNamesParameterSetID ( edm::ParameterSetID const &  psetID)

Definition at line 207 of file L1GlobalTriggerObjectMaps.cc.

References m_namesParameterSetID.

207  {
208  m_namesParameterSetID = psetID;
209 }
edm::ParameterSetID m_namesParameterSetID

◆ swap()

void L1GlobalTriggerObjectMaps::swap ( L1GlobalTriggerObjectMaps rh)

Definition at line 23 of file L1GlobalTriggerObjectMaps.cc.

References m_algorithmResults, m_combinations, m_conditionResults, m_namesParameterSetID, and edm::Hash< I >::swap().

23  {
28 }
edm::ParameterSetID m_namesParameterSetID
void swap(Hash< I > &other)
Definition: Hash.h:181
std::vector< AlgorithmResult > m_algorithmResults
std::vector< unsigned char > m_combinations
std::vector< ConditionResult > m_conditionResults

◆ updateOperandTokenVector()

void L1GlobalTriggerObjectMaps::updateOperandTokenVector ( int  algorithmBitNumber,
std::vector< L1GtLogicParser::OperandToken > &  operandTokenVector 
) const

Update the condition result in the operandTokenVector.

Definition at line 51 of file L1GlobalTriggerObjectMaps.cc.

References cms::Exception::addContext(), getStartEndIndex(), mps_fire::i, and m_conditionResults.

52  {
53  unsigned startIndex = 0;
54  unsigned endIndex = 0;
55  getStartEndIndex(algorithmBitNumber, startIndex, endIndex);
56 
57  unsigned length = endIndex - startIndex;
58  if (length != operandTokenVector.size()) {
59  cms::Exception ex("L1GlobalTrigger");
60  ex << "operand token vector size does not match number of conditions";
61  ex.addContext("Calling L1GlobalTriggerObjectMaps::updateOperandTokenVector");
62  throw ex;
63  }
64 
65  for (unsigned i = 0; i < length; ++i) {
66  operandTokenVector[i].tokenResult = m_conditionResults[startIndex + i].conditionResult();
67  }
68 }
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const
std::vector< ConditionResult > m_conditionResults

Member Data Documentation

◆ m_algorithmResults

std::vector<AlgorithmResult> L1GlobalTriggerObjectMaps::m_algorithmResults
private

◆ m_combinations

std::vector<unsigned char> L1GlobalTriggerObjectMaps::m_combinations
private

◆ m_conditionResults

std::vector<ConditionResult> L1GlobalTriggerObjectMaps::m_conditionResults
private

◆ m_namesParameterSetID

edm::ParameterSetID L1GlobalTriggerObjectMaps::m_namesParameterSetID
private

Definition at line 160 of file L1GlobalTriggerObjectMaps.h.

Referenced by namesParameterSetID(), setNamesParameterSetID(), and swap().