1 #ifndef L1Trigger_L1TGlobal_ConditionEvaluation_h 2 #define L1Trigger_L1TGlobal_ConditionEvaluation_h 82 virtual void print(std::ostream& myCout)
const;
92 template <
class Type1,
class Type2>
94 const Type1& thresholdH,
96 bool condGEqValue)
const;
103 template <
class Type1,
class Type2>
105 const Type1& thresholdH,
107 bool condGEqValue)
const;
110 template <
class Type1>
111 const bool checkIndex(
const Type1& indexLo,
const Type1& indexHi,
const unsigned int index)
const;
114 template <
class Type1>
120 template <
class Type1>
122 const std::vector<Type1>& windows,
123 const unsigned int nEtaBits)
const;
126 template <
class Type1>
128 const Type1& W1beginR,
130 const Type1& W2beginR,
131 const Type1& W2endR)
const;
134 template <
class Type1>
136 const unsigned int obj2Eta,
139 const unsigned int nEtaBits)
const;
142 template <
class Type1>
144 const unsigned int obj2Phi,
146 const Type1& upperR)
const;
149 template <
class Type1>
171 template <
class Type1,
class Type2>
173 const Type1& thresholdH,
175 const bool condGEqValue)
const {
177 LogTrace(
"L1GlobalTrigger") <<
" checkThreshold check for condGEqValue = " << condGEqValue
178 <<
"\n hex: " << std::hex <<
"threshold = " << thresholdL <<
" - " << thresholdH
179 <<
" value = " <<
value <<
"\n dec: " <<
std::dec <<
"threshold = " << thresholdL
180 <<
" - " << thresholdH <<
" value = " <<
value << std::endl;
184 if (
value >= (Type2)thresholdL && (Type1)
value < thresholdH) {
194 if (
value == (Type2)thresholdL) {
210 template <
class Type1,
class Type2>
212 const Type1& thresholdH,
214 const bool condGEqValue)
const {
216 LogTrace(
"L1GlobalTrigger") <<
" checkUnconstrainedPt check for condGEqValue = " << condGEqValue
217 <<
"\n hex: " << std::hex <<
"threshold = " << thresholdL <<
" - " << thresholdH
218 <<
" value = " <<
value <<
"\n dec: " <<
std::dec <<
"threshold = " << thresholdL
219 <<
" - " << thresholdH <<
" value = " <<
value << std::endl;
224 if (
value >= (Type2)thresholdL && (Type1)
value <= thresholdH) {
229 if (
value == (Type2)thresholdL) {
239 template <
class Type1>
241 const Type1& indexHi,
242 const unsigned int index)
const {
243 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 244 <<
"\n\t indexLo = " << indexLo <<
"\n\t indexHi = " << indexHi <<
"\n\t index = " <<
index 248 if (indexLo > indexHi) {
259 template <
class Type1>
265 LogTrace(
"L1GlobalTrigger") <<
" checkBit " 266 <<
"\n Bit number = " <<
bitNumber <<
" larger than maximum allowed " 267 <<
sizeof(oneBit) * 8 << std::endl;
281 return (
mask & oneBit);
287 template <
class Type1>
289 const std::vector<Type1>& windows,
290 const unsigned int nEtaBits)
const {
291 if (windows.empty()) {
295 for (
const auto&
window : windows) {
300 const bool cond1 = ((diff1 >> nEtaBits) & 1) ?
false :
true;
301 const bool cond2 = ((diff2 >> nEtaBits) & 1) ?
false :
true;
302 const bool cond3 = ((diff3 >> nEtaBits) & 1) ?
false :
true;
307 bool passWindow =
false;
308 if (cond1 && (cond2 && cond3))
310 else if (!cond1 && (cond2 || cond3))
315 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 316 <<
"\n\t bitNumber = " <<
bitNumber <<
"\n\t window.lower = " <<
window.lower
317 <<
"\n\t window.upper = " <<
window.upper <<
"\n\t diff1 = " << diff1
318 <<
"\n\t cond1 = " << cond1 <<
"\n\t diff2 = " << diff2 <<
"\n\t cond2 = " << cond2
319 <<
"\n\t diff3 = " << diff3 <<
"\n\t cond3 = " << cond3
320 <<
"\n\t passWindow = " << passWindow << std::endl;
331 template <
class Type1>
333 const Type1& W1beginR,
335 const Type1& W2beginR,
336 const Type1& W2endR)
const {
338 if (W1beginR == W1endR && W1beginR == (Type1)-1) {
342 int W1diff1 = W1endR - W1beginR;
346 bool W1cond1 = (W1diff1 < 0) ?
false :
true;
347 bool W1cond2 = (W1diff2 < 0) ?
false :
true;
348 bool W1cond3 = (W1diff3 < 0) ?
false :
true;
353 bool passWindow1 =
false;
354 if (W1cond1 && (W1cond2 && W1cond3))
356 else if (!W1cond1 && (W1cond2 || W1cond3))
362 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 363 <<
"\n\t bitNumber = " <<
bitNumber <<
"\n\t W1beginR = " << W1beginR
364 <<
"\n\t W1endR = " << W1endR <<
"\n\t W1diff1 = " << W1diff1
365 <<
"\n\t W1cond1 = " << W1cond1 <<
"\n\t W1diff2 = " << W1diff2
366 <<
"\n\t W1cond2 = " << W1cond2 <<
"\n\t W1diff3 = " << W1diff3
367 <<
"\n\t W1cond3 = " << W1cond3 << std::endl;
369 if (W2beginR == W2endR && W2beginR == (Type1)-1) {
373 int W2diff1 = W2endR - W2beginR;
377 bool W2cond1 = (W2diff1 < 0) ?
false :
true;
378 bool W2cond2 = (W2diff2 < 0) ?
false :
true;
379 bool W2cond3 = (W2diff3 < 0) ?
false :
true;
384 bool passWindow2 =
false;
385 if (W2cond1 && (W2cond2 && W2cond3))
387 else if (!W2cond1 && (W2cond2 || W2cond3))
393 if (passWindow1 || passWindow2) {
400 template <
class Type1>
402 const unsigned int obj2Eta,
405 const unsigned int nEtaBits)
const {
411 unsigned int compare = obj1Eta - obj2Eta;
414 unsigned int larger, smaller;
423 unsigned int diff = ((larger + ((~smaller + 1) & 255)) & 255);
425 unsigned int diff1 = upperR - lowerR;
426 unsigned int diff2 =
diff - lowerR;
427 unsigned int diff3 = upperR -
diff;
429 bool cond1 = ((diff1 >> nEtaBits) & 1) ?
false :
true;
430 bool cond2 = ((diff2 >> nEtaBits) & 1) ?
false :
true;
431 bool cond3 = ((diff3 >> nEtaBits) & 1) ?
false :
true;
433 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 434 <<
"\n\t obj1Eta = " << obj1Eta <<
"\n\t obj2Eta = " << obj2Eta <<
"\n\t lowerR = " << lowerR
435 <<
"\n\t upperR = " << upperR <<
"\n\t compare = " <<
compare <<
"\n\t cond = " <<
cond 436 <<
"\n\t diff = " <<
diff <<
"\n\t diff1 = " << diff1 <<
"\n\t cond1 = " << cond1
437 <<
"\n\t diff2 = " << diff2 <<
"\n\t cond2 = " << cond2 <<
"\n\t diff3 = " << diff3
438 <<
"\n\t cond3 = " << cond3 << std::endl;
440 if (cond1 && (cond2 && cond3))
442 else if (!cond1 && (cond2 || cond3))
449 template <
class Type1>
451 const unsigned int obj2Phi,
453 const Type1& upperR)
const {
458 int diff1 = upperR - lowerR;
462 bool cond1 = (diff1 < 0) ?
false :
true;
463 bool cond2 = (diff2 < 0) ?
false :
true;
464 bool cond3 = (diff3 < 0) ?
false :
true;
466 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 467 <<
"\n\t obj1Phi = " << obj1Phi <<
"\n\t obj2Phi = " << obj2Phi
468 <<
"\n\t deltaPhi = " <<
deltaPhi <<
"\n\t lowerR = " << lowerR <<
"\n\t upperR = " << upperR
469 <<
"\n\t diff1 = " << diff1 <<
"\n\t cond1 = " << cond1 <<
"\n\t diff2 = " << diff2
470 <<
"\n\t cond2 = " << cond2 <<
"\n\t diff3 = " << diff3 <<
"\n\t cond3 = " << cond3
476 if (cond1 && (cond2 && cond3))
478 else if (!cond1 && (cond2 || cond3))
485 template <
class Type1>
487 const std::vector<Type1>& windows)
const {
488 if (windows.empty()) {
492 for (
const auto&
window : windows) {
495 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 496 <<
"\n\t window.lower = " <<
window.lower <<
"\n\t window.upper = " <<
window.upper
497 <<
"Passed TfMuonIndex window" << std::endl;
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
void evaluateConditionStoreResult(const int bxEval)
call evaluateCondition and save last result
const bool checkBit(const Type1 &mask, const unsigned int bitNumber) const
check if a bit with a given number is set in a mask
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
void setCondMaxNumberObjects(int condMaxNumberObjectsValue)
void setVerbosity(const int verbosity)
const bool checkThreshold(const Type1 &thresholdL, const Type1 &thresholdH, const Type2 &value, bool condGEqValue) const
ConditionEvaluation()
constructor
bool condLastResult() const
get the latest result for the condition
virtual std::string getNumericExpression() const
get numeric expression
Abs< T >::type abs(const T &t)
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
virtual ~ConditionEvaluation()
destructor
const bool checkIndex(const Type1 &indexLo, const Type1 &indexHi, const unsigned int index) const
check if a index is in a given range
virtual void print(std::ostream &myCout) const
print condition
int m_verbosity
verbosity level
unsigned long long uint64_t
bool m_condLastResult
the last result of evaluateCondition()
int condMaxNumberObjects() const
const bool checkRangeEta(const unsigned int bitNumber, const std::vector< Type1 > &windows, const unsigned int nEtaBits) const
virtual const bool evaluateCondition(const int bxEval) const =0
the core function to check if the condition matches
int m_condMaxNumberObjects
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
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
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
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition