1 #ifndef L1Trigger_L1TGlobal_ConditionEvaluation_h 2 #define L1Trigger_L1TGlobal_ConditionEvaluation_h 78 virtual void print(std::ostream& myCout)
const;
88 template <
class Type1,
class Type2>
90 const Type1& thresholdH,
92 bool condGEqValue)
const;
99 template <
class Type1,
class Type2>
101 const Type1& thresholdH,
103 bool condGEqValue)
const;
106 template <
class Type1>
107 const bool checkIndex(
const Type1& indexLo,
const Type1& indexHi,
const unsigned int index)
const;
110 template <
class Type1>
114 template <
class Type1>
116 const Type1& W1beginR,
118 const Type1& W2beginR,
120 const unsigned int nEtaBits)
const;
123 template <
class Type1>
125 const Type1& W1beginR,
127 const Type1& W2beginR,
128 const Type1& W2endR)
const;
131 template <
class Type1>
133 const unsigned int obj2Eta,
136 const unsigned int nEtaBits)
const;
139 template <
class Type1>
141 const unsigned int obj2Phi,
143 const Type1& upperR)
const;
164 template <
class Type1,
class Type2>
166 const Type1& thresholdH,
168 const bool condGEqValue)
const {
170 LogTrace(
"L1GlobalTrigger") <<
" checkThreshold check for condGEqValue = " << condGEqValue
171 <<
"\n hex: " << std::hex <<
"threshold = " << thresholdL <<
" - " << thresholdH
172 <<
" value = " <<
value <<
"\n dec: " <<
std::dec <<
"threshold = " << thresholdL
173 <<
" - " << thresholdH <<
" value = " <<
value << std::endl;
177 if (
value >= (Type2)thresholdL && (Type1)
value < thresholdH) {
187 if (
value == (Type2)thresholdL) {
203 template <
class Type1,
class Type2>
205 const Type1& thresholdH,
207 const bool condGEqValue)
const {
209 LogTrace(
"L1GlobalTrigger") <<
" checkUnconstrainedPt check for condGEqValue = " << condGEqValue
210 <<
"\n hex: " << std::hex <<
"threshold = " << thresholdL <<
" - " << thresholdH
211 <<
" value = " <<
value <<
"\n dec: " <<
std::dec <<
"threshold = " << thresholdL
212 <<
" - " << thresholdH <<
" value = " <<
value << std::endl;
217 if (
value >= (Type2)thresholdL && (Type1)
value <= thresholdH) {
222 if (
value == (Type2)thresholdL) {
232 template <
class Type1>
234 const Type1& indexHi,
235 const unsigned int index)
const {
236 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 237 <<
"\n\t indexLo = " << indexLo <<
"\n\t indexHi = " << indexHi <<
"\n\t index = " <<
index 241 if (indexLo > indexHi) {
252 template <
class Type1>
258 LogTrace(
"L1GlobalTrigger") <<
" checkBit " 259 <<
"\n Bit number = " <<
bitNumber <<
" larger than maximum allowed " 260 <<
sizeof(oneBit) * 8 << std::endl;
274 return (
mask & oneBit);
278 template <
class Type1>
280 const Type1& W1beginR,
282 const Type1& W2beginR,
284 const unsigned int nEtaBits)
const {
286 if (W1beginR == W1endR && W1beginR == (Type1)-1) {
290 unsigned int W1diff1 = W1endR - W1beginR;
291 unsigned int W1diff2 =
bitNumber - W1beginR;
292 unsigned int W1diff3 = W1endR -
bitNumber;
294 bool W1cond1 = ((W1diff1 >> nEtaBits) & 1) ?
false :
true;
295 bool W1cond2 = ((W1diff2 >> nEtaBits) & 1) ?
false :
true;
296 bool W1cond3 = ((W1diff3 >> nEtaBits) & 1) ?
false :
true;
301 bool passWindow1 =
false;
302 if (W1cond1 && (W1cond2 && W1cond3))
304 else if (!W1cond1 && (W1cond2 || W1cond3))
310 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 311 <<
"\n\t bitNumber = " <<
bitNumber <<
"\n\t W1beginR = " << W1beginR
312 <<
"\n\t W1endR = " << W1endR <<
"\n\t W1diff1 = " << W1diff1
313 <<
"\n\t W1cond1 = " << W1cond1 <<
"\n\t W1diff2 = " << W1diff2
314 <<
"\n\t W1cond2 = " << W1cond2 <<
"\n\t W1diff3 = " << W1diff3
315 <<
"\n\t W1cond3 = " << W1cond3 <<
"\n\t passWindow1 = " << passWindow1 << std::endl;
317 if (W2beginR == W2endR && W2beginR == (Type1)-1) {
321 unsigned int W2diff1 = W2endR - W2beginR;
322 unsigned int W2diff2 =
bitNumber - W2beginR;
323 unsigned int W2diff3 = W2endR -
bitNumber;
325 bool W2cond1 = ((W2diff1 >> nEtaBits) & 1) ?
false :
true;
326 bool W2cond2 = ((W2diff2 >> nEtaBits) & 1) ?
false :
true;
327 bool W2cond3 = ((W2diff3 >> nEtaBits) & 1) ?
false :
true;
329 bool passWindow2 =
false;
330 if (W2cond1 && (W2cond2 && W2cond3))
332 else if (!W2cond1 && (W2cond2 || W2cond3))
338 LogDebug(
"l1t|Global") <<
"\n\t W2beginR = " << W2beginR <<
"\n\t W2endR = " << W2endR
339 <<
"\n\t W2diff1 = " << W2diff1 <<
"\n\t W2cond1 = " << W2cond1
340 <<
"\n\t W2diff2 = " << W2diff2 <<
"\n\t W2cond2 = " << W2cond2
341 <<
"\n\t W2diff3 = " << W2diff3 <<
"\n\t W2cond3 = " << W2cond3
342 <<
"\n\t passWindow2 = " << passWindow2
343 <<
"\n\t pass W1 || W2 = " << (passWindow1 || passWindow2) << std::endl;
345 if (passWindow1 || passWindow2) {
353 template <
class Type1>
355 const Type1& W1beginR,
357 const Type1& W2beginR,
358 const Type1& W2endR)
const {
360 if (W1beginR == W1endR && W1beginR == (Type1)-1) {
364 int W1diff1 = W1endR - W1beginR;
368 bool W1cond1 = (W1diff1 < 0) ?
false :
true;
369 bool W1cond2 = (W1diff2 < 0) ?
false :
true;
370 bool W1cond3 = (W1diff3 < 0) ?
false :
true;
375 bool passWindow1 =
false;
376 if (W1cond1 && (W1cond2 && W1cond3))
378 else if (!W1cond1 && (W1cond2 || W1cond3))
384 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 385 <<
"\n\t bitNumber = " <<
bitNumber <<
"\n\t W1beginR = " << W1beginR
386 <<
"\n\t W1endR = " << W1endR <<
"\n\t W1diff1 = " << W1diff1
387 <<
"\n\t W1cond1 = " << W1cond1 <<
"\n\t W1diff2 = " << W1diff2
388 <<
"\n\t W1cond2 = " << W1cond2 <<
"\n\t W1diff3 = " << W1diff3
389 <<
"\n\t W1cond3 = " << W1cond3 << std::endl;
391 if (W2beginR == W2endR && W2beginR == (Type1)-1) {
395 int W2diff1 = W2endR - W2beginR;
399 bool W2cond1 = (W2diff1 < 0) ?
false :
true;
400 bool W2cond2 = (W2diff2 < 0) ?
false :
true;
401 bool W2cond3 = (W2diff3 < 0) ?
false :
true;
406 bool passWindow2 =
false;
407 if (W2cond1 && (W2cond2 && W2cond3))
409 else if (!W2cond1 && (W2cond2 || W2cond3))
415 if (passWindow1 || passWindow2) {
422 template <
class Type1>
424 const unsigned int obj2Eta,
427 const unsigned int nEtaBits)
const {
433 unsigned int compare = obj1Eta - obj2Eta;
436 unsigned int larger, smaller;
445 unsigned int diff = ((larger + ((~smaller + 1) & 255)) & 255);
447 unsigned int diff1 = upperR - lowerR;
448 unsigned int diff2 =
diff - lowerR;
449 unsigned int diff3 = upperR -
diff;
451 bool cond1 = ((diff1 >> nEtaBits) & 1) ?
false :
true;
452 bool cond2 = ((diff2 >> nEtaBits) & 1) ?
false :
true;
453 bool cond3 = ((diff3 >> nEtaBits) & 1) ?
false :
true;
455 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 456 <<
"\n\t obj1Eta = " << obj1Eta <<
"\n\t obj2Eta = " << obj2Eta <<
"\n\t lowerR = " << lowerR
457 <<
"\n\t upperR = " << upperR <<
"\n\t compare = " <<
compare <<
"\n\t cond = " <<
cond 458 <<
"\n\t diff = " <<
diff <<
"\n\t diff1 = " << diff1 <<
"\n\t cond1 = " << cond1
459 <<
"\n\t diff2 = " << diff2 <<
"\n\t cond2 = " << cond2 <<
"\n\t diff3 = " << diff3
460 <<
"\n\t cond3 = " << cond3 << std::endl;
462 if (cond1 && (cond2 && cond3))
464 else if (!cond1 && (cond2 || cond3))
471 template <
class Type1>
473 const unsigned int obj2Phi,
475 const Type1& upperR)
const {
480 int diff1 = upperR - lowerR;
484 bool cond1 = (diff1 < 0) ?
false :
true;
485 bool cond2 = (diff2 < 0) ?
false :
true;
486 bool cond3 = (diff3 < 0) ?
false :
true;
488 LogDebug(
"l1t|Global") <<
"\n l1t::ConditionEvaluation" 489 <<
"\n\t obj1Phi = " << obj1Phi <<
"\n\t obj2Phi = " << obj2Phi
490 <<
"\n\t deltaPhi = " <<
deltaPhi <<
"\n\t lowerR = " << lowerR <<
"\n\t upperR = " << upperR
491 <<
"\n\t diff1 = " << diff1 <<
"\n\t cond1 = " << cond1 <<
"\n\t diff2 = " << diff2
492 <<
"\n\t cond2 = " << cond2 <<
"\n\t diff3 = " << diff3 <<
"\n\t cond3 = " << cond3
498 if (cond1 && (cond2 && cond3))
500 else if (!cond1 && (cond2 || cond3))
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 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 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)
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 Type1 &W1beginR, const Type1 &W1endR, const Type1 &W2beginR, const Type1 &W2endR, const unsigned int nEtaBits) const
check if a value is in a given range and outside of a veto range
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 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...)
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition