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
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const
void pushBackCondition(unsigned startIndexOfCombinations, unsigned short nObjectsPerCombination, bool conditionResult)
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
void swap(L1GlobalTriggerObjectMaps &lh, L1GlobalTriggerObjectMaps &rh)
void pushBackObjectIndex(unsigned char objectIndex)
ConditionsInAlgorithm(ConditionResult const *conditionResults, unsigned nConditions)
edm::ParameterSetID m_namesParameterSetID
bool operator<(AlgorithmResult const &right) const
bool int lh
Definition: SIMDVec.h:27
void swap(L1GlobalTriggerObjectMaps &rh)
std::vector< AlgorithmResult > m_algorithmResults
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
unsigned char getObjectIndex(unsigned combination, unsigned object) const
std::vector< unsigned char > m_combinations
std::vector< ConditionResult > m_conditionResults
CombinationsInCondition(unsigned char const *startOfObjectIndexes, unsigned nCombinations, unsigned short nObjectsPerCombination)
void getAlgorithmBitNumbers(std::vector< int > &algorithmBitNumbers) const
Fills the vector with all the algorithm bit numbers.
void pushBackAlgorithm(unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult)
void setNamesParameterSetID(edm::ParameterSetID const &psetID)
edm::ParameterSetID const & namesParameterSetID() const
unsigned getNumberOfConditions(int algorithmBitNumber) const
Number of conditions associated with an algorithm.
void updateOperandTokenVector(int algorithmBitNumber, std::vector< L1GtLogicParser::OperandToken > &operandTokenVector) const
Update the condition result in the operandTokenVector.
bool algorithmExists(int algorithmBitNumber) const
Returns true if there is an entry for this algorithm bit number.
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const