File indexing completed on 2024-04-06 12:04:28
0001 #ifndef DataFormats_L1GlobalTrigger_L1GlobalTriggerObjectMaps_h
0002 #define DataFormats_L1GlobalTrigger_L1GlobalTriggerObjectMaps_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <vector>
0020
0021 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
0022 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0023
0024 class L1GlobalTriggerObjectMaps {
0025 public:
0026 L1GlobalTriggerObjectMaps() {}
0027
0028 ~L1GlobalTriggerObjectMaps() {}
0029
0030 void swap(L1GlobalTriggerObjectMaps& rh);
0031
0032
0033 bool algorithmExists(int algorithmBitNumber) const;
0034
0035
0036 bool algorithmResult(int algorithmBitNumber) const;
0037
0038
0039 void updateOperandTokenVector(int algorithmBitNumber,
0040 std::vector<L1GtLogicParser::OperandToken>& operandTokenVector) const;
0041
0042
0043 void getAlgorithmBitNumbers(std::vector<int>& algorithmBitNumbers) const;
0044
0045
0046 unsigned getNumberOfConditions(int algorithmBitNumber) const;
0047
0048 class ConditionsInAlgorithm;
0049 class CombinationsInCondition;
0050
0051
0052
0053 ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const;
0054
0055
0056
0057
0058
0059
0060 CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const;
0061
0062
0063
0064 edm::ParameterSetID const& namesParameterSetID() const { return m_namesParameterSetID; }
0065
0066
0067
0068
0069
0070
0071
0072
0073 void reserveForAlgorithms(unsigned n);
0074 void pushBackAlgorithm(unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult);
0075
0076
0077
0078 void consistencyCheck() const;
0079
0080 void reserveForConditions(unsigned n);
0081 void pushBackCondition(unsigned startIndexOfCombinations,
0082 unsigned short nObjectsPerCombination,
0083 bool conditionResult);
0084
0085 void reserveForObjectIndexes(unsigned n);
0086 void pushBackObjectIndex(unsigned char objectIndex);
0087
0088 void setNamesParameterSetID(edm::ParameterSetID const& psetID);
0089
0090 class AlgorithmResult {
0091 public:
0092 AlgorithmResult();
0093 AlgorithmResult(unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult);
0094 unsigned startIndexOfConditions() const { return m_startIndexOfConditions; }
0095 short algorithmBitNumber() const { return m_algorithmBitNumber; }
0096 bool algorithmResult() const { return m_algorithmResult; }
0097
0098 bool operator<(AlgorithmResult const& right) const { return m_algorithmBitNumber < right.algorithmBitNumber(); }
0099
0100 private:
0101 unsigned m_startIndexOfConditions;
0102 short m_algorithmBitNumber;
0103 bool m_algorithmResult;
0104 };
0105
0106 class ConditionResult {
0107 public:
0108 ConditionResult();
0109 ConditionResult(unsigned startIndexOfCombinations, unsigned short nObjectsPerCombination, bool conditionResult);
0110 unsigned startIndexOfCombinations() const { return m_startIndexOfCombinations; }
0111 unsigned short nObjectsPerCombination() const { return m_nObjectsPerCombination; }
0112 bool conditionResult() const { return m_conditionResult; }
0113
0114 private:
0115 unsigned m_startIndexOfCombinations;
0116 unsigned short m_nObjectsPerCombination;
0117 bool m_conditionResult;
0118 };
0119
0120 class ConditionsInAlgorithm {
0121 public:
0122 ConditionsInAlgorithm(ConditionResult const* conditionResults, unsigned nConditions);
0123 unsigned nConditions() const { return m_nConditions; }
0124 bool getConditionResult(unsigned condition) const;
0125
0126 private:
0127 ConditionResult const* m_conditionResults;
0128 unsigned m_nConditions;
0129 };
0130
0131 class CombinationsInCondition {
0132 public:
0133 CombinationsInCondition(unsigned char const* startOfObjectIndexes,
0134 unsigned nCombinations,
0135 unsigned short nObjectsPerCombination);
0136
0137 unsigned nCombinations() const { return m_nCombinations; }
0138 unsigned short nObjectsPerCombination() const { return m_nObjectsPerCombination; }
0139 unsigned char getObjectIndex(unsigned combination, unsigned object) const;
0140
0141 private:
0142 unsigned char const* m_startOfObjectIndexes;
0143 unsigned m_nCombinations;
0144 unsigned short m_nObjectsPerCombination;
0145 };
0146
0147 private:
0148 void getStartEndIndex(int algorithmBitNumber, unsigned& startIndex, unsigned& endIndex) const;
0149
0150
0151
0152
0153
0154
0155
0156
0157 std::vector<AlgorithmResult> m_algorithmResults;
0158 std::vector<ConditionResult> m_conditionResults;
0159 std::vector<unsigned char> m_combinations;
0160 edm::ParameterSetID m_namesParameterSetID;
0161 };
0162
0163 inline void swap(L1GlobalTriggerObjectMaps& lh, L1GlobalTriggerObjectMaps& rh) { lh.swap(rh); }
0164
0165 #endif