49 const int ifMuEtaNumberBits)
53 m_ifMuEtaNumberBits(ifMuEtaNumberBits) {
60 m_gtMuonTemplate =
cp.gtMuonTemplate();
63 m_ifMuEtaNumberBits =
cp.gtIfMuEtaNumberBits();
64 m_corrParDeltaPhiNrBins =
cp.m_corrParDeltaPhiNrBins;
66 m_condMaxNumberObjects =
cp.condMaxNumberObjects();
67 m_condLastResult =
cp.condLastResult();
68 m_combinationsInCond =
cp.getCombinationsInCond();
70 m_verbosity =
cp.m_verbosity;
94 m_ifMuEtaNumberBits = ifMuEtaNumberBitsValue;
99 m_corrParDeltaPhiNrBins = corrParDeltaPhiNrBins;
108 int nObjInCond = m_gtMuonTemplate->nrObjects();
114 int useBx = bxEval + m_gtMuonTemplate->condRelativeBx();
117 if ((useBx < candVec->getFirstBX()) || (useBx > candVec->
getLastBX())) {
121 int numberObjects = candVec->
size(useBx);
124 if (numberObjects < nObjInCond) {
128 std::vector<int>
index(numberObjects);
130 for (
int i = 0;
i < numberObjects; ++
i) {
134 int numberForFactorial = numberObjects - nObjInCond;
138 for (
int i = numberForFactorial;
i > 0;
i--)
142 int jump = myfactorial;
150 bool condResult =
false;
155 objectsInComb.reserve(nObjInCond);
158 combinationsInCond().clear();
168 objectsInComb.clear();
170 bool tmpResult =
true;
172 bool passCondition =
false;
174 for (
int i = 0;
i < nObjInCond;
i++) {
175 passCondition = checkObjectParameter(
i, *(candVec->
at(useBx,
index[
i])),
index[
i]);
176 tmpResult &= passCondition;
178 LogDebug(
"L1TGlobal") <<
"===> MuCondition::evaluateCondition, CONGRATS!! This muon passed the condition."
181 LogDebug(
"L1TGlobal") <<
"===> MuCondition::evaluateCondition, FAIL!! This muon failed the condition."
183 objectsInComb.push_back(
index[
i]);
199 if ((chargeCorr & 1) == 0) {
200 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Checking Charge Correlation" << std::endl;
202 for (
int i = 0;
i < nObjInCond;
i++) {
204 int chargeValid = (candVec->
at(useBx,
index[
i]))->hwChargeValid();
205 tmpResult &= chargeValid;
207 if (chargeValid == 0) {
213 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Charge Correlation Failed...No Valid Charges" << std::endl;
217 if (nObjInCond > 1) {
220 bool equalSigns =
true;
221 for (
int i = 0;
i < nObjInCond - 1;
i++) {
222 if ((candVec->
at(useBx,
index[
i]))->hwCharge() !=
223 (candVec->
at(useBx,
index[
i + 1]))->hwCharge()) {
229 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Checking Charge Correlation equalSigns = " << equalSigns
233 if (nObjInCond == 2 || nObjInCond == 3) {
234 if (!(((chargeCorr & 2) != 0 && equalSigns) || ((chargeCorr & 4) != 0 && !equalSigns))) {
235 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: 2/3 Muon Fail Charge Correlation Condition =" << chargeCorr
239 }
else if (nObjInCond == 4) {
241 unsigned int posCount = 0;
243 for (
int i = 0;
i < nObjInCond;
i++) {
244 if ((candVec->
at(useBx,
index[
i]))->hwCharge() > 0) {
263 if (!(((chargeCorr & 2) != 0 && equalSigns) || ((chargeCorr & 4) != 0 && (posCount > 0 && posCount < 4)))) {
264 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: 4 Muon Fail Charge Correlation Condition = " << chargeCorr
265 <<
" posCnt " << posCount << std::endl;
272 if (m_gtMuonTemplate->wsc()) {
276 const int ObjInWscComb = 2;
277 if (nObjInCond != ObjInWscComb) {
279 <<
"number of particles in condition with spatial correlation = " << nObjInCond
280 <<
"\n it must be = " << ObjInWscComb << std::endl;
287 if (!checkRangeDeltaEta((candVec->
at(useBx, 0))->hwEtaAtVtx(),
288 (candVec->
at(useBx, 1))->hwEtaAtVtx(),
292 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaEta" << std::endl;
297 if (!checkRangeDeltaPhi((candVec->
at(useBx, 0))->hwPhiAtVtx(),
298 (candVec->
at(useBx, 1))->hwPhiAtVtx(),
301 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaPhi" << std::endl;
312 (combinationsInCond()).push_back(objectsInComb);
314 }
while (std::next_permutation(
index.begin(),
index.end()));
326 return (m_gtGTL->getCandL1Mu())->at(
bx, indexCand);
340 const unsigned int index)
const {
342 int nObjInCond = m_gtMuonTemplate->nrObjects();
344 if (iCondition >= nObjInCond || iCondition < 0) {
380 LogDebug(
"L1TGlobal") <<
"\n MuonTemplate::ObjectParameter : " << std::hex <<
"\n\t ptHighThreshold = 0x "
382 <<
"\n\t indexHigh = 0x " << objPar.
indexHigh <<
"\n\t indexLow = 0x "
384 <<
"\n\t enableIso = 0x " << objPar.
enableIso <<
"\n\t etaRange = 0x "
386 <<
"\n\t phiHigh = 0x " << objPar.
phiHigh <<
"\n\t phiWindow1Lower = 0x "
388 <<
"\n\t phiWindow2Lower = 0x " << objPar.
phiWindow2Lower <<
"\n\t phiWindow2Lower = 0x "
390 <<
"\n\t qualityLUT = 0x " << objPar.
qualityLUT <<
"\n\t isolationLUT = 0x "
393 LogDebug(
"L1TGlobal") <<
"\n l1t::Muon : "
394 <<
"\n\t hwPt = 0x " <<
cand.hwPt() <<
"\n\t hwEtaAtVtx = 0x " <<
cand.hwEtaAtVtx()
395 <<
"\n\t hwPhiAtVtx = 0x " <<
cand.hwPhiAtVtx() <<
"\n\t hwCharge = 0x " <<
cand.hwCharge()
396 <<
"\n\t hwQual = 0x " <<
cand.hwQual() <<
"\n\t hwIso = 0x " <<
cand.hwIso()
403 cand.hwPtUnconstrained(),
404 m_gtMuonTemplate->condGEq())) {
405 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed unconstrainedPt checkThreshold; iCondition = " << iCondition
415 if (
cand.hwDXY() > 3) {
416 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwDXY = " <<
cand.hwDXY() << std::endl;
420 if (!passImpactParameterLUT) {
421 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed impact parameter requirement" << std::endl;
427 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed checkThreshold " << std::endl;
433 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed checkIndex " << std::endl;
438 if (!checkRangeEta(
cand.hwEtaAtVtx(),
444 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(eta)" << std::endl;
449 if (!checkRangePhi(
cand.hwPhiAtVtx(),
454 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
461 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed charge requirement" << std::endl;
468 if (
cand.hwQual() > 16) {
469 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwQual = " <<
cand.hwQual() << std::endl;
474 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed quality requirement" << std::endl;
480 if (
cand.hwIso() > 4) {
481 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwIso = " <<
cand.hwIso() << std::endl;
486 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed isolation requirement" << std::endl;
526 m_gtMuonTemplate->print(myCout);
528 myCout <<
" Number of bits for eta of muon objects = " << m_ifMuEtaNumberBits << std::endl;
529 myCout <<
" Maximum number of bins for the delta phi scales = " << m_corrParDeltaPhiNrBins <<
"\n " << std::endl;