CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1t::MuCondition Class Reference

#include <MuCondition.h>

Inheritance diagram for l1t::MuCondition:
l1t::ConditionEvaluation

Public Member Functions

const bool evaluateCondition (const int bxEval) const override
 the core function to check if the condition matches More...
 
const int gtCorrParDeltaPhiNrBins () const
 get / set maximum number of bins for the delta phi scales More...
 
const GlobalBoardgtGTL () const
 get / set the pointer to GTL More...
 
const int gtIfMuEtaNumberBits () const
 get / set the number of bits for eta of muon objects More...
 
const MuonTemplategtMuonTemplate () const
 get / set the pointer to a Condition More...
 
 MuCondition ()
 
 MuCondition (const GlobalCondition *, const GlobalBoard *, const int nrL1Mu, const int ifMuEtaNumberBits)
 from base template condition (from event setup usually) More...
 
 MuCondition (const MuCondition &)
 
MuConditionoperator= (const MuCondition &)
 
void print (std::ostream &myCout) const override
 print condition More...
 
void setGtCorrParDeltaPhiNrBins (const int &)
 
void setGtGTL (const GlobalBoard *)
 set the pointer to GTL More...
 
void setGtIfMuEtaNumberBits (const int &)
 
void setGtMuonTemplate (const MuonTemplate *)
 
 ~MuCondition () override
 
- Public Member Functions inherited from l1t::ConditionEvaluation
 ConditionEvaluation ()
 constructor More...
 
bool condLastResult () const
 get the latest result for the condition More...
 
int condMaxNumberObjects () const
 
void evaluateConditionStoreResult (const int bxEval)
 call evaluateCondition and save last result More...
 
CombinationsInCond const & getCombinationsInCond () const
 get all the object combinations evaluated to true in the condition More...
 
virtual std::string getNumericExpression () const
 get numeric expression More...
 
void setCondMaxNumberObjects (int condMaxNumberObjectsValue)
 
void setVerbosity (const int verbosity)
 
virtual ~ConditionEvaluation ()
 destructor More...
 

Private Member Functions

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 More...
 
void copy (const MuCondition &cp)
 copy function for copy constructor and operator= More...
 
const l1t::MuongetCandidate (const int bx, const int indexCand) const
 load muon candidates More...
 

Private Attributes

unsigned int m_corrParDeltaPhiNrBins
 
const GlobalBoardm_gtGTL
 pointer to GTL, to be able to get the trigger objects More...
 
const MuonTemplatem_gtMuonTemplate
 pointer to a MuonTemplate More...
 
int m_ifMuEtaNumberBits
 number of bits for eta of muon objects More...
 

Additional Inherited Members

- Protected Member Functions inherited from l1t::ConditionEvaluation
template<class Type1 >
const bool checkBit (const Type1 &mask, const unsigned int bitNumber) const
 check if a bit with a given number is set in a mask More...
 
template<class Type1 , class Type2 >
const bool checkCut (const Type1 &cutL, const Type2 &value, bool condGEqValue) const
 
template<class Type1 >
const bool checkIndex (const Type1 &indexLo, const Type1 &indexHi, const unsigned int index) const
 check if a index is in a given range More...
 
template<class Type1 >
const bool checkRangeDeltaEta (const unsigned int obj1Eta, const unsigned int obj2Eta, const Type1 &lowerR, const Type1 &upperR, const unsigned int nEtaBits) const
 check if a value is in a given deltaEta range More...
 
template<class Type1 >
const bool checkRangeDeltaPhi (const unsigned int obj1Phi, const unsigned int obj2Phi, const Type1 &lowerR, const Type1 &upperR) const
 check if a value is in a given deltaPhi range More...
 
template<class Type1 >
const bool checkRangeEta (const unsigned int bitNumber, const std::vector< Type1 > &windows, const unsigned int nEtaBits) const
 
template<class Type1 >
const bool checkRangePhi (const unsigned int bitNumber, const Type1 &W1beginR, const Type1 &W1endR, const Type1 &W2beginR, const Type1 &W2endR) const
 check if a value is in a given phi range and outside of a veto range More...
 
template<class Type1 >
const bool checkRangeTfMuonIndex (const unsigned int bitNumber, const std::vector< Type1 > &windows) const
 check if a value is in a given muon track finder index range More...
 
template<class Type1 , class Type2 >
const bool checkThreshold (const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
 
template<class Type1 , class Type2 >
const bool checkUnconstrainedPt (const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
 
CombinationsInCondcombinationsInCond () const
 get all the object combinations (to fill it...) More...
 
- Protected Attributes inherited from l1t::ConditionEvaluation
CombinationsInCond m_combinationsInCond
 store all the object combinations evaluated to true in the condition More...
 
bool m_condLastResult
 the last result of evaluateCondition() More...
 
int m_condMaxNumberObjects
 
int m_verbosity
 verbosity level More...
 

Detailed Description

Definition at line 37 of file MuCondition.h.

Constructor & Destructor Documentation

◆ MuCondition() [1/3]

MuCondition::MuCondition ( )

constructors default

Definition at line 41 of file MuCondition.cc.

42  // empty
43 }

◆ MuCondition() [2/3]

MuCondition::MuCondition ( const GlobalCondition muonTemplate,
const GlobalBoard ptrGTL,
const int  nrL1Mu,
const int  ifMuEtaNumberBits 
)

from base template condition (from event setup usually)

Definition at line 46 of file MuCondition.cc.

References l1t::ConditionEvaluation::m_condMaxNumberObjects, and m_corrParDeltaPhiNrBins.

51  m_gtMuonTemplate(static_cast<const MuonTemplate*>(muonTemplate)),
52  m_gtGTL(ptrGTL),
53  m_ifMuEtaNumberBits(ifMuEtaNumberBits) {
55  m_condMaxNumberObjects = nrL1Mu;
56 }
const GlobalBoard * m_gtGTL
pointer to GTL, to be able to get the trigger objects
Definition: MuCondition.h:98
int m_ifMuEtaNumberBits
number of bits for eta of muon objects
Definition: MuCondition.h:101
unsigned int m_corrParDeltaPhiNrBins
Definition: MuCondition.h:104
const MuonTemplate * m_gtMuonTemplate
pointer to a MuonTemplate
Definition: MuCondition.h:95

◆ MuCondition() [3/3]

MuCondition::MuCondition ( const MuCondition cp)

Definition at line 73 of file MuCondition.cc.

References copy().

73 : ConditionEvaluation() { copy(cp); }
void copy(const MuCondition &cp)
copy function for copy constructor and operator=
Definition: MuCondition.cc:59

◆ ~MuCondition()

MuCondition::~MuCondition ( )
override

Definition at line 76 of file MuCondition.cc.

76  {
77  // empty
78 }

Member Function Documentation

◆ checkObjectParameter()

const bool MuCondition::checkObjectParameter ( const int  iCondition,
const l1t::Muon cand,
const unsigned int  index 
) const
private

function to check a single object if it matches a condition

checkObjectParameter - Compare a single particle with a numbered condition.

Parameters
iConditionThe number of the condition.
candThe candidate to compare.
Returns
The result of the comparison (false if a condition does not exist).

Definition at line 328 of file MuCondition.cc.

References MuonTemplate::ObjectParameter::charge, TauDecayModes::dec, MuonTemplate::ObjectParameter::enableIso, MuonTemplate::ObjectParameter::enableMip, MuonTemplate::ObjectParameter::etaRange, MuonTemplate::ObjectParameter::etaWindows, MuonTemplate::ObjectParameter::impactParameterLUT, MuonTemplate::ObjectParameter::indexHigh, MuonTemplate::ObjectParameter::indexLow, MuonTemplate::ObjectParameter::isolationLUT, LogDebug, MuonTemplate::ObjectParameter::phiHigh, MuonTemplate::ObjectParameter::phiLow, MuonTemplate::ObjectParameter::phiWindow1Lower, MuonTemplate::ObjectParameter::phiWindow1Upper, MuonTemplate::ObjectParameter::phiWindow2Lower, MuonTemplate::ObjectParameter::phiWindow2Upper, MuonTemplate::ObjectParameter::ptHighThreshold, MuonTemplate::ObjectParameter::ptLowThreshold, MuonTemplate::ObjectParameter::qualityLUT, MuonTemplate::ObjectParameter::requestIso, MuonTemplate::ObjectParameter::tfMuonIndexWindows, MuonTemplate::ObjectParameter::unconstrainedPtHigh, and MuonTemplate::ObjectParameter::unconstrainedPtLow.

330  {
331  // number of objects in condition
332  int nObjInCond = m_gtMuonTemplate->nrObjects();
333 
334  if (iCondition >= nObjInCond || iCondition < 0) {
335  return false;
336  }
337 
338  // // empty candidates can not be compared
339  // if (cand.empty()) {
340  // return false;
341  // }
342 
343  const MuonTemplate::ObjectParameter objPar = (*(m_gtMuonTemplate->objectParameter()))[iCondition];
344 
345  // using the logic table from GTL-9U-module.pdf
346  // "Truth table for Isolation bit"
347 
348  // check thresholds:
349 
350  // value < low pt threshold
351  // fail trigger
352 
353  // low pt threshold <= value < high pt threshold & non-isolated muon:
354  // requestIso true: fail trigger
355  // requestIso false, enableIso true: fail trigger
356  // requestIso false, enableIso false: OK, trigger
357 
358  // low pt threshold <= value < high pt threshold & isolated muon:
359  // requestIso true: OK, trigger
360  // requestIso false, enableIso true: OK, trigger
361  // requestIso false, enableIso false: OK, trigger
362 
363  // value >= high pt threshold & non-isolated muon:
364  // requestIso true: fail trigger
365  // requestIso false: OK, trigger
366 
367  // value >= high pt threshold & isolated muon:
368  // OK, trigger
369 
370  LogDebug("L1TGlobal") << "\n MuonTemplate::ObjectParameter : " << std::hex << "\n\t ptHighThreshold = 0x "
371  << objPar.ptHighThreshold << "\n\t ptLowThreshold = 0x " << objPar.ptLowThreshold
372  << "\n\t indexHigh = 0x " << objPar.indexHigh << "\n\t indexLow = 0x "
373  << objPar.indexLow << "\n\t requestIso = 0x " << objPar.requestIso
374  << "\n\t enableIso = 0x " << objPar.enableIso << "\n\t etaRange = 0x "
375  << objPar.etaRange << "\n\t phiLow = 0x " << objPar.phiLow
376  << "\n\t phiHigh = 0x " << objPar.phiHigh << "\n\t phiWindow1Lower = 0x "
377  << objPar.phiWindow1Lower << "\n\t phiWindow1Upper = 0x " << objPar.phiWindow1Upper
378  << "\n\t phiWindow2Lower = 0x " << objPar.phiWindow2Lower << "\n\t phiWindow2Lower = 0x "
379  << objPar.phiWindow2Lower << "\n\t charge = 0x " << objPar.charge
380  << "\n\t qualityLUT = 0x " << objPar.qualityLUT << "\n\t isolationLUT = 0x "
381  << objPar.isolationLUT << "\n\t enableMip = 0x " << objPar.enableMip << std::endl;
382 
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()
387  << std::dec << std::endl;
388 
389  if (objPar.unconstrainedPtHigh > 0) // Rick Cavanaugh: Check if unconstrained pT cut-window is valid
390  {
392  objPar.unconstrainedPtHigh,
393  cand.hwPtUnconstrained(),
395  LogDebug("L1TGlobal") << "\t\t Muon Failed unconstrainedPt checkThreshold; iCondition = " << iCondition
396  << std::endl;
397  return false;
398  }
399  }
400  if (objPar.impactParameterLUT !=
401  0) // Rick Cavanaugh: Check if impact parameter LUT is valid. 0xF is default; 0x0 is invalid
402  {
403  // check impact parameter ( bit check ) with impact parameter LUT
404  // sanity check on candidate impact parameter
405  if (cand.hwDXY() > 3) {
406  LogDebug("L1TGlobal") << "\t\t l1t::Candidate has out of range hwDXY = " << cand.hwDXY() << std::endl;
407  return false;
408  }
409  bool passImpactParameterLUT = ((objPar.impactParameterLUT >> cand.hwDXY()) & 1);
410  if (!passImpactParameterLUT) {
411  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed impact parameter requirement" << std::endl;
412  return false;
413  }
414  }
415 
416  if (!checkThreshold(objPar.ptLowThreshold, objPar.ptHighThreshold, cand.hwPt(), m_gtMuonTemplate->condGEq())) {
417  LogDebug("L1TGlobal") << "\t\t Muon Failed checkThreshold " << std::endl;
418  return false;
419  }
420 
421  // check index
422  if (!checkIndex(objPar.indexLow, objPar.indexHigh, index)) {
423  LogDebug("L1TGlobal") << "\t\t Muon Failed checkIndex " << std::endl;
424  return false;
425  }
426 
427  // check eta
428  if (!checkRangeEta(cand.hwEtaAtVtx(), objPar.etaWindows, 8)) {
429  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed checkRangeEta" << std::endl;
430  return false;
431  }
432 
433  // check phi
434  if (!checkRangePhi(cand.hwPhiAtVtx(),
435  objPar.phiWindow1Lower,
436  objPar.phiWindow1Upper,
437  objPar.phiWindow2Lower,
438  objPar.phiWindow2Upper)) {
439  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
440  return false;
441  }
442 
443  // check charge
444  if (objPar.charge >= 0) {
445  if (cand.hwCharge() != objPar.charge) {
446  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed charge requirement" << std::endl;
447  return false;
448  }
449  }
450 
451  // check quality ( bit check ) with quality LUT
452  // sanity check on candidate quality
453  if (cand.hwQual() > 16) {
454  LogDebug("L1TGlobal") << "\t\t l1t::Candidate has out of range hwQual = " << cand.hwQual() << std::endl;
455  return false;
456  }
457  bool passQualLUT = ((objPar.qualityLUT >> cand.hwQual()) & 1);
458  if (!passQualLUT) {
459  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed quality requirement" << std::endl;
460  return false;
461  }
462 
463  // check isolation ( bit check ) with isolation LUT
464  // sanity check on candidate isolation
465  if (cand.hwIso() > 4) {
466  LogDebug("L1TGlobal") << "\t\t l1t::Candidate has out of range hwIso = " << cand.hwIso() << std::endl;
467  return false;
468  }
469  bool passIsoLUT = ((objPar.isolationLUT >> cand.hwIso()) & 1);
470  if (!passIsoLUT) {
471  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed isolation requirement" << std::endl;
472  return false;
473  }
474 
475  // check muon TF index
476  if (!checkRangeTfMuonIndex(cand.tfMuonIndex(), objPar.tfMuonIndexWindows)) {
477  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed checkRangeTfMuonIndex" << std::endl;
478  return false;
479  }
480 
481  // A number of values is required to trigger (at least one).
482  // "Don't care" means that all values are allowed.
483  // Qual = 000 means then NO MUON (GTL module)
484 
485  // if (cand.hwQual() == 0) {
486  // LogDebug("L1TGlobal") << "\t\t Muon Failed hwQual() == 0" << std::endl;
487  // return false;
488  // }
489 
490  // if (objPar.qualityRange == 0) {
491  // LogDebug("L1TGlobal") << "\t\t Muon Failed qualityRange == 0" << std::endl;
492  // return false;
493  // }
494  // else {
495  // if (!checkBit(objPar.qualityRange, cand.hwQual())) {
496  // LogDebug("L1TGlobal") << "\t\t Muon Failed checkBit(qualityRange) " << std::endl;
497  // return false;
498  // }
499  // }
500 
501  // check mip
502  if (objPar.enableMip) {
503  // if (!cand.hwMip()) {
504  // LogDebug("L1TGlobal") << "\t\t Muon Failed enableMip" << std::endl;
505  // return false;
506  // }
507  }
508 
509  // particle matches if we get here
510  //LogTrace("L1TGlobal")
511  // << " checkObjectParameter: muon object OK, passes all requirements\n" << std::endl;
512 
513  return true;
514 }
const bool checkUnconstrainedPt(const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
const bool checkRangePhi(const unsigned int bitNumber, const Type1 &W1beginR, const Type1 &W1endR, const Type1 &W2beginR, const Type1 &W2endR) const
check if a value is in a given phi range and outside of a veto range
const bool checkThreshold(const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
const bool condGEq() const
get / set condition GEq flag
unsigned long long etaRange
Definition: MuonTemplate.h:79
const MuonTemplate * m_gtMuonTemplate
pointer to a MuonTemplate
Definition: MuCondition.h:95
const bool checkIndex(const Type1 &indexLo, const Type1 &indexHi, const unsigned int index) const
check if a index is in a given range
const std::vector< ObjectParameter > * objectParameter() const
Definition: MuonTemplate.h:119
const bool checkRangeEta(const unsigned int bitNumber, const std::vector< Type1 > &windows, const unsigned int nEtaBits) const
std::vector< Window > etaWindows
Definition: MuonTemplate.h:85
const int nrObjects() const
get number of trigger objects
std::vector< Window > tfMuonIndexWindows
Definition: MuonTemplate.h:92
const bool checkRangeTfMuonIndex(const unsigned int bitNumber, const std::vector< Type1 > &windows) const
check if a value is in a given muon track finder index range
#define LogDebug(id)

◆ copy()

void MuCondition::copy ( const MuCondition cp)
private

copy function for copy constructor and operator=

Definition at line 59 of file MuCondition.cc.

Referenced by MuCondition().

59  {
60  m_gtMuonTemplate = cp.gtMuonTemplate();
61  m_gtGTL = cp.gtGTL();
62 
63  m_ifMuEtaNumberBits = cp.gtIfMuEtaNumberBits();
64  m_corrParDeltaPhiNrBins = cp.m_corrParDeltaPhiNrBins;
65 
66  m_condMaxNumberObjects = cp.condMaxNumberObjects();
67  m_condLastResult = cp.condLastResult();
68  m_combinationsInCond = cp.getCombinationsInCond();
69 
70  m_verbosity = cp.m_verbosity;
71 }
const GlobalBoard * m_gtGTL
pointer to GTL, to be able to get the trigger objects
Definition: MuCondition.h:98
int m_ifMuEtaNumberBits
number of bits for eta of muon objects
Definition: MuCondition.h:101
unsigned int m_corrParDeltaPhiNrBins
Definition: MuCondition.h:104
const MuonTemplate * m_gtMuonTemplate
pointer to a MuonTemplate
Definition: MuCondition.h:95
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
int m_verbosity
verbosity level
bool m_condLastResult
the last result of evaluateCondition()

◆ evaluateCondition()

const bool MuCondition::evaluateCondition ( const int  bxEval) const
overridevirtual

the core function to check if the condition matches

Implements l1t::ConditionEvaluation.

Definition at line 103 of file MuCondition.cc.

References BXVector< T >::at(), MuonTemplate::CorrelationParameter::chargeCorrelation, MuonTemplate::CorrelationParameter::deltaEtaRangeLower, MuonTemplate::CorrelationParameter::deltaEtaRangeUpper, MuonTemplate::CorrelationParameter::deltaPhiRangeLower, MuonTemplate::CorrelationParameter::deltaPhiRangeUpper, BXVector< T >::getLastBX(), l1trig_cff::hwCharge, l1trig_cff::hwChargeValid, l1trig_cff::hwEtaAtVtx, l1trig_cff::hwPhiAtVtx, mps_fire::i, LogDebug, push_back(), and BXVector< T >::size().

103  {
104  // BLW Need to pass this as an argument
105  //const int bxEval=0; //BLW Change for BXVector
106 
107  // number of trigger objects in the condition
108  int nObjInCond = m_gtMuonTemplate->nrObjects();
109 
110  // the candidates
111  const BXVector<const l1t::Muon*>* candVec = m_gtGTL->getCandL1Mu(); //BLW Change for BXVector
112 
113  // Look at objects in bx = bx + relativeBx
114  int useBx = bxEval + m_gtMuonTemplate->condRelativeBx();
115 
116  // Fail condition if attempting to get Bx outside of range
117  if ((useBx < candVec->getFirstBX()) || (useBx > candVec->getLastBX())) {
118  return false;
119  }
120 
121  int numberObjects = candVec->size(useBx); //BLW Change for BXVector
122  //LogTrace("L1TGlobal") << " numberObjects: " << numberObjects
123  // << std::endl;
124  if (numberObjects < nObjInCond) {
125  return false;
126  }
127 
128  std::vector<int> index(numberObjects);
129 
130  for (int i = 0; i < numberObjects; ++i) {
131  index[i] = i;
132  }
133 
134  int numberForFactorial = numberObjects - nObjInCond;
135 
136  // TEMPORARY FIX UNTIL IMPLEMENT NEW MUON CONDITIONS
137  int myfactorial = 1;
138  for (int i = numberForFactorial; i > 0; i--)
139  myfactorial *= i;
140 
141  int jumpIndex = 1;
142  int jump = myfactorial; //factorial(numberObjects - nObjInCond);
143 
144  // condition result condResult set to true if at least one permutation
145  // passes all requirements
146  // all possible permutations are checked
147  bool condResult = false;
148 
149  // store the indices of the muon objects
150  // from the combination evaluated in the condition
151  SingleCombInCond objectsInComb;
152  objectsInComb.reserve(nObjInCond);
153 
154  // clear the m_combinationsInCond vector
155  combinationsInCond().clear();
156 
157  do {
158  if (--jumpIndex)
159  continue;
160 
161  jumpIndex = jump;
162 
163  // clear the indices in the combination
164  objectsInComb.clear();
165 
166  bool tmpResult = true;
167 
168  bool passCondition = false;
169  // check if there is a permutation that matches object-parameter requirements
170  for (int i = 0; i < nObjInCond; i++) {
171  passCondition = checkObjectParameter(i, *(candVec->at(useBx, index[i])), index[i]); //BLW Change for BXVector
172  tmpResult &= passCondition;
173  if (passCondition)
174  LogDebug("L1TGlobal") << "===> MuCondition::evaluateCondition, CONGRATS!! This muon passed the condition."
175  << std::endl;
176  else
177  LogDebug("L1TGlobal") << "===> MuCondition::evaluateCondition, FAIL!! This muon failed the condition."
178  << std::endl;
179  objectsInComb.push_back(index[i]);
180  }
181 
182  // if permutation does not match particle conditions
183  // skip charge correlation and spatial correlations
184  if (!tmpResult) {
185  continue;
186  }
187 
188  // get the correlation parameters (chargeCorrelation included here also)
190 
191  // charge_correlation consists of 3 relevant bits (D2, D1, D0)
192  unsigned int chargeCorr = corrPar.chargeCorrelation;
193 
194  // charge ignore bit (D0) not set?
195  if ((chargeCorr & 1) == 0) {
196  LogDebug("L1TGlobal") << "===> MuCondition:: Checking Charge Correlation" << std::endl;
197 
198  for (int i = 0; i < nObjInCond; i++) {
199  // check valid charge - skip if invalid charge
200  int chargeValid = (candVec->at(useBx, index[i]))->hwChargeValid(); //BLW Change for BXVector
201  tmpResult &= chargeValid;
202 
203  if (chargeValid == 0) { //BLW type change for New Muon Class
204  continue;
205  }
206  }
207 
208  if (!tmpResult) {
209  LogDebug("L1TGlobal") << "===> MuCondition:: Charge Correlation Failed...No Valid Charges" << std::endl;
210  continue;
211  }
212 
213  if (nObjInCond > 1) { // more objects condition
214 
215  // find out if signs are equal
216  bool equalSigns = true;
217  for (int i = 0; i < nObjInCond - 1; i++) {
218  if ((candVec->at(useBx, index[i]))->hwCharge() !=
219  (candVec->at(useBx, index[i + 1]))->hwCharge()) { //BLW Change for BXVector
220  equalSigns = false;
221  break;
222  }
223  }
224 
225  LogDebug("L1TGlobal") << "===> MuCondition:: Checking Charge Correlation equalSigns = " << equalSigns
226  << std::endl;
227 
228  // two or three particle condition
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
232  << std::endl;
233  continue;
234  }
235  } else if (nObjInCond == 4) {
236  //counter to count positive charges to determine if there are pairs
237  unsigned int posCount = 0;
238 
239  for (int i = 0; i < nObjInCond; i++) {
240  if ((candVec->at(useBx, index[i]))->hwCharge() > 0) { //BLW Change for BXVector
241  posCount++;
242  }
243  }
244 
245  // Original OS 4 muon condition (disagreement with firmware):
246  // if (!(((chargeCorr & 2) != 0 && equalSigns) || ((chargeCorr & 4) != 0 && posCount == 2))) {
247  // Fix by R. Cavanaugh:
248  // Note that negative charge => hwCharge = 0
249  // positive charge => hwCharge = 1
250  // Hence: (0,0,0,0) => (posCount = 0) => 4 SS muons
251  // (1,0,0,0) => (posCount = 1) => 1 OS muon pair, 1 SS muon pair
252  // (1,1,0,0) => (posCount = 2) => 2 OS muon pairs
253  // (1,0,1,0) => (posCount = 2) => 2 OS muon pairs
254  // (0,0,1,1) => (posCount = 2) => 2 OS muon pairs
255  // (1,1,1,0) => (posCount = 3) => 1 SS muon pair, 1 OS muon pair
256  // (1,1,1,1) => (posCount = 4) => 4 SS muons
257  // A requirement (posCount == 2) implies there must be exactly 2 OS pairs of muons
258  // A requirement of at least 1 pair of OS muons implies condition should be (posCount > 0 && posCount < 4)
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;
262  continue;
263  }
264  }
265  } // end require nObjInCond > 1
266  } // end signchecks
267 
268  if (m_gtMuonTemplate->wsc()) {
269  // wsc requirements have always nObjInCond = 2
270  // one can use directly index[0] and index[1] to compute
271  // eta and phi differences
272  const int ObjInWscComb = 2;
273  if (nObjInCond != ObjInWscComb) {
274  edm::LogError("L1TGlobal") << "\n Error: "
275  << "number of particles in condition with spatial correlation = " << nObjInCond
276  << "\n it must be = " << ObjInWscComb << std::endl;
277  // TODO Perhaps I should throw here an exception,
278  // since something is really wrong if nObjInCond != ObjInWscComb (=2)
279  continue;
280  }
281 
282  // check delta eta
283  if (!checkRangeDeltaEta((candVec->at(useBx, 0))->hwEtaAtVtx(),
284  (candVec->at(useBx, 1))->hwEtaAtVtx(),
285  corrPar.deltaEtaRangeLower,
286  corrPar.deltaEtaRangeUpper,
287  8)) {
288  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed checkRangeDeltaEta" << std::endl;
289  continue;
290  }
291 
292  // check delta phi
293  if (!checkRangeDeltaPhi((candVec->at(useBx, 0))->hwPhiAtVtx(),
294  (candVec->at(useBx, 1))->hwPhiAtVtx(),
295  corrPar.deltaPhiRangeLower,
296  corrPar.deltaPhiRangeUpper)) {
297  LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed checkRangeDeltaPhi" << std::endl;
298  continue;
299  }
300 
301  } // end wsc check
302 
303  // if we get here all checks were successfull for this combination
304  // set the general result for evaluateCondition to "true"
305 
306  condResult = true;
307  (combinationsInCond()).push_back(objectsInComb);
308 
309  } while (std::next_permutation(index.begin(), index.end()));
310 
311  return condResult;
312 }
int getLastBX() const
const bool checkRangeDeltaEta(const unsigned int obj1Eta, const unsigned int obj2Eta, const Type1 &lowerR, const Type1 &upperR, const unsigned int nEtaBits) const
check if a value is in a given deltaEta range
const bool wsc() const
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
Definition: MuCondition.cc:328
std::vector< int > SingleCombInCond
typedefs
const GlobalBoard * m_gtGTL
pointer to GTL, to be able to get the trigger objects
Definition: MuCondition.h:98
Log< level::Error, false > LogError
unsigned size(int bx) const
const MuonTemplate * m_gtMuonTemplate
pointer to a MuonTemplate
Definition: MuCondition.h:95
const T & at(int bx, unsigned i) const
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
const BXVector< const l1t::Muon * > * getCandL1Mu() const
return global muon trigger candidate
Definition: GlobalBoard.h:157
const int & condRelativeBx() const
get / set the condition relative bx
const bool checkRangeDeltaPhi(const unsigned int obj1Phi, const unsigned int obj2Phi, const Type1 &lowerR, const Type1 &upperR) const
check if a value is in a given deltaPhi range
const int nrObjects() const
get number of trigger objects
const CorrelationParameter * correlationParameter() const
Definition: MuonTemplate.h:121
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
#define LogDebug(id)

◆ getCandidate()

const l1t::Muon * MuCondition::getCandidate ( const int  bx,
const int  indexCand 
) const
private

load muon candidates

Definition at line 315 of file MuCondition.cc.

References nano_mu_digi_cff::bx.

315  {
316  return (m_gtGTL->getCandL1Mu())->at(bx, indexCand); //BLW Change for BXVector
317 }
const GlobalBoard * m_gtGTL
pointer to GTL, to be able to get the trigger objects
Definition: MuCondition.h:98
const BXVector< const l1t::Muon * > * getCandL1Mu() const
return global muon trigger candidate
Definition: GlobalBoard.h:157

◆ gtCorrParDeltaPhiNrBins()

const int l1t::MuCondition::gtCorrParDeltaPhiNrBins ( ) const
inline

get / set maximum number of bins for the delta phi scales

Definition at line 79 of file MuCondition.h.

References m_corrParDeltaPhiNrBins.

79 { return m_corrParDeltaPhiNrBins; }
unsigned int m_corrParDeltaPhiNrBins
Definition: MuCondition.h:104

◆ gtGTL()

const GlobalBoard* l1t::MuCondition::gtGTL ( ) const
inline

get / set the pointer to GTL

Definition at line 69 of file MuCondition.h.

References m_gtGTL.

69 { return m_gtGTL; }
const GlobalBoard * m_gtGTL
pointer to GTL, to be able to get the trigger objects
Definition: MuCondition.h:98

◆ gtIfMuEtaNumberBits()

const int l1t::MuCondition::gtIfMuEtaNumberBits ( ) const
inline

get / set the number of bits for eta of muon objects

Definition at line 74 of file MuCondition.h.

References m_ifMuEtaNumberBits.

74 { return m_ifMuEtaNumberBits; }
int m_ifMuEtaNumberBits
number of bits for eta of muon objects
Definition: MuCondition.h:101

◆ gtMuonTemplate()

const MuonTemplate* l1t::MuCondition::gtMuonTemplate ( ) const
inline

get / set the pointer to a Condition

Definition at line 64 of file MuCondition.h.

References m_gtMuonTemplate.

64 { return m_gtMuonTemplate; }
const MuonTemplate * m_gtMuonTemplate
pointer to a MuonTemplate
Definition: MuCondition.h:95

◆ operator=()

l1t::MuCondition & MuCondition::operator= ( const MuCondition cp)

Definition at line 81 of file MuCondition.cc.

References filterCSVwithJSON::copy.

81  {
82  copy(cp);
83  return *this;
84 }
void copy(const MuCondition &cp)
copy function for copy constructor and operator=
Definition: MuCondition.cc:59

◆ print()

void MuCondition::print ( std::ostream &  myCout) const
overridevirtual

print condition

Reimplemented from l1t::ConditionEvaluation.

Definition at line 516 of file MuCondition.cc.

References l1t::ConditionEvaluation::print().

Referenced by l1t::CorrCondition::evaluateCondition(), l1t::CorrThreeBodyCondition::evaluateCondition(), l1t::CorrWithOverlapRemovalCondition::evaluateCondition(), and l1t::GlobalBoard::runGTL().

516  {
517  m_gtMuonTemplate->print(myCout);
518 
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;
521 
523 }
void print(std::ostream &myCout) const override
print the condition
Definition: MuonTemplate.cc:71
int m_ifMuEtaNumberBits
number of bits for eta of muon objects
Definition: MuCondition.h:101
unsigned int m_corrParDeltaPhiNrBins
Definition: MuCondition.h:104
const MuonTemplate * m_gtMuonTemplate
pointer to a MuonTemplate
Definition: MuCondition.h:95
virtual void print(std::ostream &myCout) const
print condition

◆ setGtCorrParDeltaPhiNrBins()

void MuCondition::setGtCorrParDeltaPhiNrBins ( const int &  corrParDeltaPhiNrBins)

Definition at line 98 of file MuCondition.cc.

98  {
99  m_corrParDeltaPhiNrBins = corrParDeltaPhiNrBins;
100 }
unsigned int m_corrParDeltaPhiNrBins
Definition: MuCondition.h:104

◆ setGtGTL()

void MuCondition::setGtGTL ( const GlobalBoard ptrGTL)

set the pointer to GTL

Definition at line 90 of file MuCondition.cc.

90 { m_gtGTL = ptrGTL; }
const GlobalBoard * m_gtGTL
pointer to GTL, to be able to get the trigger objects
Definition: MuCondition.h:98

◆ setGtIfMuEtaNumberBits()

void MuCondition::setGtIfMuEtaNumberBits ( const int &  ifMuEtaNumberBitsValue)

Definition at line 93 of file MuCondition.cc.

93  {
94  m_ifMuEtaNumberBits = ifMuEtaNumberBitsValue;
95 }
int m_ifMuEtaNumberBits
number of bits for eta of muon objects
Definition: MuCondition.h:101

◆ setGtMuonTemplate()

void MuCondition::setGtMuonTemplate ( const MuonTemplate muonTempl)

Definition at line 87 of file MuCondition.cc.

87 { m_gtMuonTemplate = muonTempl; }
const MuonTemplate * m_gtMuonTemplate
pointer to a MuonTemplate
Definition: MuCondition.h:95

Member Data Documentation

◆ m_corrParDeltaPhiNrBins

unsigned int l1t::MuCondition::m_corrParDeltaPhiNrBins
private

Definition at line 104 of file MuCondition.h.

Referenced by gtCorrParDeltaPhiNrBins(), and MuCondition().

◆ m_gtGTL

const GlobalBoard* l1t::MuCondition::m_gtGTL
private

pointer to GTL, to be able to get the trigger objects

Definition at line 98 of file MuCondition.h.

Referenced by gtGTL().

◆ m_gtMuonTemplate

const MuonTemplate* l1t::MuCondition::m_gtMuonTemplate
private

pointer to a MuonTemplate

Definition at line 95 of file MuCondition.h.

Referenced by gtMuonTemplate().

◆ m_ifMuEtaNumberBits

int l1t::MuCondition::m_ifMuEtaNumberBits
private

number of bits for eta of muon objects

Definition at line 101 of file MuCondition.h.

Referenced by gtIfMuEtaNumberBits().