49 const int ifMuEtaNumberBits)
53 m_ifMuEtaNumberBits(ifMuEtaNumberBits) {
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()
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;
444 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(eta)" << std::endl;
454 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
461 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed charge requirement" << std::endl;
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;
unsigned int isolationLUT
unsigned int phiWindow2Upper
void setGtGTL(const GlobalBoard *)
set the pointer to GTL
unsigned int unconstrainedPtHigh
unsigned size(int bx) const
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition
unsigned int deltaEtaRangeLower
const MuonTemplate * gtMuonTemplate() const
get / set the pointer to a Condition
void print(std::ostream &myCout) const override
print condition
unsigned int ptHighThreshold
virtual void print(std::ostream &myCout) const
print condition
std::vector< int > SingleCombInCond
typedefs
const GlobalBoard * gtGTL() const
get / set the pointer to GTL
unsigned int impactParameterLUT
Log< level::Error, false > LogError
unsigned int phiWindow2Lower
int hwPtUnconstrained() const
unsigned int ptLowThreshold
bool condLastResult() const
get the latest result for the condition
const int gtIfMuEtaNumberBits() const
get / set the number of bits for eta of muon objects
unsigned int etaWindow2Lower
unsigned int phiWindow1Lower
unsigned long long etaRange
unsigned int unconstrainedPtLow
unsigned int m_corrParDeltaPhiNrBins
unsigned int deltaPhiRangeLower
void setGtIfMuEtaNumberBits(const int &)
unsigned int etaWindow2Upper
unsigned int deltaPhiRangeUpper
unsigned int phiWindow1Upper
int m_verbosity
verbosity level
void setGtCorrParDeltaPhiNrBins(const int &)
int condMaxNumberObjects() const
void copy(const MuCondition &cp)
copy function for copy constructor and operator=
void setGtMuonTemplate(const MuonTemplate *)
const bool evaluateCondition(const int bxEval) const override
the core function to check if the condition matches
const bool checkObjectParameter(const int iCondition, const l1t::Muon &cand, const unsigned int index) const
function to check a single object if it matches a condition
unsigned int etaWindow1Lower
int m_condMaxNumberObjects
const l1t::Muon * getCandidate(const int bx, const int indexCand) const
load muon candidates
unsigned int etaWindow1Upper
unsigned int chargeCorrelation
MuCondition & operator=(const MuCondition &)
unsigned int deltaEtaRangeUpper
const T & at(int bx, unsigned i) const