File indexing completed on 2023-03-17 11:11:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "L1Trigger/GlobalTrigger/interface/L1GtHfBitCountsCondition.h"
0017
0018
0019 #include <iomanip>
0020 #include <iostream>
0021
0022 #include <vector>
0023
0024
0025
0026 #include "L1Trigger/GlobalTrigger/interface/L1GtConditionEvaluation.h"
0027
0028 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCounts.h"
0029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0030
0031 #include "CondFormats/L1TObjects/interface/L1GtHfBitCountsTemplate.h"
0032
0033 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h"
0034
0035
0036
0037 L1GtHfBitCountsCondition::L1GtHfBitCountsCondition() : L1GtConditionEvaluation() {
0038
0039 }
0040
0041
0042 L1GtHfBitCountsCondition::L1GtHfBitCountsCondition(const L1GtCondition *bcTemplate, const L1GlobalTriggerPSB *ptrPSB)
0043 : L1GtConditionEvaluation(),
0044 m_gtHfBitCountsTemplate(static_cast<const L1GtHfBitCountsTemplate *>(bcTemplate)),
0045 m_gtPSB(ptrPSB) {
0046
0047
0048 m_condMaxNumberObjects = 1;
0049 }
0050
0051
0052 void L1GtHfBitCountsCondition::copy(const L1GtHfBitCountsCondition &cp) {
0053 m_gtHfBitCountsTemplate = cp.gtHfBitCountsTemplate();
0054 m_gtPSB = cp.gtPSB();
0055
0056 m_condMaxNumberObjects = cp.condMaxNumberObjects();
0057 m_condLastResult = cp.condLastResult();
0058 m_combinationsInCond = cp.getCombinationsInCond();
0059
0060 m_verbosity = cp.m_verbosity;
0061 }
0062
0063 L1GtHfBitCountsCondition::L1GtHfBitCountsCondition(const L1GtHfBitCountsCondition &cp) : L1GtConditionEvaluation() {
0064 copy(cp);
0065 }
0066
0067
0068 L1GtHfBitCountsCondition::~L1GtHfBitCountsCondition() {
0069
0070 }
0071
0072
0073 L1GtHfBitCountsCondition &L1GtHfBitCountsCondition::operator=(const L1GtHfBitCountsCondition &cp) {
0074 copy(cp);
0075 return *this;
0076 }
0077
0078
0079 void L1GtHfBitCountsCondition::setGtHfBitCountsTemplate(const L1GtHfBitCountsTemplate *bcTemplate) {
0080 m_gtHfBitCountsTemplate = bcTemplate;
0081 }
0082
0083
0084 void L1GtHfBitCountsCondition::setGtPSB(const L1GlobalTriggerPSB *ptrPSB) { m_gtPSB = ptrPSB; }
0085
0086
0087 const bool L1GtHfBitCountsCondition::evaluateCondition() const {
0088
0089
0090 int iCondition = 0;
0091
0092
0093
0094 bool condResult = false;
0095
0096
0097
0098 SingleCombInCond objectsInComb;
0099
0100
0101 (combinationsInCond()).clear();
0102
0103
0104 const L1GctHFBitCounts *bitCounts = m_gtPSB->getCandL1HfBitCounts();
0105
0106
0107 if (bitCounts == nullptr) {
0108 return false;
0109 }
0110
0111 const L1GtHfBitCountsTemplate::ObjectParameter objPar = (*(m_gtHfBitCountsTemplate->objectParameter()))[iCondition];
0112
0113
0114 const unsigned int numberL1HfBitCounts = 4;
0115
0116 const unsigned int cIndex = objPar.countIndex;
0117 if (cIndex >= numberL1HfBitCounts) {
0118 edm::LogError("L1GlobalTrigger") << "\nL1GtHfBitCountsCondition error: countIndex " << cIndex
0119 << "greater than GCT maximum index = " << numberL1HfBitCounts
0120 << "\n ==> condResult = false " << std::endl;
0121 return false;
0122 }
0123
0124 const unsigned int countValue = bitCounts->bitCount(cIndex);
0125
0126
0127 if (!checkThreshold(objPar.countThreshold, countValue, m_gtHfBitCountsTemplate->condGEq())) {
0128 return false;
0129 }
0130
0131
0132 int indexObj = 0;
0133
0134 objectsInComb.push_back(indexObj);
0135 (combinationsInCond()).push_back(objectsInComb);
0136
0137
0138
0139
0140 condResult = true;
0141 return condResult;
0142 }
0143
0144 void L1GtHfBitCountsCondition::print(std::ostream &myCout) const {
0145 m_gtHfBitCountsTemplate->print(myCout);
0146 L1GtConditionEvaluation::print(myCout);
0147 }