CMS 3D CMS Logo

L1GlobalTriggerObjectMaps.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1GlobalTrigger_L1GlobalTriggerObjectMaps_h
2 #define DataFormats_L1GlobalTrigger_L1GlobalTriggerObjectMaps_h
3 
19 #include <vector>
20 
23 
25 public:
27 
29 
31 
33  bool algorithmExists(int algorithmBitNumber) const;
34 
36  bool algorithmResult(int algorithmBitNumber) const;
37 
39  void updateOperandTokenVector(int algorithmBitNumber,
40  std::vector<L1GtLogicParser::OperandToken>& operandTokenVector) const;
41 
43  void getAlgorithmBitNumbers(std::vector<int>& algorithmBitNumbers) const;
44 
46  unsigned getNumberOfConditions(int algorithmBitNumber) const;
47 
48  class ConditionsInAlgorithm;
49  class CombinationsInCondition;
50 
53  ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const;
54 
60  CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const;
61 
65 
66  // the rest are methods used to fill the data
67  // and should only be used by the producer that
68  // creates these and puts them into the event.
69  // There are requirements on ordering and the
70  // stored indexes that the code that calls these
71  // functions is expected to carefully take care of.
72 
73  void reserveForAlgorithms(unsigned n);
74  void pushBackAlgorithm(unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult);
75 
76  // This function should be called after filling the data in this object
77  // using the pushBack* methods.
78  void consistencyCheck() const;
79 
80  void reserveForConditions(unsigned n);
81  void pushBackCondition(unsigned startIndexOfCombinations,
82  unsigned short nObjectsPerCombination,
83  bool conditionResult);
84 
85  void reserveForObjectIndexes(unsigned n);
86  void pushBackObjectIndex(unsigned char objectIndex);
87 
88  void setNamesParameterSetID(edm::ParameterSetID const& psetID);
89 
91  public:
94  unsigned startIndexOfConditions() const { return m_startIndexOfConditions; }
95  short algorithmBitNumber() const { return m_algorithmBitNumber; }
96  bool algorithmResult() const { return m_algorithmResult; }
97  // The operator is used for searching in the std::vector<AlgorithmResult>
98  bool operator<(AlgorithmResult const& right) const { return m_algorithmBitNumber < right.algorithmBitNumber(); }
99 
100  private:
104  };
105 
107  public:
108  ConditionResult();
111  unsigned short nObjectsPerCombination() const { return m_nObjectsPerCombination; }
112  bool conditionResult() const { return m_conditionResult; }
113 
114  private:
116  unsigned short m_nObjectsPerCombination;
118  };
119 
121  public:
122  ConditionsInAlgorithm(ConditionResult const* conditionResults, unsigned nConditions);
123  unsigned nConditions() const { return m_nConditions; }
124  bool getConditionResult(unsigned condition) const;
125 
126  private:
128  unsigned m_nConditions;
129  };
130 
132  public:
133  CombinationsInCondition(unsigned char const* startOfObjectIndexes,
134  unsigned nCombinations,
135  unsigned short nObjectsPerCombination);
136 
137  unsigned nCombinations() const { return m_nCombinations; }
138  unsigned short nObjectsPerCombination() const { return m_nObjectsPerCombination; }
139  unsigned char getObjectIndex(unsigned combination, unsigned object) const;
140 
141  private:
142  unsigned char const* m_startOfObjectIndexes;
143  unsigned m_nCombinations;
144  unsigned short m_nObjectsPerCombination;
145  };
146 
147 private:
148  void getStartEndIndex(int algorithmBitNumber, unsigned& startIndex, unsigned& endIndex) const;
149 
150  // data members
151  // The vectors are sorted. All three vectors are in algorithmBitNumber
152  // order. The second two vectors are sorted such that within an algorithm
153  // the conditions appear in the same order as in the algorithm logical
154  // expression. And the third is additionally sorted so each combination
155  // is contiguous and within a combination the order is the same as the
156  // type specification in the L1 Trigger Menu.
157  std::vector<AlgorithmResult> m_algorithmResults;
158  std::vector<ConditionResult> m_conditionResults;
159  std::vector<unsigned char> m_combinations;
161 };
162 
164 
165 #endif
L1GlobalTriggerObjectMaps::setNamesParameterSetID
void setNamesParameterSetID(edm::ParameterSetID const &psetID)
Definition: L1GlobalTriggerObjectMaps.cc:207
L1GlobalTriggerObjectMaps::ConditionResult::ConditionResult
ConditionResult()
Definition: L1GlobalTriggerObjectMaps.cc:237
L1GlobalTriggerObjectMaps::reserveForObjectIndexes
void reserveForObjectIndexes(unsigned n)
Definition: L1GlobalTriggerObjectMaps.cc:201
L1GlobalTriggerObjectMaps::getCombinationsInCondition
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
Definition: L1GlobalTriggerObjectMaps.cc:94
L1GlobalTriggerObjectMaps::AlgorithmResult::algorithmBitNumber
short algorithmBitNumber() const
Definition: L1GlobalTriggerObjectMaps.h:95
L1GlobalTriggerObjectMaps::CombinationsInCondition::m_startOfObjectIndexes
unsigned char const * m_startOfObjectIndexes
Definition: L1GlobalTriggerObjectMaps.h:142
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
L1GlobalTriggerObjectMaps::swap
void swap(L1GlobalTriggerObjectMaps &rh)
Definition: L1GlobalTriggerObjectMaps.cc:23
L1GlobalTriggerObjectMaps::ConditionResult::m_startIndexOfCombinations
unsigned m_startIndexOfCombinations
Definition: L1GlobalTriggerObjectMaps.h:115
L1GlobalTriggerObjectMaps::namesParameterSetID
edm::ParameterSetID const & namesParameterSetID() const
Definition: L1GlobalTriggerObjectMaps.h:64
L1GlobalTriggerObjectMaps::AlgorithmResult::m_algorithmResult
bool m_algorithmResult
Definition: L1GlobalTriggerObjectMaps.h:103
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult
bool getConditionResult(unsigned condition) const
Definition: L1GlobalTriggerObjectMaps.cc:251
L1GlobalTriggerObjectMaps::ConditionResult::m_conditionResult
bool m_conditionResult
Definition: L1GlobalTriggerObjectMaps.h:117
swap
void swap(L1GlobalTriggerObjectMaps &lh, L1GlobalTriggerObjectMaps &rh)
Definition: L1GlobalTriggerObjectMaps.h:163
L1GlobalTriggerObjectMaps::m_namesParameterSetID
edm::ParameterSetID m_namesParameterSetID
Definition: L1GlobalTriggerObjectMaps.h:160
L1GlobalTriggerObjectMaps::AlgorithmResult::m_algorithmBitNumber
short m_algorithmBitNumber
Definition: L1GlobalTriggerObjectMaps.h:102
L1GlobalTriggerObjectMaps::~L1GlobalTriggerObjectMaps
~L1GlobalTriggerObjectMaps()
Definition: L1GlobalTriggerObjectMaps.h:28
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::nConditions
unsigned nConditions() const
Definition: L1GlobalTriggerObjectMaps.h:123
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
L1GlobalTriggerObjectMaps::m_algorithmResults
std::vector< AlgorithmResult > m_algorithmResults
Definition: L1GlobalTriggerObjectMaps.h:157
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::ConditionsInAlgorithm
ConditionsInAlgorithm(ConditionResult const *conditionResults, unsigned nConditions)
Definition: L1GlobalTriggerObjectMaps.cc:247
L1GlobalTriggerObjectMaps::consistencyCheck
void consistencyCheck() const
Definition: L1GlobalTriggerObjectMaps.cc:138
L1GlobalTriggerObjectMaps::algorithmExists
bool algorithmExists(int algorithmBitNumber) const
Returns true if there is an entry for this algorithm bit number.
Definition: L1GlobalTriggerObjectMaps.cc:30
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm
Definition: L1GlobalTriggerObjectMaps.h:120
L1GlobalTriggerObjectMaps::reserveForAlgorithms
void reserveForAlgorithms(unsigned n)
Definition: L1GlobalTriggerObjectMaps.cc:130
L1GlobalTriggerObjectMaps::L1GlobalTriggerObjectMaps
L1GlobalTriggerObjectMaps()
Definition: L1GlobalTriggerObjectMaps.h:26
L1GlobalTriggerObjectMaps::CombinationsInCondition::m_nCombinations
unsigned m_nCombinations
Definition: L1GlobalTriggerObjectMaps.h:143
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::m_conditionResults
ConditionResult const * m_conditionResults
Definition: L1GlobalTriggerObjectMaps.h:127
edm::Hash< ParameterSetType >
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::m_nConditions
unsigned m_nConditions
Definition: L1GlobalTriggerObjectMaps.h:128
L1GlobalTriggerObjectMaps::pushBackAlgorithm
void pushBackAlgorithm(unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult)
Definition: L1GlobalTriggerObjectMaps.cc:132
L1GlobalTriggerObjectMaps::pushBackObjectIndex
void pushBackObjectIndex(unsigned char objectIndex)
Definition: L1GlobalTriggerObjectMaps.cc:203
L1GlobalTriggerObjectMaps::AlgorithmResult::operator<
bool operator<(AlgorithmResult const &right) const
Definition: L1GlobalTriggerObjectMaps.h:98
L1GlobalTriggerObjectMaps::AlgorithmResult::m_startIndexOfConditions
unsigned m_startIndexOfConditions
Definition: L1GlobalTriggerObjectMaps.h:101
L1GlobalTriggerObjectMaps::CombinationsInCondition
Definition: L1GlobalTriggerObjectMaps.h:131
L1GlobalTriggerObjectMaps::updateOperandTokenVector
void updateOperandTokenVector(int algorithmBitNumber, std::vector< L1GtLogicParser::OperandToken > &operandTokenVector) const
Update the condition result in the operandTokenVector.
Definition: L1GlobalTriggerObjectMaps.cc:51
L1GlobalTriggerObjectMaps::CombinationsInCondition::nCombinations
unsigned nCombinations() const
Definition: L1GlobalTriggerObjectMaps.h:137
L1GlobalTriggerObjectMaps::ConditionResult::conditionResult
bool conditionResult() const
Definition: L1GlobalTriggerObjectMaps.h:112
L1GlobalTriggerObjectMaps::AlgorithmResult::algorithmResult
bool algorithmResult() const
Definition: L1GlobalTriggerObjectMaps.h:96
L1GlobalTriggerObjectMaps::CombinationsInCondition::nObjectsPerCombination
unsigned short nObjectsPerCombination() const
Definition: L1GlobalTriggerObjectMaps.h:138
L1GlobalTriggerObjectMaps::AlgorithmResult::AlgorithmResult
AlgorithmResult()
Definition: L1GlobalTriggerObjectMaps.cc:211
L1GlobalTriggerObjectMaps::m_combinations
std::vector< unsigned char > m_combinations
Definition: L1GlobalTriggerObjectMaps.h:159
L1GlobalTriggerObjectMaps::algorithmResult
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
Definition: L1GlobalTriggerObjectMaps.cc:39
L1GlobalTriggerObjectMaps::AlgorithmResult
Definition: L1GlobalTriggerObjectMaps.h:90
L1GlobalTriggerObjectMaps::CombinationsInCondition::m_nObjectsPerCombination
unsigned short m_nObjectsPerCombination
Definition: L1GlobalTriggerObjectMaps.h:144
L1GlobalTriggerObjectMaps::getConditionsInAlgorithm
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
Definition: L1GlobalTriggerObjectMaps.cc:86
L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex
unsigned char getObjectIndex(unsigned combination, unsigned object) const
Definition: L1GlobalTriggerObjectMaps.cc:268
L1GlobalTriggerObjectMaps::AlgorithmResult::startIndexOfConditions
unsigned startIndexOfConditions() const
Definition: L1GlobalTriggerObjectMaps.h:94
L1GlobalTriggerObjectMaps::pushBackCondition
void pushBackCondition(unsigned startIndexOfCombinations, unsigned short nObjectsPerCombination, bool conditionResult)
Definition: L1GlobalTriggerObjectMaps.cc:195
L1GlobalTriggerObjectMaps::reserveForConditions
void reserveForConditions(unsigned n)
Definition: L1GlobalTriggerObjectMaps.cc:193
L1GlobalTriggerObjectMaps::ConditionResult
Definition: L1GlobalTriggerObjectMaps.h:106
L1GtLogicParser.h
L1GlobalTriggerObjectMaps::CombinationsInCondition::CombinationsInCondition
CombinationsInCondition(unsigned char const *startOfObjectIndexes, unsigned nCombinations, unsigned short nObjectsPerCombination)
Definition: L1GlobalTriggerObjectMaps.cc:261
L1GlobalTriggerObjectMaps::m_conditionResults
std::vector< ConditionResult > m_conditionResults
Definition: L1GlobalTriggerObjectMaps.h:158
L1GlobalTriggerObjectMaps::ConditionResult::startIndexOfCombinations
unsigned startIndexOfCombinations() const
Definition: L1GlobalTriggerObjectMaps.h:110
ParameterSetID.h
L1GlobalTriggerObjectMaps::getNumberOfConditions
unsigned getNumberOfConditions(int algorithmBitNumber) const
Number of conditions associated with an algorithm.
Definition: L1GlobalTriggerObjectMaps.cc:79
L1GlobalTriggerObjectMaps::getStartEndIndex
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const
Definition: L1GlobalTriggerObjectMaps.cc:279
L1GlobalTriggerObjectMaps::getAlgorithmBitNumbers
void getAlgorithmBitNumbers(std::vector< int > &algorithmBitNumbers) const
Fills the vector with all the algorithm bit numbers.
Definition: L1GlobalTriggerObjectMaps.cc:70
L1GlobalTriggerObjectMaps::ConditionResult::m_nObjectsPerCombination
unsigned short m_nObjectsPerCombination
Definition: L1GlobalTriggerObjectMaps.h:116
L1GlobalTriggerObjectMaps::ConditionResult::nObjectsPerCombination
unsigned short nObjectsPerCombination() const
Definition: L1GlobalTriggerObjectMaps.h:111
L1GlobalTriggerObjectMaps
Definition: L1GlobalTriggerObjectMaps.h:24