1 #ifndef L1Trigger_L1TGlobal_ConditionEvaluation_h 2 #define L1Trigger_L1TGlobal_ConditionEvaluation_h 84 virtual void print(std::ostream& myCout)
const;
94 template <
class Type1,
class Type2>
96 const Type1& thresholdH,
98 bool condGEqValue)
const;
103 template <
class Type1,
class Type2>
104 const bool checkCut(
const Type1& cutL,
const Type2&
value,
bool condGEqValue)
const;
111 template <
class Type1,
class Type2>
113 const Type1& thresholdH,
115 bool condGEqValue)
const;
118 template <
class Type1>
119 const bool checkIndex(
const Type1& indexLo,
const Type1& indexHi,
const unsigned int index)
const;
122 template <
class Type1>
128 template <
class Type1>
130 const std::vector<Type1>& windows,
131 const unsigned int nEtaBits)
const;
134 template <
class Type1>
136 const Type1& W1beginR,
138 const Type1& W2beginR,
139 const Type1& W2endR)
const;
142 template <
class Type1>
144 const unsigned int obj2Eta,
147 const unsigned int nEtaBits)
const;
150 template <
class Type1>
152 const unsigned int obj2Phi,
154 const Type1& upperR)
const;
157 template <
class Type1>
179 template <
class Type1,
class Type2>
181 const Type1& thresholdH,
183 const bool condGEqValue)
const {
185 LogTrace(
"L1GlobalTrigger") <<
" checkThreshold check for condGEqValue = " << condGEqValue
186 <<
"\n hex: " << std::hex <<
"threshold = " << thresholdL <<
" - " << thresholdH
187 <<
" value = " <<
value <<
"\n dec: " <<
std::dec <<
"threshold = " << thresholdL
188 <<
" - " << thresholdH <<
" value = " <<
value << std::endl;
192 if (
value >= (Type2)thresholdL && (Type1)
value < thresholdH) {
199 if (
value == (Type2)thresholdL) {
210 template <
class Type1,
class Type2>
213 LogTrace(
"L1GlobalTrigger") <<
" checkCut check for condGEqValue = " << condGEqValue <<
"\n hex: " << std::hex
214 <<
"cut = " << cutL <<
" value = " <<
value <<
"\n dec: " <<
std::dec 215 <<
"cut = " << cutL <<
" value = " <<
value << std::endl;
219 if (
value >= (Type2)cutL) {
226 if (
value == (Type2)cutL) {
239 template <
class Type1,
class Type2>
241 const Type1& thresholdH,
243 const bool condGEqValue)
const {
245 LogTrace(
"L1GlobalTrigger") <<
" checkUnconstrainedPt check for condGEqValue = " << condGEqValue
246 <<
"\n hex: " << std::hex <<
"threshold = " << thresholdL <<
" - " << thresholdH
247 <<
" value = " <<
value <<
"\n dec: " <<
std::dec <<
"threshold = " << thresholdL
248 <<
" - " << thresholdH <<
" value = " <<
value << std::endl;
253 if (
value >= (Type2)thresholdL && (Type1)
value <= thresholdH) {
258 if (
value == (Type2)thresholdL) {
268 template <
class Type1>
270 const Type1& indexHi,
271 const unsigned int index)
const {
272 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 273 <<
"\n\t indexLo = " << indexLo <<
"\n\t indexHi = " << indexHi <<
"\n\t index = " <<
index 277 if (indexLo > indexHi) {
288 template <
class Type1>
294 LogTrace(
"L1GlobalTrigger") <<
" checkBit " 295 <<
"\n Bit number = " <<
bitNumber <<
" larger than maximum allowed " 296 <<
sizeof(oneBit) * 8 << std::endl;
310 return (
mask & oneBit);
316 template <
class Type1>
318 const std::vector<Type1>& windows,
319 const unsigned int nEtaBits)
const {
320 if (windows.empty()) {
324 for (
const auto&
window : windows) {
329 const bool cond1 = ((diff1 >> nEtaBits) & 1) ?
false :
true;
330 const bool cond2 = ((diff2 >> nEtaBits) & 1) ?
false :
true;
331 const bool cond3 = ((diff3 >> nEtaBits) & 1) ?
false :
true;
336 bool passWindow =
false;
337 if (cond1 && (cond2 && cond3))
339 else if (!cond1 && (cond2 || cond3))
344 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 345 <<
"\n\t bitNumber = " <<
bitNumber <<
"\n\t window.lower = " <<
window.lower
346 <<
"\n\t window.upper = " <<
window.upper <<
"\n\t diff1 = " << diff1
347 <<
"\n\t cond1 = " << cond1 <<
"\n\t diff2 = " << diff2 <<
"\n\t cond2 = " << cond2
348 <<
"\n\t diff3 = " << diff3 <<
"\n\t cond3 = " << cond3
349 <<
"\n\t passWindow = " << passWindow << std::endl;
360 template <
class Type1>
362 const Type1& W1beginR,
364 const Type1& W2beginR,
365 const Type1& W2endR)
const {
367 if (W1beginR == W1endR && W1beginR == (Type1)-1) {
371 int W1diff1 = W1endR - W1beginR;
375 bool W1cond1 = (W1diff1 < 0) ?
false :
true;
376 bool W1cond2 = (W1diff2 < 0) ?
false :
true;
377 bool W1cond3 = (W1diff3 < 0) ?
false :
true;
382 bool passWindow1 =
false;
383 if (W1cond1 && (W1cond2 && W1cond3))
385 else if (!W1cond1 && (W1cond2 || W1cond3))
391 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 392 <<
"\n\t bitNumber = " <<
bitNumber <<
"\n\t W1beginR = " << W1beginR
393 <<
"\n\t W1endR = " << W1endR <<
"\n\t W1diff1 = " << W1diff1
394 <<
"\n\t W1cond1 = " << W1cond1 <<
"\n\t W1diff2 = " << W1diff2
395 <<
"\n\t W1cond2 = " << W1cond2 <<
"\n\t W1diff3 = " << W1diff3
396 <<
"\n\t W1cond3 = " << W1cond3 << std::endl;
398 if (W2beginR == W2endR && W2beginR == (Type1)-1) {
402 int W2diff1 = W2endR - W2beginR;
406 bool W2cond1 = (W2diff1 < 0) ?
false :
true;
407 bool W2cond2 = (W2diff2 < 0) ?
false :
true;
408 bool W2cond3 = (W2diff3 < 0) ?
false :
true;
413 bool passWindow2 =
false;
414 if (W2cond1 && (W2cond2 && W2cond3))
416 else if (!W2cond1 && (W2cond2 || W2cond3))
422 if (passWindow1 || passWindow2) {
429 template <
class Type1>
431 const unsigned int obj2Eta,
434 const unsigned int nEtaBits)
const {
440 unsigned int compare = obj1Eta - obj2Eta;
443 unsigned int larger, smaller;
452 unsigned int diff = ((larger + ((~smaller + 1) & 255)) & 255);
454 unsigned int diff1 = upperR - lowerR;
455 unsigned int diff2 =
diff - lowerR;
456 unsigned int diff3 = upperR -
diff;
458 bool cond1 = ((diff1 >> nEtaBits) & 1) ?
false :
true;
459 bool cond2 = ((diff2 >> nEtaBits) & 1) ?
false :
true;
460 bool cond3 = ((diff3 >> nEtaBits) & 1) ?
false :
true;
462 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 463 <<
"\n\t obj1Eta = " << obj1Eta <<
"\n\t obj2Eta = " << obj2Eta <<
"\n\t lowerR = " << lowerR
464 <<
"\n\t upperR = " << upperR <<
"\n\t compare = " <<
compare <<
"\n\t cond = " <<
cond 465 <<
"\n\t diff = " <<
diff <<
"\n\t diff1 = " << diff1 <<
"\n\t cond1 = " << cond1
466 <<
"\n\t diff2 = " << diff2 <<
"\n\t cond2 = " << cond2 <<
"\n\t diff3 = " << diff3
467 <<
"\n\t cond3 = " << cond3 << std::endl;
469 if (cond1 && (cond2 && cond3))
471 else if (!cond1 && (cond2 || cond3))
478 template <
class Type1>
480 const unsigned int obj2Phi,
482 const Type1& upperR)
const {
487 int diff1 = upperR - lowerR;
491 bool cond1 = (diff1 < 0) ?
false :
true;
492 bool cond2 = (diff2 < 0) ?
false :
true;
493 bool cond3 = (diff3 < 0) ?
false :
true;
495 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 496 <<
"\n\t obj1Phi = " << obj1Phi <<
"\n\t obj2Phi = " << obj2Phi
497 <<
"\n\t deltaPhi = " <<
deltaPhi <<
"\n\t lowerR = " << lowerR <<
"\n\t upperR = " << upperR
498 <<
"\n\t diff1 = " << diff1 <<
"\n\t cond1 = " << cond1 <<
"\n\t diff2 = " << diff2
499 <<
"\n\t cond2 = " << cond2 <<
"\n\t diff3 = " << diff3 <<
"\n\t cond3 = " << cond3
505 if (cond1 && (cond2 && cond3))
507 else if (!cond1 && (cond2 || cond3))
514 template <
class Type1>
516 const std::vector<Type1>& windows)
const {
517 if (windows.empty()) {
521 for (
const auto&
window : windows) {
524 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 525 <<
"\n\t window.lower = " <<
window.lower <<
"\n\t window.upper = " <<
window.upper
526 <<
"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
const bool checkCut(const Type1 &cutL, const Type2 &value, bool condGEqValue) const
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