File indexing completed on 2024-04-06 12:20:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "L1Trigger/L1TGlobal/interface/MuonShowerCondition.h"
0025
0026
0027 #include <iostream>
0028 #include <iomanip>
0029
0030 #include <string>
0031 #include <vector>
0032 #include <algorithm>
0033
0034
0035
0036 #include "L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h"
0037 #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h"
0038 #include "DataFormats/L1Trigger/interface/MuonShower.h"
0039 #include "L1Trigger/L1TGlobal/interface/GlobalBoard.h"
0040 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0041 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0042
0043
0044
0045 l1t::MuonShowerCondition::MuonShowerCondition() : ConditionEvaluation() {
0046
0047 }
0048
0049
0050 l1t::MuonShowerCondition::MuonShowerCondition(const GlobalCondition* muonShowerTemplate,
0051 const GlobalBoard* ptrGTL,
0052 const int nrL1MuShower)
0053 : ConditionEvaluation(),
0054 m_gtMuonShowerTemplate(static_cast<const MuonShowerTemplate*>(muonShowerTemplate)),
0055 m_gtGTL(ptrGTL) {
0056 m_condMaxNumberObjects = nrL1MuShower;
0057 }
0058
0059
0060 void l1t::MuonShowerCondition::copy(const l1t::MuonShowerCondition& cp) {
0061 m_gtMuonShowerTemplate = cp.gtMuonShowerTemplate();
0062 m_gtGTL = cp.gtGTL();
0063
0064 m_condMaxNumberObjects = cp.condMaxNumberObjects();
0065 m_condLastResult = cp.condLastResult();
0066 m_combinationsInCond = cp.getCombinationsInCond();
0067
0068 m_verbosity = cp.m_verbosity;
0069 }
0070
0071 l1t::MuonShowerCondition::MuonShowerCondition(const l1t::MuonShowerCondition& cp) : ConditionEvaluation() { copy(cp); }
0072
0073
0074 l1t::MuonShowerCondition::~MuonShowerCondition() {
0075
0076 }
0077
0078
0079 l1t::MuonShowerCondition& l1t::MuonShowerCondition::operator=(const l1t::MuonShowerCondition& cp) {
0080 copy(cp);
0081 return *this;
0082 }
0083
0084
0085 void l1t::MuonShowerCondition::setGtMuonShowerTemplate(const MuonShowerTemplate* muonTempl) {
0086 m_gtMuonShowerTemplate = muonTempl;
0087 }
0088
0089
0090 void l1t::MuonShowerCondition::setGtGTL(const GlobalBoard* ptrGTL) { m_gtGTL = ptrGTL; }
0091
0092
0093 const bool l1t::MuonShowerCondition::evaluateCondition(const int bxEval) const {
0094 bool condResult = false;
0095
0096
0097
0098
0099
0100 int nObjInCond = m_gtMuonShowerTemplate->nrObjects();
0101
0102 const BXVector<std::shared_ptr<l1t::MuonShower>>* candVec = m_gtGTL->getCandL1MuShower();
0103
0104
0105 int useBx = bxEval + m_gtMuonShowerTemplate->condRelativeBx();
0106 LogDebug("MuonShowerCondition") << "Considering BX " << useBx << std::endl;
0107
0108
0109 if ((useBx < candVec->getFirstBX()) || (useBx > candVec->getLastBX())) {
0110 return false;
0111 }
0112
0113
0114 SingleCombInCond objectsInComb;
0115 objectsInComb.reserve(nObjInCond);
0116
0117
0118 combinationsInCond().clear();
0119
0120 objectsInComb.clear();
0121
0122
0123
0124
0125
0126 int numberObjects = candVec->size(useBx);
0127 if (numberObjects < 1) {
0128 return false;
0129 }
0130
0131 std::vector<int> index(numberObjects);
0132 for (int i = 0; i < numberObjects; ++i) {
0133 index[i] = i;
0134 }
0135
0136
0137 int indexObj = 0;
0138
0139 bool passCondition = false;
0140
0141 for (int i = 0; i < numberObjects; i++) {
0142 passCondition = checkObjectParameter(0, *(candVec->at(useBx, index[i])), index[i]);
0143 condResult |= passCondition;
0144 if (passCondition) {
0145 LogDebug("MuonShowerCondition")
0146 << "===> MuShowerCondition::evaluateCondition, PASS! This muon shower passed the condition." << std::endl;
0147 objectsInComb.push_back(indexObj);
0148 } else
0149 LogDebug("MuonShowerCondition")
0150 << "===> MuShowerCondition::evaluateCondition, FAIL! This muon shower failed the condition." << std::endl;
0151 }
0152
0153
0154
0155 (combinationsInCond()).push_back(objectsInComb);
0156
0157 return condResult;
0158 }
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168 const bool l1t::MuonShowerCondition::checkObjectParameter(const int iCondition,
0169 const l1t::MuonShower& cand,
0170 const unsigned int index) const {
0171
0172 int nObjInCond = m_gtMuonShowerTemplate->nrObjects();
0173
0174 if (iCondition >= nObjInCond || iCondition < 0) {
0175 return false;
0176 }
0177
0178 const MuonShowerTemplate::ObjectParameter objPar = (*(m_gtMuonShowerTemplate->objectParameter()))[iCondition];
0179
0180 LogDebug("L1TGlobal") << "\n MuonShowerTemplate::ObjectParameter (utm objects, checking which condition is parsed): "
0181 << std::hex << "\n\t MuonShower0 = 0x " << objPar.MuonShower0 << "\n\t MuonShower1 = 0x "
0182 << objPar.MuonShower1 << "\n\t MuonShower2 = 0x " << objPar.MuonShower2
0183 << "\n\t MuonShowerOutOfTime0 = 0x " << objPar.MuonShowerOutOfTime0
0184 << "\n\t MuonShowerOutOfTime1 = 0x " << objPar.MuonShowerOutOfTime1 << std::endl;
0185
0186 LogDebug("L1TGlobal") << "\n l1t::MuonShower (uGT emulator bits): "
0187 << "\n\t MuonShower0: isOneNominalInTime() = " << cand.isOneNominalInTime()
0188 << "\n\t MuonShower1: isOneTightInTime() = " << cand.isOneTightInTime()
0189 << "\n\t MuonShower2: isTwoLooseDiffSectorsInTime() = " << cand.isTwoLooseDiffSectorsInTime()
0190 << "\n\t MuonShowerOutOfTime0: musOutOfTime0() = " << cand.musOutOfTime0()
0191 << "\n\t MuonShowerOutOfTime1: musOutOfTime1() = " << cand.musOutOfTime1() << std::endl;
0192
0193
0194 if (cand.isOneNominalInTime() != objPar.MuonShower0) {
0195 LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShower0 requirement" << std::endl;
0196 return false;
0197 }
0198
0199 if (cand.isOneTightInTime() != objPar.MuonShower1) {
0200 LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShower1 requirement" << std::endl;
0201 return false;
0202 }
0203
0204 if (cand.isTwoLooseDiffSectorsInTime() != objPar.MuonShower2) {
0205 LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShower2 requirement" << std::endl;
0206 return false;
0207 }
0208 if (cand.musOutOfTime0() != objPar.MuonShowerOutOfTime0) {
0209 LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShowerOutOfTime0 requirement" << std::endl;
0210 return false;
0211 }
0212 if (cand.musOutOfTime1() != objPar.MuonShowerOutOfTime1) {
0213 LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShowerOutOfTime1 requirement" << std::endl;
0214 return false;
0215 }
0216
0217 return true;
0218 }
0219
0220 void l1t::MuonShowerCondition::print(std::ostream& myCout) const {
0221 m_gtMuonShowerTemplate->print(myCout);
0222 ConditionEvaluation::print(myCout);
0223 }