Go to the documentation of this file.00001
00017
00018 #include "L1Trigger/GlobalTrigger/interface/L1GtEnergySumCondition.h"
00019
00020
00021 #include <iostream>
00022 #include <iomanip>
00023
00024 #include <string>
00025 #include <vector>
00026 #include <algorithm>
00027
00028
00029
00030 #include "CondFormats/L1TObjects/interface/L1GtEnergySumTemplate.h"
00031 #include "L1Trigger/GlobalTrigger/interface/L1GtConditionEvaluation.h"
00032
00033 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00034
00035 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtSums.h"
00036
00037 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerFunctions.h"
00038 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h"
00039
00040
00041
00042 L1GtEnergySumCondition::L1GtEnergySumCondition() :
00043 L1GtConditionEvaluation() {
00044
00045
00046
00047 }
00048
00049
00050 L1GtEnergySumCondition::L1GtEnergySumCondition(const L1GtCondition* eSumTemplate,
00051 const L1GlobalTriggerPSB* ptrPSB) :
00052 L1GtConditionEvaluation(),
00053 m_gtEnergySumTemplate(static_cast<const L1GtEnergySumTemplate*>(eSumTemplate)),
00054 m_gtPSB(ptrPSB)
00055
00056 {
00057
00058
00059
00060
00061 m_condMaxNumberObjects = 1;
00062
00063 }
00064
00065
00066 void L1GtEnergySumCondition::copy(const L1GtEnergySumCondition &cp) {
00067
00068 m_gtEnergySumTemplate = cp.gtEnergySumTemplate();
00069 m_gtPSB = cp.gtPSB();
00070
00071 m_condMaxNumberObjects = cp.condMaxNumberObjects();
00072 m_condLastResult = cp.condLastResult();
00073 m_combinationsInCond = cp.getCombinationsInCond();
00074
00075 m_verbosity = cp.m_verbosity;
00076
00077 }
00078
00079 L1GtEnergySumCondition::L1GtEnergySumCondition(const L1GtEnergySumCondition& cp) :
00080 L1GtConditionEvaluation() {
00081
00082 copy(cp);
00083
00084 }
00085
00086
00087 L1GtEnergySumCondition::~L1GtEnergySumCondition() {
00088
00089
00090
00091 }
00092
00093
00094 L1GtEnergySumCondition& L1GtEnergySumCondition::operator= (const L1GtEnergySumCondition& cp)
00095 {
00096 copy(cp);
00097 return *this;
00098 }
00099
00100
00101 void L1GtEnergySumCondition::setGtEnergySumTemplate(
00102 const L1GtEnergySumTemplate* eSumTempl) {
00103
00104 m_gtEnergySumTemplate = eSumTempl;
00105
00106 }
00107
00109 void L1GtEnergySumCondition::setGtPSB(const L1GlobalTriggerPSB* ptrPSB) {
00110
00111 m_gtPSB = ptrPSB;
00112
00113 }
00114
00115
00116 const bool L1GtEnergySumCondition::evaluateCondition() const {
00117
00118
00119
00120 int iCondition = 0;
00121
00122
00123
00124 bool condResult = false;
00125
00126
00127
00128 SingleCombInCond objectsInComb;
00129
00130
00131 (*m_combinationsInCond).clear();
00132
00133
00134 objectsInComb.clear();
00135
00136
00137
00138 unsigned int candEt = 0;
00139 unsigned int candPhi = 0;
00140 bool candOverflow = false;
00141
00142 switch ((m_gtEnergySumTemplate->objectType())[0]) {
00143 case ETT: {
00144 const L1GctEtTotal* cand1 = m_gtPSB->getCandL1ETT();
00145
00146 if (cand1 == 0) {
00147 return false;
00148 }
00149
00150 candEt = cand1->et();
00151 candOverflow = cand1->overFlow();
00152
00153 break;
00154 }
00155 case ETM: {
00156 const L1GctEtMiss* cand2 = m_gtPSB->getCandL1ETM();
00157
00158 if (cand2 == 0) {
00159 return false;
00160 }
00161
00162 candEt = cand2->et();
00163 candPhi = cand2->phi();
00164 candOverflow = cand2->overFlow();
00165
00166 break;
00167 }
00168 case HTT: {
00169 const L1GctEtHad* cand3 = m_gtPSB->getCandL1HTT();
00170
00171 if (cand3 == 0) {
00172 return false;
00173 }
00174
00175 candEt = cand3->et();
00176 candOverflow = cand3->overFlow();
00177
00178 break;
00179 }
00180 case HTM: {
00181 const L1GctHtMiss* cand4 = m_gtPSB->getCandL1HTM();
00182
00183 if (cand4 == 0) {
00184 return false;
00185 }
00186
00187 candEt = cand4->et();
00188 candPhi = cand4->phi();
00189 candOverflow = cand4->overFlow();
00190
00191 break;
00192 }
00193 default: {
00194
00195 return false;
00196
00197 break;
00198 }
00199 }
00200
00201 const L1GtEnergySumTemplate::ObjectParameter objPar =
00202 ( *(m_gtEnergySumTemplate->objectParameter()) )[iCondition];
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 bool condGEqVal = m_gtEnergySumTemplate->condGEq();
00215
00216 if (condGEqVal) {
00217 if (!candOverflow) {
00218 if (!checkThreshold(objPar.etThreshold, candEt, condGEqVal)) {
00219 return false;
00220 }
00221 }
00222 } else {
00223 if (candOverflow) {
00224 return false;
00225 } else {
00226 if (!checkThreshold(objPar.etThreshold, candEt, condGEqVal)) {
00227 return false;
00228 }
00229 }
00230
00231 }
00232
00233
00234
00235
00236 if (!candOverflow) {
00237 if ( ( m_gtEnergySumTemplate->objectType() )[0] == ETM) {
00238
00239
00240 if (candPhi < 64) {
00241 if (!checkBit(objPar.phiRange0Word, candPhi)) {
00242
00243 return false;
00244 }
00245 } else {
00246 if (!checkBit(objPar.phiRange1Word, candPhi - 64)) {
00247
00248 return false;
00249 }
00250 }
00251
00252 } else if ( ( m_gtEnergySumTemplate->objectType() )[0] == HTM) {
00253
00254
00255 if (candPhi < 64) {
00256 if (!checkBit(objPar.phiRange0Word, candPhi)) {
00257
00258 return false;
00259 }
00260 } else {
00261 if (!checkBit(objPar.phiRange1Word, candPhi - 64)) {
00262
00263 return false;
00264 }
00265 }
00266 }
00267 }
00268
00269
00270
00271 int indexObj = 0;
00272
00273 objectsInComb.push_back(indexObj);
00274 (*m_combinationsInCond).push_back(objectsInComb);
00275
00276
00277
00278
00279 condResult = true;
00280 return condResult;
00281
00282 }
00283
00284 void L1GtEnergySumCondition::print(std::ostream& myCout) const {
00285
00286 m_gtEnergySumTemplate->print(myCout);
00287 L1GtConditionEvaluation::print(myCout);
00288
00289 }
00290