File indexing completed on 2024-04-06 12:20:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "L1Trigger/GlobalTrigger/interface/L1GtJetCountsCondition.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/L1GctJetCounts.h"
0029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0030
0031 #include "CondFormats/L1TObjects/interface/L1GtJetCountsTemplate.h"
0032
0033 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h"
0034
0035
0036
0037 L1GtJetCountsCondition::L1GtJetCountsCondition() : L1GtConditionEvaluation() {
0038
0039 }
0040
0041
0042 L1GtJetCountsCondition::L1GtJetCountsCondition(const L1GtCondition *jcTemplate,
0043 const L1GlobalTriggerPSB *ptrPSB,
0044 const int nrL1JetCounts)
0045 : L1GtConditionEvaluation(),
0046 m_gtJetCountsTemplate(static_cast<const L1GtJetCountsTemplate *>(jcTemplate)),
0047 m_gtPSB(ptrPSB),
0048 m_numberL1JetCounts(nrL1JetCounts) {
0049
0050
0051 m_condMaxNumberObjects = 1;
0052 }
0053
0054
0055 void L1GtJetCountsCondition::copy(const L1GtJetCountsCondition &cp) {
0056 m_gtJetCountsTemplate = cp.gtJetCountsTemplate();
0057 m_gtPSB = cp.gtPSB();
0058
0059 m_condMaxNumberObjects = cp.condMaxNumberObjects();
0060 m_condLastResult = cp.condLastResult();
0061 m_combinationsInCond = cp.getCombinationsInCond();
0062
0063 m_verbosity = cp.m_verbosity;
0064 }
0065
0066 L1GtJetCountsCondition::L1GtJetCountsCondition(const L1GtJetCountsCondition &cp) : L1GtConditionEvaluation() {
0067 copy(cp);
0068 }
0069
0070
0071 L1GtJetCountsCondition::~L1GtJetCountsCondition() {
0072
0073 }
0074
0075
0076 L1GtJetCountsCondition &L1GtJetCountsCondition::operator=(const L1GtJetCountsCondition &cp) {
0077 copy(cp);
0078 return *this;
0079 }
0080
0081
0082 void L1GtJetCountsCondition::setGtJetCountsTemplate(const L1GtJetCountsTemplate *jcTemplate) {
0083 m_gtJetCountsTemplate = jcTemplate;
0084 }
0085
0086
0087 void L1GtJetCountsCondition::setGtPSB(const L1GlobalTriggerPSB *ptrPSB) { m_gtPSB = ptrPSB; }
0088
0089
0090 const bool L1GtJetCountsCondition::evaluateCondition() const {
0091
0092
0093 int iCondition = 0;
0094
0095
0096
0097 bool condResult = false;
0098
0099
0100
0101 SingleCombInCond objectsInComb;
0102
0103
0104 (combinationsInCond()).clear();
0105
0106
0107 const L1GctJetCounts *jetCounts = m_gtPSB->getCandL1JetCounts();
0108
0109
0110 if (jetCounts == nullptr) {
0111 return false;
0112 }
0113
0114 const L1GtJetCountsTemplate::ObjectParameter objPar = (*(m_gtJetCountsTemplate->objectParameter()))[iCondition];
0115
0116 unsigned int cIndex = objPar.countIndex;
0117
0118 if (cIndex >= m_numberL1JetCounts) {
0119 edm::LogError("L1GlobalTrigger") << "\nL1GtJetCountsCondition error: countIndex " << cIndex
0120 << "greater than maximum allowed count = " << m_numberL1JetCounts
0121 << "\n ==> condResult = false " << std::endl;
0122 return false;
0123 }
0124
0125 unsigned int countValue = jetCounts->count(cIndex);
0126
0127
0128 if (!checkThreshold(objPar.countThreshold, countValue, m_gtJetCountsTemplate->condGEq())) {
0129 return false;
0130 }
0131
0132
0133
0134 int indexObj = 0;
0135
0136 objectsInComb.push_back(indexObj);
0137 (combinationsInCond()).push_back(objectsInComb);
0138
0139
0140
0141
0142 condResult = true;
0143 return condResult;
0144 }
0145
0146 void L1GtJetCountsCondition::print(std::ostream &myCout) const {
0147 m_gtJetCountsTemplate->print(myCout);
0148 L1GtConditionEvaluation::print(myCout);
0149 }