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 {
26 
27 public:
28 
30 
32 
34 
36  bool algorithmExists(int algorithmBitNumber) const;
37 
39  bool algorithmResult(int algorithmBitNumber) const;
40 
42  void updateOperandTokenVector(int algorithmBitNumber,
43  std::vector<L1GtLogicParser::OperandToken>& operandTokenVector) const;
44 
46  void getAlgorithmBitNumbers(std::vector<int>& algorithmBitNumbers) const;
47 
49  unsigned getNumberOfConditions(int algorithmBitNumber) const;
50 
53 
56  ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const;
57 
64  unsigned conditionNumber) const;
65 
69 
70  // the rest are methods used to fill the data
71  // and should only be used by the producer that
72  // creates these and puts them into the event.
73  // There are requirements on ordering and the
74  // stored indexes that the code that calls these
75  // functions is expected to carefully take care of.
76 
77  void reserveForAlgorithms(unsigned n);
78  void pushBackAlgorithm(unsigned startIndexOfConditions,
79  int algorithmBitNumber,
80  bool algorithmResult);
81 
82  // This function should be called after filling the data in this object
83  // using the pushBack* methods.
84  void consistencyCheck() const;
85 
86  void reserveForConditions(unsigned n);
87  void pushBackCondition(unsigned startIndexOfCombinations,
88  unsigned short nObjectsPerCombination,
89  bool conditionResult);
90 
91  void reserveForObjectIndexes(unsigned n);
92  void pushBackObjectIndex(unsigned char objectIndex);
93 
94  void setNamesParameterSetID(edm::ParameterSetID const& psetID);
95 
97  public:
99  AlgorithmResult(unsigned startIndexOfConditions,
100  int algorithmBitNumber,
101  bool algorithmResult);
103  short algorithmBitNumber() const { return m_algorithmBitNumber; }
104  bool algorithmResult() const { return m_algorithmResult; }
105  // The operator is used for searching in the std::vector<AlgorithmResult>
106  bool operator<(AlgorithmResult const& right) const {
107  return m_algorithmBitNumber < right.algorithmBitNumber();
108  }
109  private:
113  };
114 
116  public:
117  ConditionResult();
118  ConditionResult(unsigned startIndexOfCombinations,
119  unsigned short nObjectsPerCombination,
120  bool conditionResult);
121  unsigned startIndexOfCombinations() const { return m_startIndexOfCombinations; }
122  unsigned short nObjectsPerCombination() const { return m_nObjectsPerCombination; }
123  bool conditionResult() const { return m_conditionResult; }
124  private:
126  unsigned short m_nObjectsPerCombination;
128  };
129 
131  public:
132  ConditionsInAlgorithm(ConditionResult const* conditionResults,
133  unsigned nConditions);
134  unsigned nConditions() const { return m_nConditions; }
135  bool getConditionResult(unsigned condition) const;
136 
137  private:
139  unsigned m_nConditions;
140  };
141 
143  public:
144  CombinationsInCondition(unsigned char const* startOfObjectIndexes,
145  unsigned nCombinations,
146  unsigned short nObjectsPerCombination);
147 
148  unsigned nCombinations() const { return m_nCombinations; }
149  unsigned short nObjectsPerCombination() const { return m_nObjectsPerCombination; }
150  unsigned char getObjectIndex(unsigned combination,
151  unsigned object) const;
152  private:
153  unsigned char const* m_startOfObjectIndexes;
154  unsigned m_nCombinations;
155  unsigned short m_nObjectsPerCombination;
156  };
157 
158 private:
159 
160  void getStartEndIndex(int algorithmBitNumber, unsigned& startIndex, unsigned& endIndex) const;
161 
162  // data members
163  // The vectors are sorted. All three vectors are in algorithmBitNumber
164  // order. The second two vectors are sorted such that within an algorithm
165  // the conditions appear in the same order as in the algorithm logical
166  // expression. And the third is additionally sorted so each combination
167  // is contiguous and within a combination the order is the same as the
168  // type specification in the L1 Trigger Menu.
169  std::vector<AlgorithmResult> m_algorithmResults;
170  std::vector<ConditionResult> m_conditionResults;
171  std::vector<unsigned char> m_combinations;
173 };
174 
176  lh.swap(rh);
177 }
178 
179 #endif
void pushBackCondition(unsigned startIndexOfCombinations, unsigned short nObjectsPerCombination, bool conditionResult)
void pushBackObjectIndex(unsigned char objectIndex)
edm::ParameterSetID m_namesParameterSetID
bool int lh
Definition: SIMDVec.h:21
void getAlgorithmBitNumbers(std::vector< int > &algorithmBitNumbers) const
Fills the vector with all the algorithm bit numbers.
bool algorithmExists(int algorithmBitNumber) const
Returns true if there is an entry for this algorithm bit number.
bool operator<(AlgorithmResult const &right) const
void swap(L1GlobalTriggerObjectMaps &rh)
std::vector< AlgorithmResult > m_algorithmResults
edm::ParameterSetID const & namesParameterSetID() const
std::vector< unsigned char > m_combinations
std::vector< ConditionResult > m_conditionResults
void updateOperandTokenVector(int algorithmBitNumber, std::vector< L1GtLogicParser::OperandToken > &operandTokenVector) const
Update the condition result in the operandTokenVector.
void pushBackAlgorithm(unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult)
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
unsigned getNumberOfConditions(int algorithmBitNumber) const
Number of conditions associated with an algorithm.
void setNamesParameterSetID(edm::ParameterSetID const &psetID)
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const