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;
147 bool condResult =
false;
152 objectsInComb.reserve(nObjInCond);
155 combinationsInCond().clear();
164 objectsInComb.clear();
166 bool tmpResult =
true;
168 bool passCondition =
false;
170 for (
int i = 0;
i < nObjInCond;
i++) {
171 passCondition = checkObjectParameter(
i, *(candVec->
at(useBx,
index[
i])),
index[
i]);
172 tmpResult &= passCondition;
174 LogDebug(
"L1TGlobal") <<
"===> MuCondition::evaluateCondition, CONGRATS!! This muon passed the condition." 177 LogDebug(
"L1TGlobal") <<
"===> MuCondition::evaluateCondition, FAIL!! This muon failed the condition." 179 objectsInComb.push_back(
index[
i]);
195 if ((chargeCorr & 1) == 0) {
196 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Checking Charge Correlation" << std::endl;
198 for (
int i = 0;
i < nObjInCond;
i++) {
201 tmpResult &= chargeValid;
203 if (chargeValid == 0) {
209 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Charge Correlation Failed...No Valid Charges" << std::endl;
213 if (nObjInCond > 1) {
216 bool equalSigns =
true;
217 for (
int i = 0;
i < nObjInCond - 1;
i++) {
225 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Checking Charge Correlation equalSigns = " << equalSigns
229 if (nObjInCond == 2 || nObjInCond == 3) {
230 if (!(((chargeCorr & 2) != 0 && equalSigns) || ((chargeCorr & 4) != 0 && !equalSigns))) {
231 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: 2/3 Muon Fail Charge Correlation Condition =" << chargeCorr
235 }
else if (nObjInCond == 4) {
237 unsigned int posCount = 0;
239 for (
int i = 0;
i < nObjInCond;
i++) {
259 if (!(((chargeCorr & 2) != 0 && equalSigns) || ((chargeCorr & 4) != 0 && (posCount > 0 && posCount < 4)))) {
260 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: 4 Muon Fail Charge Correlation Condition = " << chargeCorr
261 <<
" posCnt " << posCount << std::endl;
268 if (m_gtMuonTemplate->wsc()) {
272 const int ObjInWscComb = 2;
273 if (nObjInCond != ObjInWscComb) {
275 <<
"number of particles in condition with spatial correlation = " << nObjInCond
276 <<
"\n it must be = " << ObjInWscComb << std::endl;
283 if (!checkRangeDeltaEta((candVec->
at(useBx, 0))->
hwEtaAtVtx(),
288 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaEta" << std::endl;
293 if (!checkRangeDeltaPhi((candVec->
at(useBx, 0))->
hwPhiAtVtx(),
297 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaPhi" << std::endl;
307 (combinationsInCond()).
push_back(objectsInComb);
309 }
while (std::next_permutation(
index.begin(),
index.end()));
316 return (m_gtGTL->getCandL1Mu())->at(
bx, indexCand);
330 const unsigned int index)
const {
332 int nObjInCond = m_gtMuonTemplate->nrObjects();
334 if (iCondition >= nObjInCond || iCondition < 0) {
370 LogDebug(
"L1TGlobal") <<
"\n MuonTemplate::ObjectParameter : " << std::hex <<
"\n\t ptHighThreshold = 0x " 372 <<
"\n\t indexHigh = 0x " << objPar.
indexHigh <<
"\n\t indexLow = 0x " 374 <<
"\n\t enableIso = 0x " << objPar.
enableIso <<
"\n\t etaRange = 0x " 376 <<
"\n\t phiHigh = 0x " << objPar.
phiHigh <<
"\n\t phiWindow1Lower = 0x " 378 <<
"\n\t phiWindow2Lower = 0x " << objPar.
phiWindow2Lower <<
"\n\t phiWindow2Lower = 0x " 380 <<
"\n\t qualityLUT = 0x " << objPar.
qualityLUT <<
"\n\t isolationLUT = 0x " 383 LogDebug(
"L1TGlobal") <<
"\n l1t::Muon : " 384 <<
"\n\t hwPt = 0x " <<
cand.hwPt() <<
"\n\t hwEtaAtVtx = 0x " <<
cand.hwEtaAtVtx()
385 <<
"\n\t hwPhiAtVtx = 0x " <<
cand.hwPhiAtVtx() <<
"\n\t hwCharge = 0x " <<
cand.hwCharge()
386 <<
"\n\t hwQual = 0x " <<
cand.hwQual() <<
"\n\t hwIso = 0x " <<
cand.hwIso()
393 cand.hwPtUnconstrained(),
394 m_gtMuonTemplate->condGEq())) {
395 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed unconstrainedPt checkThreshold; iCondition = " << iCondition
405 if (
cand.hwDXY() > 3) {
406 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwDXY = " <<
cand.hwDXY() << std::endl;
410 if (!passImpactParameterLUT) {
411 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed impact parameter requirement" << std::endl;
417 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed checkThreshold " << std::endl;
423 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed checkIndex " << std::endl;
429 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeEta" << std::endl;
434 if (!checkRangePhi(
cand.hwPhiAtVtx(),
439 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
446 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed charge requirement" << std::endl;
453 if (
cand.hwQual() > 16) {
454 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwQual = " <<
cand.hwQual() << std::endl;
459 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed quality requirement" << std::endl;
465 if (
cand.hwIso() > 4) {
466 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwIso = " <<
cand.hwIso() << std::endl;
471 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed isolation requirement" << std::endl;
477 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeTfMuonIndex" << std::endl;
517 m_gtMuonTemplate->print(myCout);
519 myCout <<
" Number of bits for eta of muon objects = " << m_ifMuEtaNumberBits << std::endl;
520 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 int deltaEtaRangeLower
void print(std::ostream &myCout) const override
print condition
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 ptHighThreshold
std::vector< int > SingleCombInCond
typedefs
unsigned int impactParameterLUT
Log< level::Error, false > LogError
unsigned int phiWindow2Lower
const l1t::Muon * getCandidate(const int bx, const int indexCand) const
load muon candidates
unsigned int ptLowThreshold
unsigned size(int bx) const
unsigned int phiWindow1Lower
unsigned long long etaRange
unsigned int unconstrainedPtLow
unsigned int m_corrParDeltaPhiNrBins
unsigned int deltaPhiRangeLower
void setGtIfMuEtaNumberBits(const int &)
unsigned int deltaPhiRangeUpper
unsigned int phiWindow1Upper
const T & at(int bx, unsigned i) const
virtual void print(std::ostream &myCout) const
print condition
void setGtCorrParDeltaPhiNrBins(const int &)
void copy(const MuCondition &cp)
copy function for copy constructor and operator=
void setGtMuonTemplate(const MuonTemplate *)
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
const bool evaluateCondition(const int bxEval) const override
the core function to check if the condition matches
int m_condMaxNumberObjects
std::vector< Window > etaWindows
std::vector< Window > tfMuonIndexWindows
unsigned int chargeCorrelation
MuCondition & operator=(const MuCondition &)
unsigned int deltaEtaRangeUpper