File indexing completed on 2024-04-06 12:20:35
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 SingleCombInCond objectsInComb;
0104
0105
0106 (combinationsInCond()).clear();
0107
0108
0109 objectsInComb.clear();
0110
0111 const BXVector<const GlobalExtBlk*>* candVec = m_uGtB->getCandL1External();
0112
0113
0114 int useBx = bxEval + m_gtExternalTemplate->condRelativeBx();
0115 unsigned int exCondCh = m_gtExternalTemplate->extChannel();
0116
0117
0118 if ((useBx < candVec->getFirstBX()) || (useBx > candVec->getLastBX())) {
0119 return false;
0120 }
0121
0122 int numberObjects = candVec->size(useBx);
0123 if (numberObjects < 1) {
0124 return false;
0125 }
0126
0127
0128 GlobalExtBlk ext = *(candVec->at(useBx, 0));
0129
0130
0131
0132 if (!ext.getExternalDecision(exCondCh)) {
0133 LogDebug("L1TGlobal") << "\t\t External Condition was not set" << std::endl;
0134 return false;
0135 }
0136
0137
0138 int indexObj = 0;
0139
0140
0141 objectsInComb.push_back(indexObj);
0142 (combinationsInCond()).push_back(objectsInComb);
0143
0144
0145
0146 condResult = true;
0147 LogDebug("L1TGlobal") << "\t\t Congrats, External Condition was set!" << std::endl;
0148
0149 return condResult;
0150 }
0151
0152 void l1t::ExternalCondition::print(std::ostream& myCout) const {
0153 m_gtExternalTemplate->print(myCout);
0154 ConditionEvaluation::print(myCout);
0155 }