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) {
249 if (!(((chargeCorr & 2) != 0 && equalSigns) || ((chargeCorr & 4) != 0 && posCount == 2))) {
250 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: 4 Muon Fail Charge Correlation Condition = " << chargeCorr
251 <<
" posCnt " << posCount << std::endl;
258 if (m_gtMuonTemplate->wsc()) {
262 const int ObjInWscComb = 2;
263 if (nObjInCond != ObjInWscComb) {
265 <<
"number of particles in condition with spatial correlation = " << nObjInCond
266 <<
"\n it must be = " << ObjInWscComb << std::endl;
273 if (!checkRangeDeltaEta((candVec->
at(useBx, 0))->hwEtaAtVtx(),
274 (candVec->
at(useBx, 1))->hwEtaAtVtx(),
278 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaEta" << std::endl;
283 if (!checkRangeDeltaPhi((candVec->
at(useBx, 0))->hwPhiAtVtx(),
284 (candVec->
at(useBx, 1))->hwPhiAtVtx(),
287 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaPhi" << std::endl;
298 (combinationsInCond()).push_back(objectsInComb);
300 }
while (std::next_permutation(
index.begin(),
index.end()));
312 return (m_gtGTL->getCandL1Mu())->at(
bx, indexCand);
326 const unsigned int index)
const {
328 int nObjInCond = m_gtMuonTemplate->nrObjects();
330 if (iCondition >= nObjInCond || iCondition < 0) {
366 LogDebug(
"L1TGlobal") <<
"\n MuonTemplate::ObjectParameter : " << std::hex <<
"\n\t ptHighThreshold = 0x "
368 <<
"\n\t indexHigh = 0x " << objPar.
indexHigh <<
"\n\t indexLow = 0x "
370 <<
"\n\t enableIso = 0x " << objPar.
enableIso <<
"\n\t etaRange = 0x "
372 <<
"\n\t phiHigh = 0x " << objPar.
phiHigh <<
"\n\t phiWindow1Lower = 0x "
374 <<
"\n\t phiWindow2Lower = 0x " << objPar.
phiWindow2Lower <<
"\n\t phiWindow2Lower = 0x "
376 <<
"\n\t qualityLUT = 0x " << objPar.
qualityLUT <<
"\n\t isolationLUT = 0x "
379 LogDebug(
"L1TGlobal") <<
"\n l1t::Muon : "
380 <<
"\n\t hwPt = 0x " <<
cand.hwPt() <<
"\n\t hwEtaAtVtx = 0x " <<
cand.hwEtaAtVtx()
381 <<
"\n\t hwPhiAtVtx = 0x " <<
cand.hwPhiAtVtx() <<
"\n\t hwCharge = 0x " <<
cand.hwCharge()
382 <<
"\n\t hwQual = 0x " <<
cand.hwQual() <<
"\n\t hwIso = 0x " <<
cand.hwIso()
389 cand.hwPtUnconstrained(),
390 m_gtMuonTemplate->condGEq())) {
391 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed unconstrainedPt checkThreshold; iCondition = " << iCondition
401 if (
cand.hwDXY() > 3) {
402 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwDXY = " <<
cand.hwDXY() << std::endl;
406 if (!passImpactParameterLUT) {
407 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed impact parameter requirement" << std::endl;
413 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed checkThreshold " << std::endl;
419 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed checkIndex " << std::endl;
424 if (!checkRangeEta(
cand.hwEtaAtVtx(),
430 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(eta)" << std::endl;
435 if (!checkRangePhi(
cand.hwPhiAtVtx(),
440 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
447 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed charge requirement" << std::endl;
454 if (
cand.hwQual() > 16) {
455 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwQual = " <<
cand.hwQual() << std::endl;
460 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed quality requirement" << std::endl;
466 if (
cand.hwIso() > 4) {
467 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwIso = " <<
cand.hwIso() << std::endl;
472 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed isolation requirement" << std::endl;
512 m_gtMuonTemplate->print(myCout);
514 myCout <<
" Number of bits for eta of muon objects = " << m_ifMuEtaNumberBits << std::endl;
515 myCout <<
" Maximum number of bins for the delta phi scales = " << m_corrParDeltaPhiNrBins <<
"\n " << std::endl;