50 const int ifMuEtaNumberBits) :
54 m_ifMuEtaNumberBits(ifMuEtaNumberBits)
99 m_gtMuonTemplate = muonTempl;
113 const int& ifMuEtaNumberBitsValue) {
115 m_ifMuEtaNumberBits = ifMuEtaNumberBitsValue;
121 const int& corrParDeltaPhiNrBins) {
123 m_corrParDeltaPhiNrBins = corrParDeltaPhiNrBins;
135 int nObjInCond = m_gtMuonTemplate->nrObjects();
141 int useBx = bxEval + m_gtMuonTemplate->condRelativeBx();
144 if( ( useBx < candVec->getFirstBX() ) ||
149 int numberObjects = candVec->
size(useBx);
152 if (numberObjects < nObjInCond) {
156 std::vector<int>
index(numberObjects);
158 for (
int i = 0;
i < numberObjects; ++
i) {
162 int numberForFactorial = numberObjects - nObjInCond;
166 for(
int i=numberForFactorial;
i>0;
i-- ) myfactorial *=
i;
169 int jump = myfactorial;
177 bool condResult =
false;
182 objectsInComb.reserve(nObjInCond);
185 combinationsInCond().clear();
196 objectsInComb.clear();
198 bool tmpResult =
true;
200 bool passCondition =
false;
202 for (
int i = 0;
i < nObjInCond;
i++) {
204 passCondition = checkObjectParameter(
i, *(candVec->
at(useBx,index[
i]) ));
205 tmpResult &= passCondition;
207 LogDebug(
"L1TGlobal") <<
"===> MuCondition::evaluateCondition, CONGRATS!! This muon passed the condition." << std::endl;
209 LogDebug(
"L1TGlobal") <<
"===> MuCondition::evaluateCondition, FAIL!! This muon failed the condition." << std::endl;
210 objectsInComb.push_back(index[i]);
225 *(m_gtMuonTemplate->correlationParameter());
231 if ((chargeCorr & 1) == 0) {
234 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Checking Charge Correlation" << std::endl;
236 for (
int i = 0;
i < nObjInCond;
i++) {
238 int chargeValid = (candVec->
at(useBx,index[
i]))->hwChargeValid();
239 tmpResult &= chargeValid;
241 if ( chargeValid==0) {
247 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Charge Correlation Failed...No Valid Charges" << std::endl;
252 if( nObjInCond > 1 ){
255 bool equalSigns =
true;
256 for (
int i = 0;
i < nObjInCond-1;
i++) {
257 if ((candVec->
at(useBx,index[
i]))->hwCharge() != (candVec->
at(useBx,index[i+1]))->hwCharge()) {
264 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: Checking Charge Correlation equalSigns = " << equalSigns << std::endl;
267 if (nObjInCond == 2 || nObjInCond == 3) {
268 if( !( ((chargeCorr & 2)!=0 && equalSigns) || ((chargeCorr & 4)!=0 && !equalSigns) ) ){
269 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: 2/3 Muon Fail Charge Correlation Condition =" << chargeCorr << std::endl;
273 else if (nObjInCond == 4) {
275 unsigned int posCount = 0;
277 for (
int i = 0;
i < nObjInCond;
i++) {
278 if ((candVec->
at(useBx,index[
i]))->hwCharge()> 0) {
283 if( !( ((chargeCorr & 2)!=0 && equalSigns) || ((chargeCorr & 4)!=0 && posCount==2) ) ){
284 LogDebug(
"L1TGlobal") <<
"===> MuCondition:: 4 Muon Fail Charge Correlation Condition = " << chargeCorr <<
" posCnt " << posCount << std::endl;
292 if (m_gtMuonTemplate->wsc()) {
297 const int ObjInWscComb = 2;
298 if (nObjInCond != ObjInWscComb) {
301 <<
"number of particles in condition with spatial correlation = " << nObjInCond
302 <<
"\n it must be = " << ObjInWscComb << std::endl;
310 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaEta" << std::endl;
315 if( !checkRangeDeltaPhi( (candVec->
at(useBx,0))->hwPhi(), (candVec->
at(useBx,1))->hwPhi(),
317 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaPhi" << std::endl;
328 (combinationsInCond()).push_back(objectsInComb);
330 }
while (std::next_permutation(index.begin(), index.end()) );
344 return (m_gtGTL->getCandL1Mu())->at(bx,indexCand);
359 int nObjInCond = m_gtMuonTemplate->nrObjects();
361 if (iCondition >= nObjInCond || iCondition < 0) {
371 ( *(m_gtMuonTemplate->objectParameter()) )[iCondition];
399 <<
"\n MuonTemplate::ObjectParameter : " << std::hex
402 <<
"\n\t requestIso = 0x " << objPar.
requestIso
403 <<
"\n\t enableIso = 0x " << objPar.
enableIso
404 <<
"\n\t etaRange = 0x " << objPar.
etaRange
405 <<
"\n\t phiLow = 0x " << objPar.
phiLow
406 <<
"\n\t phiHigh = 0x " << objPar.
phiHigh
411 <<
"\n\t charge = 0x " << objPar.
charge
412 <<
"\n\t qualityLUT = 0x " << objPar.
qualityLUT
414 <<
"\n\t enableMip = 0x " << objPar.
enableMip
419 <<
"\n\t hwPt = 0x " << cand.
hwPt()
420 <<
"\n\t hwEta = 0x " << cand.
hwEta()
421 <<
"\n\t hwPhi = 0x " << cand.
hwPhi()
422 <<
"\n\t hwCharge = 0x " << cand.
hwCharge()
423 <<
"\n\t hwQual = 0x " << cand.
hwQual()
429 LogDebug(
"L1TGlobal") <<
"\t\t Muon Failed checkThreshold " << std::endl;
436 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(eta)" << std::endl;
442 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
449 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed charge requirement" << std::endl;
459 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwQual = " << cand.
hwQual() << std::endl;
464 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed quality requirement" << std::endl;
471 if( cand.
hwIso()>4 ){
472 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwIso = " << cand.
hwIso() << std::endl;
477 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed isolation requirement" << std::endl;
518 m_gtMuonTemplate->print(myCout);
520 myCout <<
" Number of bits for eta of muon objects = "
521 << m_ifMuEtaNumberBits << std::endl;
522 myCout <<
" Maximum number of bins for the delta phi scales = "
523 << m_corrParDeltaPhiNrBins <<
"\n " << std::endl;
unsigned int isolationLUT
unsigned int phiWindow2Upper
void setGtGTL(const GlobalBoard *)
set the pointer to GTL
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
unsigned int ptHighThreshold
void print(std::ostream &myCout) const
print condition
const bool checkObjectParameter(const int iCondition, const l1t::Muon &cand) const
function to check a single object if it matches a condition
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 phiWindow2Lower
const bool evaluateCondition(const int bxEval) const
the core function to check if the condition matches
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 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 *)
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