File indexing completed on 2025-01-14 23:17:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "L1Trigger/L1TGlobal/interface/ExternalCondition.h"
0015
0016
0017 #include <iostream>
0018 #include <iomanip>
0019
0020 #include <string>
0021 #include <vector>
0022 #include <algorithm>
0023
0024
0025
0026 #include "L1Trigger/L1TGlobal/interface/ExternalTemplate.h"
0027 #include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h"
0028 #include "DataFormats/L1Trigger/interface/L1Candidate.h"
0029 #include "L1Trigger/L1TGlobal/interface/GlobalBoard.h"
0030
0031 #include "DataFormats/L1TGlobal/interface/GlobalExtBlk.h"
0032
0033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0034 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0035
0036
0037
0038 l1t::ExternalCondition::ExternalCondition() : ConditionEvaluation() {
0039
0040 }
0041
0042
0043 l1t::ExternalCondition::ExternalCondition(const GlobalCondition* eSumTemplate, const GlobalBoard* ptrGTB)
0044 : ConditionEvaluation(),
0045 m_gtExternalTemplate(static_cast<const ExternalTemplate*>(eSumTemplate)),
0046 m_uGtB(ptrGTB)
0047
0048 {
0049
0050
0051
0052 m_condMaxNumberObjects = 1;
0053 }
0054
0055
0056 void l1t::ExternalCondition::copy(const l1t::ExternalCondition& cp) {
0057 m_gtExternalTemplate = cp.gtExternalTemplate();
0058 m_uGtB = cp.getuGtB();
0059
0060 m_condMaxNumberObjects = cp.condMaxNumberObjects();
0061 m_condLastResult = cp.condLastResult();
0062 m_combinationsInCond = cp.getCombinationsInCond();
0063
0064 m_verbosity = cp.m_verbosity;
0065 }
0066
0067 l1t::ExternalCondition::ExternalCondition(const l1t::ExternalCondition& cp) : ConditionEvaluation() { copy(cp); }
0068
0069
0070 l1t::ExternalCondition::~ExternalCondition() {
0071
0072 }
0073
0074
0075 l1t::ExternalCondition& l1t::ExternalCondition::operator=(const l1t::ExternalCondition& cp) {
0076 copy(cp);
0077 return *this;
0078 }
0079
0080
0081 void l1t::ExternalCondition::setGtExternalTemplate(const ExternalTemplate* eSumTempl) {
0082 m_gtExternalTemplate = eSumTempl;
0083 }
0084
0085
0086 void l1t::ExternalCondition::setuGtB(const GlobalBoard* ptrGTB) { m_uGtB = ptrGTB; }
0087
0088
0089 const bool l1t::ExternalCondition::evaluateCondition(const int bxEval) const {
0090 LogDebug("L1TGlobal") << "Evaluating External Condition " << m_gtExternalTemplate->condName() << " on Channel "
0091 << m_gtExternalTemplate->extChannel() << " relative Bx "
0092 << m_gtExternalTemplate->condRelativeBx() << std::endl;
0093
0094
0095
0096
0097
0098
0099 bool condResult = false;
0100
0101
0102
0103 SingleCombWithBxInCond objectsInComb;
0104
0105
0106 (combinationsInCond()).clear();
0107
0108
0109 objectsInComb.clear();
0110
0111 const BXVector<const GlobalExtBlk*>* candVec = m_uGtB->getCandL1External();
0112
0113
0114 L1TObjBxIndexType const useBx = bxEval + m_gtExternalTemplate->condRelativeBx();
0115
0116
0117 if ((useBx < candVec->getFirstBX()) || (useBx > candVec->getLastBX())) {
0118 return false;
0119 }
0120
0121 auto const numberObjects = candVec->size(useBx);
0122 if (numberObjects < 1) {
0123 return false;
0124 }
0125
0126
0127 unsigned int const candIndex{0u};
0128 GlobalExtBlk const& ext = *(candVec->at(useBx, candIndex));
0129
0130
0131
0132 unsigned int exCondCh = m_gtExternalTemplate->extChannel();
0133 if (!ext.getExternalDecision(exCondCh)) {
0134 LogDebug("L1TGlobal") << "\t\t External Condition was not set" << std::endl;
0135 return false;
0136 }
0137
0138
0139 objectsInComb.emplace_back(useBx, candIndex);
0140 (combinationsInCond()).push_back(objectsInComb);
0141
0142
0143
0144 condResult = true;
0145 LogDebug("L1TGlobal") << "\t\t Congrats, External Condition was set!" << std::endl;
0146
0147 return condResult;
0148 }
0149
0150 void l1t::ExternalCondition::print(std::ostream& myCout) const {
0151 m_gtExternalTemplate->print(myCout);
0152 ConditionEvaluation::print(myCout);
0153 }