52 const GtBoard* ptrGTL,
const int nrL1Mu,
53 const int ifMuEtaNumberBits) :
57 m_ifMuEtaNumberBits(ifMuEtaNumberBits)
102 m_gtMuonTemplate = muonTempl;
116 const int& ifMuEtaNumberBitsValue) {
118 m_ifMuEtaNumberBits = ifMuEtaNumberBitsValue;
124 const int& corrParDeltaPhiNrBins) {
126 m_corrParDeltaPhiNrBins = corrParDeltaPhiNrBins;
138 int nObjInCond = m_gtMuonTemplate->nrObjects();
144 int useBx = bxEval + m_gtMuonTemplate->condRelativeBx();
147 if( ( useBx < candVec->getFirstBX() ) ||
152 int numberObjects = candVec->
size(useBx);
155 if (numberObjects < nObjInCond) {
159 std::vector<int>
index(numberObjects);
161 for (
int i = 0;
i < numberObjects; ++
i) {
165 int numberForFactorial = numberObjects - nObjInCond;
169 for(
int i=numberForFactorial;
i>0;
i-- ) myfactorial *=
i;
172 int jump = myfactorial;
180 bool condResult =
false;
185 objectsInComb.reserve(nObjInCond);
188 combinationsInCond().clear();
199 objectsInComb.clear();
201 bool tmpResult =
true;
203 bool passCondition =
false;
205 for (
int i = 0;
i < nObjInCond;
i++) {
207 passCondition = checkObjectParameter(
i, *(candVec->
at(useBx,index[
i]) ));
208 tmpResult &= passCondition;
210 LogDebug(
"l1t|Global") <<
"===> MuCondition::evaluateCondition, CONGRATS!! This muon passed the condition." << std::endl;
212 LogDebug(
"l1t|Global") <<
"===> MuCondition::evaluateCondition, FAIL!! This muon failed the condition." << std::endl;
213 objectsInComb.push_back(index[i]);
228 *(m_gtMuonTemplate->correlationParameter());
234 if ((chargeCorr & 1) == 0) {
236 for (
int i = 0;
i < nObjInCond;
i++) {
238 int chargeValid = (candVec->
at(useBx,index[
i]))->hwChargeValid();
239 tmpResult &= chargeValid;
241 if ( chargeValid==0) {
251 if( nObjInCond > 1 ){
254 bool equalSigns =
true;
255 for (
int i = 0;
i < nObjInCond-1;
i++) {
256 if ((candVec->
at(useBx,index[
i]))->charge() != (candVec->
at(useBx,index[i+1]))->charge()) {
263 if (nObjInCond == 2 || nObjInCond == 3) {
264 if( !( ((chargeCorr & 2)!=0 && equalSigns) || ((chargeCorr & 4)!=0 && !equalSigns) ) ){
268 else if (nObjInCond == 4) {
270 unsigned int posCount = 0;
272 for (
int i = 0;
i < nObjInCond;
i++) {
273 if ((candVec->
at(useBx,index[
i]))->charge()> 0) {
278 if( !( ((chargeCorr & 2)!=0 && equalSigns) || ((chargeCorr & 4)!=0 && posCount==2) ) ){
286 if (m_gtMuonTemplate->wsc()) {
291 const int ObjInWscComb = 2;
292 if (nObjInCond != ObjInWscComb) {
295 <<
"number of particles in condition with spatial correlation = " << nObjInCond
296 <<
"\n it must be = " << ObjInWscComb << std::endl;
304 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate failed checkRangeDeltaEta" << std::endl;
309 if( !checkRangeDeltaPhi( (candVec->
at(useBx,0))->hwPhi(), (candVec->
at(useBx,1))->hwPhi(),
311 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate failed checkRangeDeltaPhi" << std::endl;
322 (combinationsInCond()).push_back(objectsInComb);
324 }
while (std::next_permutation(index.begin(), index.end()) );
338 return (m_gtGTL->getCandL1Mu())->
at(bx,indexCand);
353 int nObjInCond = m_gtMuonTemplate->nrObjects();
355 if (iCondition >= nObjInCond || iCondition < 0) {
365 ( *(m_gtMuonTemplate->objectParameter()) )[iCondition];
393 <<
"\n MuonTemplate::ObjectParameter : "
397 <<
"\n\t enableIso = " << objPar.
enableIso
398 <<
"\n\t etaRange = " << objPar.
etaRange
399 <<
"\n\t phiLow = " << objPar.
phiLow
400 <<
"\n\t phiHigh = " << objPar.
phiHigh
405 <<
"\n\t charge = " << objPar.
charge
408 <<
"\n\t enableMip = " << objPar.
enableMip
413 <<
"\n\t hwPt = " << cand.
hwPt()
414 <<
"\n\t hwEta = " << cand.
hwEta()
415 <<
"\n\t hwPhi = " << cand.
hwPhi()
416 <<
"\n\t hwCharge = " << cand.
hwCharge()
417 <<
"\n\t hwQual = " << cand.
hwQual()
418 <<
"\n\t hwIso = " << cand.
hwIso()
423 if ( !checkThreshold(objPar.
ptLowThreshold, cand.
hwPt(), m_gtMuonTemplate->condGEq()) ) {
424 LogDebug(
"l1t|Global") <<
"\t\t Muon Failed checkThreshold " << std::endl;
432 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate failed checkRange(eta)" << std::endl;
438 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
445 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate failed charge requirement" << std::endl;
455 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate has out of range hwQual = " << cand.
hwQual() << std::endl;
460 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate failed quality requirement" << std::endl;
467 if( cand.
hwIso()>4 ){
468 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate has out of range hwIso = " << cand.
hwIso() << std::endl;
473 LogDebug(
"l1t|Global") <<
"\t\t l1t::Candidate failed isolation requirement" << std::endl;
514 m_gtMuonTemplate->print(myCout);
516 myCout <<
" Number of bits for eta of muon objects = "
517 << m_ifMuEtaNumberBits << std::endl;
518 myCout <<
" Maximum number of bins for the delta phi scales = "
519 << m_corrParDeltaPhiNrBins <<
"\n " << std::endl;
unsigned int isolationLUT
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
unsigned int phiWindowVetoLower
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 long long etaRange
unsigned int phiWindowLower
unsigned int m_corrParDeltaPhiNrBins
unsigned int deltaPhiRangeLower
unsigned int phiWindowUpper
void setGtIfMuEtaNumberBits(const int &)
unsigned int deltaPhiRangeUpper
unsigned int etaWindowVetoLower
void setGtGTL(const GtBoard *)
set the pointer to GTL
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 *)
int m_condMaxNumberObjects
const l1t::Muon * getCandidate(const int bx, const int indexCand) const
load muon candidates
unsigned int etaWindowUpper
unsigned int etaWindowLower
unsigned int chargeCorrelation
MuCondition & operator=(const MuCondition &)
const GtBoard * gtGTL() const
get / set the pointer to GTL
unsigned int deltaEtaRangeUpper
const T & at(int bx, unsigned i) const